Hi folks,
We're back with a new post in our InteGreat series, and this time we're going to walk you through how to integrate your Zoho Creator application with Whatsapp using Twilio.
Before we dive into this integration, let's quickly cover some basics.
What is Whatsapp? How do businesses leverage it?
WhatsApp Messenger, or simply WhatsApp, is a cross-platform messaging app that lets you make video and voice calls, send text messages, and more.
With the introduction of Whatsapp Business, more businesses are using it as a means to communicate and engage with their customers and leads. They also use it for sending information, such as appointment details, shipping details, and confirming booking requests.
In this post, we'll talk about how to integrate your Creator app with Whatsapp, to communicate relevant information to your customers. That is, whenever a user or a customer submits data in a form, we can trigger a notification to the user, sharing relevant information. We can automate this entire process using Twilio on Creator's form workflow option that's enabled using an API.
Why use Twilio to integrate a Creator app with Whatsapp?
Twilio is one of the established messaging service providers that we support integration for. So you can opt to use the Twilio API to act as host to communicate with Whatsapp.
Before we do that, though, we need to set a few things to configure the integration.
Step 1: Set up a Whatsapp Business account, set up your Facebook Business Manager account, and set up a Twilio account using the same Whatsapp Business account mobile number.
Step 2: After you create the Twilio account, request access to enable the Twilio number for Whatsapp messages, and verify your Facebook Business Manager account.
Step 3: Create an appointment/registration form in your Creator application to collect the mobile numbers and the consent for Whatsapp notifications.
Now, let's go in-depth into each of these steps:
Step 1: Setting up the accounts
Whatsapp Business account: First, choose the mobile number from which the notification is to be triggered, and use that mobile number to set up Whatsapp Business account.
Facebook Business Manager account: Then, please do set up your Facebook profile to create a Business Manager account, if you already haven't set up one. You can use your Facebook username and password to sign in to Business Manager.
To create a Business Manager account:
Twilio account: Next, do sign up for a Twilio account with the same mobile number with which you've set up the Whatsapp Business account.
Once these initial setups are configured, you can proceed to request access and verification.
Step 2: Request access and verification
Now, WhatsApp uses your Facebook Business Manager account to identify your business and associate your phone number with it.
Twilio provides a sandbox environment, where users can test the API code with a sandbox from the number provided by Twilio, which can used used to test the API. To use your own number for notifications, you need to submit a request to Whatsapp with your business requirement. They need to approve it to trigger Whatsapp messages via the API. Whatsapp doesn't provide a direct, end-user API URL, so we're integrating it on top of the Twilio API and using that in the Creator application.
Please note that WhatsApp has final discretion to approve companies to use the API. You can follow the steps given below to request access and complete the verification process:
1) Twilio: Request access to enable your Twilio numbers for WhatsApp.
2) Twilio: Submit a sender profile and message templates.
3) Facebook: Approve Twilio to send messages on your behalf.
4) Facebook: Verify your Facebook Business Manager account.
5) Twilio: Twilio completes your WhatsApp sender registration.
Once you've completed the verification process and set the Whatsapp account, you can make use of the Twilio API on a Zoho Creator workflow to trigger a Whatsapp message.
For that, let's create a simple appointment or registration form in your Creator app.
Along with the other fields, you need to add the following fields:
Once you've created the form, on On create on success, you need to add the code to trigger the Whatsapp notification based on the value in the Decision box field to send notifications.
Please find the below sample code added with the post URL call to trigger the notification via the Twilio API.
Script explanation: