Avoid duplicate messages (Event Triggered Campaigns)

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. Blueshift uses the value to ensure that only one message gets sent. The transaction_uuid value must be a well formed UUID.

Example: Here's 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, the API returns 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,  a message is added to the response noting this.

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

  • 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. Ensure that 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

Comments

0 comments

Please sign in to leave a comment.