Solved

Send Same Event to Multiple customers in campaign

  • 29 January 2024
  • 8 replies
  • 126 views

The title pretty much says what we want to reach. 

 

Example:

  • There’s an event ‘Invitation’ that you send to customer.io.
  • That event holds an ‘invitees’ attribute, holding the customer.io ‘id’ identifiers as array.
  • You simply want to trigger a campaign B for all of the customers referenced within ‘invitees’ (to send transactional e-mail notifying about invitation).

How can you do this?

What we’ve tried / does not work:

  • API-triggered broadcast : Not an option, as only works every 10 seconds (and is not recommended for transactional context, as stated here).
  • Sending a transactional API call for every recipient is not an option either, as the event ‘Invitation’ is triggered from the frontend, so we would need to fire like 5 - 10 API calls to the transactional API before delivering the API response back to our client (for the request triggering the ‘Invitation’ event). 
  • Batch Update: You cannot perform batch updates ‘for all users whose ID match any ID of an array provided in the trigger’.
  • Webhook-triggered campaign: Same problem as for batch update.
  • Current solution we have, which feels really wrong and is not scalable: Create an event-triggered campaign which, in addition to the ‘invitees’ attribute, sends an ‘amount_of_invitees’ attribute. Then, in the workflow of the campaign triggered via the ‘Invitation’ event, flow through 10 sequential True / False checks, in the sense: ‘if the amount_of_invitees is at least 2, send e-mail to ‘invitees[1]’, then if it’s at least 3, send e-mail to ‘invitees[2]’, and so on. But besides that this feels really wrong, this requires an adaptation of the workflow every time the amount of possible invitees increases.
icon

Best answer by Emaildev 31 January 2024, 14:35

View original

8 replies

Possible solution (criteria for this to work is that an event-triggered campaign can trigger itself ‘recursively’, is that possible / permitted?):

  • Create an Event-triggered campaign A ‘invitation sent’ triggered via the ‘Invitation Sent’ Event, with the ‘invitees’ attribute; holding all customer.io IDs of all customers who received an invitation as array.
  • Create an Event-triggered campaign B ‘invitation received’, triggered via the ‘Invitation Received’ Event, with the same ‘invitees’ event attribute; holding all customer.io ids of all customer who received an invitation as array.
  • Whenever an invitation is sent, send the ‘invitation sent’ event, which will trigger campaign A.
  • within campaign A, send the ‘Invitation Received’ event to the customer with customer.io ID ‘invitees[0]’. The ‘invitees’ attribute of that event becomes the same as the one received via the ‘Invitation sent’ event, after removing the first one. 

    Example:
  • ‘Invitation Sent’ Event sent with ‘invitees’ being [12,16,27]
  • Campaign A triggered, doing everything necessary related to ‘Invitation Sent’, then sends ‘Invitation Received’ Event to customer with customer.io ID 12, with ‘invitees’ value being [16,27]
  • Campaign B triggered, sending an according notification e-mail to customer with customer.io ID 12, then re-triggering ‘Invitation Received’ for customer with customer.io ID 16, and ‘invitees’ being equal to [27].
  • Campaign B re-triggered, sending an according notification e-mail to customer with customer.io ID 16, then re-triggering ‘Invitation Received’ for customer with customer.io ID 27, and ‘invitees’ being equal to ‘none’.
  • Campaign re-triggered, sending an according notification e-mail to customer with customer.io ID 27, and then exiting the workflow, as the value of ‘invitees’ is ‘none’.

 

Makes sense?

Userlevel 4

Hey Emaildev,

quick question to understand the problem better:

What's holding you back from using custom objects and relationships?

Hi Felix,


Cheers for your quick reply.
The fact that it has a limit of 500 for our plan, and our platform will quickly create more than 500 events to which ‘Inivitation’ relates to. Hence doing this based on events sounds much more reasonable to us. 
We’ve actually tried to build a campaign re-triggering itself now, exactly explained in the way above, and we just get a warning in the campaign’s ‘Send Event’ Action, telling that that will re-trigger the campaign, and that it should thus be wrapped within a Conditional Check or similar (which we do). So this means that a campaign can actually trigger itself ?

