Webhooks can be used in Superchat to start an automation. Here's how it works:
Step by step guide
Create a new automation and click on Add Trigger.
Choose Incoming Webhook as a trigger.
Copy the Targer URL.
Now we need to create test data to further configure the webhook trigger. You can do this in a tool of your choice; in our example, we are using Zapier. Please use a POST request for this:
Now we need specific test data. To do this, you can insert the target URL from Step 3 into the "Configure" step. Additionally, you can define in the body which data should be sent, such as the contact's phone number. In this example, I have filled it in manually; for a real process, you would populate this field with the variable from the trigger of the Zap.
Send the webhook to receive testdata in Superchat.
Back to the automation in Superchat. Test data should have arrived here by now. Verify this and save the variable. Then you can create the next step of the automation by clicking on the circle, dragging it to an empty space to the side, and dropping it.
Now we need to check whether a contact already exists for the phone number received via webhook. To do this, select the "Search contact" element.
If you want to search for the contact based on the phone number, select Search based on phone number and click on the variable element on the right side.
Now select the phone number from the "Incoming Webhook" trigger.
Now there are two possibilities: either the contact already exists under the phone number, or it does not. First, we define the path for when the contact is found. Click on Contact Found and define the next step.
Now, select Search Conversation. If we want to send a message to a contact who has already had a conversation with us, we must first search for the conversation so that the system knows which conversation to send the message to.
Now there are two possibilities again. Either there is already a conversation, or there isn't. First, define the path if a conversation already exists. For this, define the next step after Conversation Found.
Select Send WhatsApp Template as the next node. Here, you can choose the WhatsApp template that should be sent.
Now, let's define the path if no conversation has been held with the contact yet. Define the next step after "No Search Result".
Choose Send WhatsApp Template.
Select the WhatsApp template you would like to send in this case.
Now we have defined the paths when the contact is found in the system based on the phone number. Next, we will define the path when the phone number has not yet been stored in the system. Navigate back to the second block of the automation, Search Contact, and define the next step after No Search Result.
Choose Create contact.
Fill the "Phone Number" field with the variable block.
Select the variable from the trigger, in our case, the phone number.
After creating the contact, you can now define the next step.
Choose Send WhatsApp template.
Now choose the WhatsApp template you want to send.
Publish the automation.
Exchange ideas with experts from your industry in our community. This is the best place to gather initial ideas, especially at the beginning:
Join our Superchat Community