Question

Trigger slack message only once for multiple events

  • 19 December 2023
  • 2 replies
  • 63 views

Hello!

I am having a bit of difficulty while creating a campaign to send messages through slack.

Let me explain the scenario I have:

 

We have a system that manages the schedule of private classes, that occur on third-party facilities. And our main channel for communications with these facilities are slack channels in a private workspace.

Every time a teacher cancels a class, we send a `class_cancelled` event to Customer.io for each student enrolled in that class. So if we have a class with 5 students, we send 5 events (1 for each student).

And we use these events as triggers to send a push notification to each student, warning that their class has been cancelled. This part is working fine!!!

 

However, we also need to send a notification to the classroom slack channel, to let the third-party people that work in the facility know that the class has been cancelled. And this is where I'm struggling, I couldn't figure out how to create a campaign that will allow me to notify this slack channel only once, starting from the `class_cancelled` event. Because since there are multiple events (one for each student), I end up notifying the slack channel multiple times for each class cancellation.

 

I tried using the frequency feature in the campaign to limit the number of notifications sent in a certain timeframe, but this also doesn't work because we can have multiple classes being cancelled at the same time.

 

I hope you can help me to find a solution this situation :)


2 replies

Hi,

I’m not 100% sure this works for you, but what I’ve done in somewhat similar situations in the past is that I’ve included the attribute that describes the top level category, flow or page into the event payload data. In your case this would be the class name, ID or some other unique identifyer that would have to be in the payload of the “class_cancelled” event as your event itself is a general one that does not allow class differentiation by event name alone.  


Then I’d build a class specific campaign or a general campaign that has multiple paths for different classes in one with the following logic:

  1. Create a workflow path that takes advantage of this new attribute and filters out the specific class channel to target
  2. Add the messaging “time-window” and/or “wait until” elements with specific Slack message condition in the workflow path to limit the send rate into that Slack channel
    1. In essence you will send it once within a time window and bypass sending flow for the same message within that time window
  3. Send the message to the general channel whenever first student enters the flow and bypass the others with the matching filters and conditionals
  4. Exit all the students from the corresponding campaign flow so they can be re-introduced whenever there is another cancellation


Hope this helps
​​​​​​​Maiko

Then I’d build a class specific campaign or a general campaign that has multiple paths for different classes in one with the following logic:

  1. Create a workflow path that takes advantage of this new attribute and filters out the specific class channel to target
  2. Add the messaging “time-window” and/or “wait until” elements with specific Slack message condition in the workflow path to limit the send rate into that Slack channel
    1. In essence you will send it once within a time window and bypass sending flow for the same message within that time window
  3. Send the message to the general channel whenever first student enters the flow and bypass the others with the matching filters and conditionals
  4. Exit all the students from the corresponding campaign flow so they can be re-introduced whenever there is another cancellation

Thank you for the suggestion, @Maiko !

I don't know if I created the campaign following these steps correctly, but the workflow didn't work.

It ended up sending multiple messages in the slack channel because all the events happen at the exactly same time, and therefore the "wait until"/"time-window" conditions do not work because no way to identify the "first student that entered the flow", as they enter together at the same exactly time...

Reply