The Challenge
Integrating WhatsApp messages into your Automated Marketing System (AMS), powered by Mautic, can be tricky if you want to send them within your campaigns. While Mautic supports SMS messaging out of the box through Twilio, adding WhatsApp messaging requires some extra configuration.
Pre-Requisites
Before you begin, make sure you have:
•A functional Twilio account with access to WhatsApp messaging.
•An active WhatsApp Business API set up in your Twilio account.
Solution
By default, your AMS (hosted with Mailertizer) includes integration with Twilio, primarily for sending SMS messages. This integration works out of the box for SMS, but sending WhatsApp messages requires a slightly different setup.
Steps to Send WhatsApp Messages
1.Set Up Twilio for WhatsApp
If you haven’t already, ensure that your Twilio account is configured to send WhatsApp messages. Twilio provides a sandbox for testing and allows you to link your Twilio number to WhatsApp for this purpose.
2.Create a Custom Webhook
In Mautic, sending a WhatsApp message is done via a Webhook Action. This allows you to use any external API, such as Twilio’s API, to trigger a WhatsApp message.
•Go to your Mautic campaign and add the “Send Webhook” action.
•In the Webhook URL, input the Twilio API endpoint for sending WhatsApp messages. This will typically look like:
https://api.twilio.com/2010-04-01/Accounts/YOUR_TWILIO_ACCOUNT_SID/Messages.json
3.Configure the Webhook to Send WhatsApp
You’ll need to send a POST request to Twilio’s API to trigger the WhatsApp message. The request body should include the From and To numbers, as well as the message body. Here’s an example of how the body of the request might look:
{
“From”: “whatsapp:+14155238886”,
“To”: “whatsapp:+1234567890”,
“Body”: “Hello, this is a message from your automated campaign.”
}
4.Add Dynamic Variables (Optional)
You can include dynamic fields from your contacts to personalize the WhatsApp messages. For example, you might want to send the recipient’s first name:
{
“From”: “whatsapp:+14155238886”,
“To”: “whatsapp:+{contactfield=phone}”,
“Body”: “Hello {contactfield=firstname}, this is your order update.”
}
5. Test Your Setup
Once your webhook is set up, trigger the campaign and verify that the WhatsApp message is sent successfully to your contact’s number. If you encounter any issues, check the Twilio logs to troubleshoot.
Conclusion
With these steps, you can seamlessly integrate WhatsApp messaging into your Mailertizer-powered AMS campaigns. By using the Send Webhook action in Mautic, you can trigger WhatsApp messages just as easily as SMS, providing a richer, more personalized communication channel for your campaigns.
If you need help setting this up or run into any issues, feel free to leave a comment below or contact us for support!