How to avoid duplicate messages - Event Triggered Campaigns

 

How can I avoid duplicate messages?

If you want to avoid duplicate messages, you can add an attribute called transaction_uuid to your event or the payload to the campaign execution API endpoint. We will use the value to ensure only one message gets sent. The transaction_uuid value must be a well formed UUID.

Example: Here is a how you could use it in an event.

  • JSON
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '
{
  "customer_id": "812122",
  "event": "add_to_cart",
  "products": [{ "sku": "33133445-444" }],
  "transaction_uuid": "5bb4fbb8-0dc9-41ba-827d-4db31c7e79d3"
}' -u <EVENT_API_KEY>: https://api.getblueshift.com/api/v1/event

If you are using the campaign execution API, we will return a 200 status code, even when the request is duplicated (whether from the client or from the load balancer). If it is a duplicate request, we would also add a message to the response noting this.

Example: A response of this type can only occur if the user was sent an email already.

  • JSON
{ 
  "success": true, 
  "message": "request with transaction uuid 5BB4FBB8-0DC9-41BA-827D-4DB31C7E79D3 has already been processed"
}

You can also use the transaction_uuid to match the event with the messages sent to the user. The value you set for transaction_uuid is stored in the extended_attributes for "sends" in the user campaign activity report. You just need to make sure you are logging or storing the transaction_uuid in your systems to tie out the activity generated by your systems and the messaging happening in Blueshift.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request