How to perform a WhatsApp broadcast using Tiledesk
If you want to perform a broadcast operation on the WhatsApp Channel you are in the right place! Let's see how is possible to use the powerful of Tiledesk and the new Chatbot Design Studio to send WhatsApp templates to you customers using the API. Not only this, let's see also how to check the broadcast status and how to receive real time notifications using a webhook.
Create and configure a Chatbot on Tiledesk
If you haven't created a Chatbot yet, sign in on the Tiledesk Dashboard, create or select a project and click on Bot on the left sidebar. Click on Add from scratch button and create a new Chatbot.
You are now in the new Chatbot Design Studio. You can customize your chatbot as you prefer.
It is not necessary that the actions that we are going to setup will be part for the principle flow, so it can be unconnected with the others blocks.
Drag and Drop the WhatsApp by Attribute action in the canvas (you can find it under the Integrations section) and change the name of the block like you prefer. In this example we called it ‘whatsapp_broadcast’.
Configure this action is very easy. Simply create a custom attribute by giving it a name that you will use later and choose it in the “Assign to” select box.
Done! Your action is ready to be used.
Use the Fast Prototyping trick to generate the request payload
In order to use this action with the Tiledesk API is necessary to discover how the request payload is made. To do this we can use another action whose purpose is only to help you understand the structure of the json.
Drag and Drop the WhatsApp Static action in the canvas and start working on it, but note that this block will never executed directly, but can be used as an important fast prototyping tool.
Get your Phone Number Id from the Meta for Developers platform and paste it on the Phone Number Id input field, then choose the template that you want to use in the broadcast.
It's very probable that the selected template contains parameters, so let's fill in the corresponding fields with some example information, including the recipient's phone number.
A little further down you will be able to see the auto-generated payload that we can use to compile the HTTP request.
Keep entering all your recipients to have a complete payload or continue adding them in the editor you like best.
Perform the request
Once your payload is completed and ready to be used we can finally process with sending the broadcast. In this example we used Postman as platform to build and perform API requests, but fell free to use whatever software you find comfortable.
Let's configure the HTTP request as follows:
- Method: POST
- Url: https://api.tiledesk.com/v3/modules/tilebot/ext/BOT_ID_CHANGE
- Header: Content-Type: application/json
Paste the auto-generated payload making sure that:
- payload.text must be the name of the WhatsApp by Attribute action
- payload.text.request_id must be on the format “automation-request--"
- payload.token must be the chatbot token provided by Tiledesk
Get chatbot token
You can get the token associated with your chatbot from the Chatbot Design Studio itself, clicking on Settings on the left side menu, and under the Developer tab you can generate a new token simply clicking on Get Token button.
That's all! Just send the request and wait for the magic. Tiledesk will take care of the broadcast request and send the messages to the selected contacts.
You may ask where and how you can check the broadcast status and the status of every single message.
Well, come back to the Tiledesk Dashboard and go to Settings → Automations Log. Here you can find all your automations and their status.
Click on one automation to see the detail.s Here you see how many messages are currently processed and the status coming from WhatsApp directly, but above all it is possible to get feedback on any errors when sending the message.
If you have any questions, feel free to contact us live on chat or at email@example.com 📧
For more info on who we are, what we do, or what is our shtick, visit the Tiledesk Website 👩🚀