Introduction
The Ads Referral Trigger in UChat allows you to create Facebook ads that, when clicked, open your chatbot on Messenger. Depending on the configured ad, you can trigger different automations in your chat. This documentation covers two important points: how to trigger different flows for different ads and how to handle duplicate messages.
1. Triggering Different Flows for Different Ads
Step 1: Creating the Trigger
Go to the automation section and select "Triggers." Create a new trigger with the reference payload. This payload will be a JSON that you will save in the user's custom fields.
Creating the trigger:
...
Saving the payload and Ad Id in custom fields:
...
Choosing the subflow that will redirect the user to the correct flow based on the ad ID:
...
Step 2: Setting Up the Ads Router
In your new flow called "Facebook Ads Router.", add a condition node at the beginning of this flow to check the Facebook ads ID and redirect the user to the correct flow based on the ad ID. You can configure it as shown in the image below:
Note: To learn how to find your ad ID, you can access the following link:
https://www.facebook.com/business/help/2534657046763437
2. Handling Duplicate Messages
Situation 1: Active Default Response
Create a new flow for the default response. Add a condition to check if the traffic type contains "ads." If the traffic comes from an ad, do not send any additional messages, as the ads router flow is already handling the automation.
Situation 2: Inactive Default Response
Go to the main flow and add a condition at the beginning. Check if the traffic comes from an ad. If the traffic comes from an ad, do not send any additional messages, thus avoiding duplicate messages.
See the image below for an example of this condition node to check the traffic type:
...
Summary
In this tutorial, we learned how to:
Redirect users to different automation flows on Messenger based on the clicked ads.
Set up conditions to avoid sending duplicate messages by checking if the traffic comes from ads.
If you need further assistance, please submit a ticket at ticket@uchat.com.au