Create Automation in UChat
Whatsapp Ad Referral Trigger
WhatsApp Ad Referral Trigger is a new feature that allows you to release ads on Facebook and trigger specific automations in your WhatsApp chatbot when users click on the ads
Here we will cover two important aspects of this feature:
triggering different flows for different ads
handling duplicate messages.
You can check the video tutorial below to get started:
Video Tutorial:
Triggering Different Flows for Different Ads
When running multiple ads for different products or services, it is essential to ensure that each ad triggers the appropriate automation flow. To achieve this, you can set up conditions to determine which ad the user is coming from.
To begin, create a new flow, which we'll call the "WhatsApp Ads Router." This flow will serve as a router for all ads, redirecting users to different flows based on the ad they clicked.
Creating a Trigger
Automations -> Triggers -> +New Trigger -> WhatsApp Ad Referral
Let’s see how the JSON CUF data looks like:
Source_id -> it is relevant to which ads you are running.
Source_url -> you can use.
These two are unique identifiers for the ads you are running, which is shown by Source_type -> which tells it is ads.
Create the sub-flow to redirect to specific flows
Using the Condition Nodes and with the use of Source_id, we can trigger respective different flows.
Let’s create a new Sub-flow called “Whatsapp_Ads_Router” Every ads will be directed to this flow and based on the Source Id of the Ad, it will redirected to different sub-flow.
First create Action Node -> Set Variable Value -> Whatsapp_ads_ID (CUF created) and assign the value of JSON path.
To know how to create a JSON Path, use the following application called JSONPath Online Evaluator with url -> JSON Path Finder
Now using these JSON Paths, let’s set up the CUF values.
Source_id -> $.source_id
Source_type -> $.source_type
Creating a Condition Node, where checking the WhatsApp_ads_ID is having a certain Number (collecting the data from the </> 10_records JSON CUF variable). By this source_id number you know the source of coming of which product and service the ad is. In this way, you can trigger different flow connected to different ads.
How to Handle the default reply or Main flow to avoid “sending duplicate messages”
If the default reply is active -> Condition Control of the flow triggered
If the default reply is NOT active -> Condition Control of the Main flow.
We need to add the Condition Node at the beginning of the Flow, which is triggered.
If the default reply is NOT active, it will trigger the Main-flow. So you need to add the condition node at the start of the Flow.
Let’s show you in the automations for Case 1 where Default reply is Active:
Automations -> keywords -> Default Reply -> Active -> Choose the sub-flow example (Default Reply).
When the new user is coming into the Bot, this sub-flow will trigger always.
In this Default Reply sub-flow you need to add a Condition Node, if the Traffic_type contains ad, you are not sending them anything because you already have a subflow that is handling this automation.
It’s also highly recommend that you can use the Last Message JSON system field instead of the WhatsApp referral Payload.
You have already designed the flow WhatsApp Ads Router to handle the traffic coming from the Ads.
Incase if the Default reply is not active,
Automations -> keywords -> Default Reply -> Not Active -> we are triggering the Main flow.
You need to go the main flow, and add the Condition Node, checking for the traffic_type is ad, if yes, you are not sending them anything.
As already automations are handled by the WhatsApp_ads_Router.
This will ensure the user receives only messages from One Automation, that you are setting inside the WhatsApp_ads_Router.
For the regular user that is coming Organically from your ref url or your website widget, they still can trigger the main flow.
By this the user coming from the Ads will not get duplicate messages.