Userlevel 4

OK, understood. I guess it can trigger itself then. 

Another idea I have is using the update a person tile and choose "update another person". Never used it, though. Have you checked that?

 

Also maybe you can delete custom object profiles via API after the email is sent so you don't reach 500? I would still recommend to use custom objects tbh. They are working on it a lot right now as far as I know and it feels like this should be the solution for you without hitting another problem as soon as something changes.. Just my opinion. 

We first though about the “update another person” thing too. But the problem with this is: there’s no way in customer.io to iterate through an array of an unknown amount of customer.io IDs (e.g. sent in an event) to trigger an event for / update the concerned person for every iterated ID. If you know about one while staying within a campaign, feel free to let us know!

 

The thing with custom objects is (as it seems, we quickly had a better look at that feature, never worked with it) that it kind of requires you to establish your object - person relationships within customer.io’s storage. If you have a relational database on your own server, you would thus need to duplicate that entire logic into customer.io for the concerned objects, which does not make sense to us / probably creates more problems than you’re trying to solve.

Another and probably the simplest solution we’ve found so far: Instead of sending the ‘Invitation Sent’ using customer.io’s Journeys Track API from our own backend, we’ll rather simply send the ‘Invitation Sent’ Event plus all of the corresponding ‘Invitation Received’ Events in a single API Request to customer.io’s Data Pipeline Batch API Endpoint. We’re just not really sure if we understood the following things correctly:

  1. When we send events using the above-mentioned Batch API Endpoint into customer.io using Data Pipelines, are these events also added to Journeys, and trigger Event-Triggered Campaigns in the exact same way as if the Event is sent into customer.io using the Journey API?
     
  2. We have a tool - that is not available as a destination within customer.io - to which we must forward:
     
    • data sent to cio from our backend, via Journeys Track API
       
    • all message-related events (e-mail opens, clicks, etc.)

Currently, we’re doing so by, respectively:

  • creating an event-triggered campaign for every event we sent into customer.io from our backend using the Journeys Track API. At the end of every one of them, we use the ‘Send and Receive Data’ Action in the Workflow builder to forward the event as a HTTP Request to our tool. This is possible as we add a ‘forwarding_request’ event attribute to every event we send into cio using the Journey Track API, such that we can simply use that data to always trigger the same ‘Send and Receive Data’ action (with the same placeholders, in every event-triggered campaign, which feels odd).
     
  • using a webhook endpoint we’ve setup on our REST API as a Reporting Webhook.

This feels not like the right solution, as we feel that we can achieve exactly the same in a much more flexible way, simply by:

  • Setting up data pipelines to use both ‘Journeys Message Metrics’ and ‘Journeys API:{Credentials-name}’ as Sources
     
  • connect these to a Webhook-Destination with the request we must send to our other tool to forward the event to it; by building the request in the same way as we do within the event-triggered campaigns in our current approach.

Is our assumption correct that this yields exactly the same result?

Question 1. of our post above confuses us particularly in the sense that the image shown in step 4. of the docs explaining how to connect a destination to a source present a ‘Data Pipelines API Source’, which we cannot find. So how can we forward events that we submit to customer.io using the Data Pipeline API to a specific destination?

As we understood, we have to setup that Data Pipeline Source on our own, according to the docs. Then use that source and connect it to an additional webhook destination? And this will exclusively forward the data pipeline events received via that actual HTTP REST API source? As customer.io automatically transforms journey events into data pipeline events; won’t that cause data pipeline events to be forwarded twice then (the ones incoming via the Journey Tracking API) ?

Or even simpler: Simply use the batch Endpoint of the Journey Track API, (with ‘type’ = ‘person’ and ‘action’ = ‘event’) and forget about the need to configure the Data Pipelines API as a HTTP source in your Pipeline Connections. This is probably the easiest solution to our problem..

Reply