InteGreat 06: Integrate your Zoho Creator app with Whatsapp using Twilio

InteGreat 06: Integrate your Zoho Creator app with Whatsapp using Twilio

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.


What is Twilio?
Twilio is a communications platform that allows software engineers to build voice and SMS capabilities into applications. Many of our customers integrate their Zoho Creator apps with Twilio to send SMS notifications, such as appointment reminders, transaction details, status updates on orders, and device approvals.

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?

Whatsapp doesn't provide a direct, end-user API, however, they allow you to host a small service, which in turn talks to Whatsapp servers. But hosting your own server can be challenging in terms of reliability, security, and knowledge, so we're using the cloud-based service option.

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:

  1. Go to business.facebook.com/overview.
  2. Click Create account.
  3. Enter a name for your business, your name, and work email address and click Next.
  4. Enter your business details and click Submit.

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.


Step 3: Configuring the code

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:

  • Phone number type field to collect the mobile number of the customer/user
  • Decision box type field to get consent for Whatsapp notification



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.

  1. if(input.I_agree_to_receive_whatsapp_notification == true)
  2. {
  3. mp = Map();
  4. mp.put("To","whatsapp:" + input.Mobile_Number);
  5. mp.put("From","whatsapp:+91**********");
  6. mp.put("Body","Your appointment is coming up on" + input.Appointment_Date_Time.todate());
  7. header = Map();
  8. username = zoho.encryption.base64Encode("<TWILIO_ACCOUNT_SID>:<TWILIO_AUTH_TOKEN>");
  9. header.put("Authorization","Basic " + username);
  10. resp = postUrl("https://api.twilio.com/2010-04-01/Accounts/<TWILIO_ACCOUNT_SID>/Messages.json",mp,header);
  11. info resp;
  12. }

Script explanation:

  1. Here, "I_agree_to_receive_whatsapp_notification" is the Decision box field, and we are using the if condition to trigger notifications only to the user who checked this field while submitting data in the form.

  2. Mobile_Number is the phone number field where the user enters their mobile number while submitting the form.

  3. The From in the code part is a static phone number from which the notification will be sent to all users for which the above setup and verifications were done. The business name and the logo as submitted in step 2 for "Submit a sender profile and message template" will reflect on the from part of the Whatsapp message to the customers.

  4. The Body part is the content of the Whatsapp message, where you can have both the static and form field content passed against it. 

  5. The "To" number (dynamic content) and the "body" of the Whatsapp message are the content filled in on the Creator form, and need to be passed to a data map.

  6. Authenticate the API on the Creator end with basic authentication, as below.
    username = zoho.encryption.base64Encode("<TWILIO_ACCOUNT_SID>:<TWILIO_AUTH_TOKEN>");
    header.put("Authorization","Basic " + username);
     

    The account SID (string identifier) and Authtoken will be available in the settings option under Twilio account, as in the screenshot given above.

    Note: A string identifier (SID) is a unique key that's used to identify specific resources. Here, the account SID is used to identify the Twilio account from which the API is triggered.

  7. Construct the Twilio Whatsapp API call in the below format:

    postUrl("https://api.twilio.com/2010-04-01/Accounts/<TWILIO_ACCOUNT_SID>/Messages.json",mp,header);

    Here, both the header map (header) and the data map (mp) are passed as arguments for the POST URL call to authenticate and trigger the Whatsapp message via API. 



    8. Please don't forget that WhatsApp requires that your application implement explicit user opt-ins to deliver messages over WhatsApp on the mobile number provided, while submitting the data on the Creator form and triggering the notification only for consenting users. Whatsapp also recommends that business owners track and save these details for future reference.

    Please note that sending messages to end users without an opt-in may result in users blocking your business, as well as the suspension of your WhatsApp Business account.
We hope this tip was useful to you! If there are any questions, feel free to ask in the comments below, and we'll be happy to address them for you!

    Access your files securely from anywhere


              Zoho Developer Community




                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                      • Ask the Experts



                                          Zoho Marketing Automation


                                                  Manage your brands on social media



                                                        Zoho TeamInbox Resources

                                                          Zoho DataPrep Resources



                                                            Zoho CRM Plus Resources

                                                              Zoho Books Resources


                                                                Zoho Subscriptions Resources

                                                                  Zoho Projects Resources


                                                                    Zoho Sprints Resources


                                                                      Qntrl Resources


                                                                        Zoho Creator Resources



                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

                                                                                    Writer is a powerful online word processor, designed for collaborative work.

                                                                                      Zoho CRM コンテンツ








                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方




                                                                                                  • Recent Topics

                                                                                                  • Spotlight #7 - Automatic Transitions in Blueprint

                                                                                                    Previously, records could not be moved from one state to another without user intervention. With automatic transitions, move records from one state to another automatically, when it elapses its pre-defined time. This Spotlight discusses how automatic
                                                                                                  • Accepted meeting invites not showing on calendar

                                                                                                    I can receive a calendar invite to a meeting, I confirm I can attend and hit accept. I then check my calendar and it doesn't show. 30 seconds later, it does show up but it is delayed leaving the feeling something didn't work correctly. Can this be improved,
                                                                                                  • Cross module filtering is now supported in CRM

                                                                                                    Editions: All DCs: All Release plan: This enhancement is being released in phases. It is now available in AU, JP, and CN DCs. Help resource: Advanced filters The Cross-module filtering enhancement is now available to all CRM accounts in the following
                                                                                                  • Optimizing Zoho CRM & Xero Workflow – Advice Neede

                                                                                                    Hi everyone, We’ve been using Zoho for all CRM functions and Xero for all accounting, but the workflow between the two has become difficult to manage. The business does not want to move from Xero, as it's the accountants’ preferred system, but we need
                                                                                                  • No fue posible enviar el mensaje;Motivo:553 Relaying disallowed. Invalid Domain - admin@laboratoriosantarosa.org

                                                                                                    Hola Renovamos después del tiempo el dominio, y luego de eso se cayó el servicio de correo. Seguimos las indicaciones que se indican en este articulo, sin embargo, hasta el momento solo podemos recibir correos pero no enviar. Hemos actualizado los registros
                                                                                                  • Zoho Error: This Operation has been restricted. Please contact support-as@zohocorp.com for further details

                                                                                                    Hello There, l tried to verify my domain (florindagoreti.com.br) and its shows this error: This Operation has been restricted. Please contact support-as@zohocorp.com for further details. Screenshot Given Below -  please check what went wrong. Thanks
                                                                                                  • Error AS101 when adding new email alias

                                                                                                    Hi, I am trying to add apple@(mydomain).com The error AS101 is shown while I try to add the alias.
                                                                                                  • My IMAP mail suddenly stopped working

                                                                                                    On my iPhone and iPad, IMAP stopped working for my Zoho account with the error "User name or password incorrect" and "Invalid credentials failure" however I was able to access via web with the same credentials. Also stopped working on Apple Mail client.
                                                                                                  • When choosing custom view, load a particular Kanban view by defualt

                                                                                                    I have two custom views defined (say viewA, viewB) in the Leads module. I also have a Kanban views (say K1 and K2) defined in the Leads module. What I would like is that if I select viewA, it automatically loads Kanban via K1. If I select viewB, it automatically
                                                                                                  • Use result of one formula field for another formula field

                                                                                                    Can I pull data from one formula field as one of the values for another formula field? I tried doing it and it's returning an "invalid formula" error so I'm not sure if I made the formula incorrectly or if it's just really not possible to do that. Also,
                                                                                                  • Can't create task programmatically using deluge

                                                                                                    I have a Date/Time field like this when it is edited, I want to create a task using deluge function. I use the code below to create a task. but unfortunately, the task is never created even I run it using 'execute' button on function editor. what went
                                                                                                  • Windows Desktop App - request to add minimization/startup options

                                                                                                    Support Team, Can you submit the following request to your development team? Here is what would be optimal in my opinion from UX perspective: 1) In the "Application Menu", add a menu item to Exit the app, as well as an alt-key shortcut for these menus
                                                                                                  • Export all Zoho desk tickets for past 3 months

                                                                                                    Hi I need to export ticket data from Zoho Desk. Specifically, I'm looking to: Export the last 3 months of tickets⁠ include ticket categories, timestamps, resolutions, agent responses (basically as much data as possible) the ticket content being the most
                                                                                                  • Zoho Calendar (Refresh Rate)

                                                                                                    Why don't the calendars refresh more than every 12 hours? That is crazy. I cannot be the only user who wants to see this change? I see and understand that I can MANUALLY update them, but need them to auto refresh either (1) whenever there is a change
                                                                                                  • Unattended Sessions - Groups and Access

                                                                                                    I would like to see Groups to organize Unattended Computers (what is currently labeled "My Computers") and a way to restrict access to individual users to specific groups.
                                                                                                  • No Hope for Zoho Meeting

                                                                                                    Zoho Meeting is just the poorest meeting app I've come across in a long time. The support sucks too. I called to see if there was anything that could be done on the backend and while I was on a test meeting with support the video was lagging and freezing
                                                                                                  • Add clients without needing a client company

                                                                                                    I, like many people, deal directly with individual clients rather than companies. It's really obnoxious to have to add a client company and treat my client, who is an individual person, as a company. Zoho - can you please build in a way to bypass the need for the client to be part of a company? This is a problem in cliq as well - I want to invite my clients to channels in Cliq but needing to create a company is confusing for them and makes them feel as if they don't belong on the app. But that's
                                                                                                  • Client reminders

                                                                                                    Hi Is there anyway to send automatic client reminders when we are pending a response from them? For instance, in a blueprint, say you have a transition that asks them for some additional information... They may take a while to reply, so is there a way
                                                                                                  • Add Image Upload Field to Zoho Bookings Registration Form

                                                                                                    Hi, We would like to request the addition of an image upload field to the Zoho Bookings registration form. Currently, Zoho Bookings only supports text-based fields (e.g., Single Line, Multi-Line, Email, Checkbox, Dropdown, Radio Button, and Date), but
                                                                                                  • Current Year Merge Tag

                                                                                                    I am looking for a way to add the current year dynamically to email campaigns. For example "Copyright 2024", so that templates are always up to date and this would also really help with automations. Another example could be a Happy New Year email which
                                                                                                  • Blueprints: Create Global Transitions

                                                                                                    Dear Zoho Team, it would be nice we could create global transitions for blueprints. The use case would be the following: We have 4 different processes with the same transitions in different orders. We could create 4 different blueprints, but whenever
                                                                                                  • Check-in and check-out time calculation discrepancy as shown in a screen recording

                                                                                                    Please see linked screen recording for my question: https://workdrive.zohoexternal.com/external/94dd0267dc877b3f827cc09b294625105627680700cec50e71d36c08e94cb257
                                                                                                  • Zoho marketing hub integration with WordPress WooCommerce

                                                                                                    Hello All,  I am a Zoho One User and we are using Zoho Marketing Hub we also have a website on Wordpress and we use Woo Commerce as our store.  im looking to find out if Zoho Marketing Hub Integrates with WooCommerce   ideally we would like to create Journeys or campaigns series based on customer behavior such as buying or already have purchased specific products. or if they go to the store but don't buy (abandon cart follow)  i saw that there is a wordpress plugin for Zoho Campaigns https://wordpress.org/plugins/zoho-campaigns/ but
                                                                                                  • Need help in search with formula culums in reports

                                                                                                    Hello, I do not know where to start with this one : I have a customer report with all that was bought and paid by my customers. It can be many records for one specific customer. Ex. Customer A has 1 record for a purchase of 1000 $, and 2 records of payments
                                                                                                  • how to send recurring estimates instead of recurring invoices

                                                                                                    Hello, Is it possible to use the recurring invoice functionality to send recurring estimate to our customers ? We first need to send them an invoice in order to receive their purchase order and then send them the invoice with their purchase order number
                                                                                                  • AS101

                                                                                                    I'm having issue while adding email alies to an email. Please help.
                                                                                                  • Tracking UTM Campaign information in CRM

                                                                                                    Hi All, We have had this questions asked a few times lately so thought it would be a great idea to post it here for others benefit.  Many have asked this: How can I track campaign information in CRM from my online campaigns and report on UTM tracking details?  Below is what we have set up for other businesses who are using UTM Codes for all their campaigns. Follow the 4 steps below to set this up for your CRM: 1. Create Fields in CRM Leads Module Add a field  in the Leads module called 'Referrer
                                                                                                  • Adding fields to campaign members

                                                                                                    Is it possible to add fields to campaign members? I want to be able to insert a date that certain actions happened as we progress a client, but can't see where or how I might be able to do that
                                                                                                  • Amazon Integration

                                                                                                    Hi, I am seller on Amazon , & I would like to sign up for Zoho books. However my question is can we automate/integrate invoicing, charges and returns in amazon with Zoho using API? Do you have a developer for this? I did take a look at zapier however it just has a create Invoice function nothing else.
                                                                                                  • Remove Zoho contract upsell at customer sign completion page

                                                                                                    Hello, I am going through testing for a zoho contract for my organization and I noticed that after the customer signs the contract they are forwarded to a completion page that tries to sell them on using zoho contracts. I find that very unprofessional
                                                                                                  • Retain Jira Ticket When Merging Tickets in Zoho Desk

                                                                                                    Hi, We would like to request a feature enhancement for Zoho Desk's ticket merging process regarding Jira ticket retention. Current Behavior: When merging two tickets (manually via the interface or through the API), we can select the "master" ticket into
                                                                                                  • Workdrive comment links stopped working.

                                                                                                    I have marked a PDF file with 95 comments, they have worked for a while. When i clicked on them they brought me to the correct page and showed me the outline that i had drew on the plans. The comments included the page number of the outline, but now it
                                                                                                  • Kiosk Page Refresh

                                                                                                    We have a Kiosk running from a button in contacts to update values and also add related lists, which works great, but when the kiosk is finished the page does not refresh to show the changes. Is there a way to force the contact to refresh/update when
                                                                                                  • Generate a Zoho Sign link

                                                                                                    From time to time I get a response "I never received your you e-document for electronic signature" is there a way to generate a Zoho Sign link to share.
                                                                                                  • Zoho Signing embedded with iframe is moved out of view when navigating to focus signature on mobile devices

                                                                                                    Dear Zoho team, I'm having difficulty embedding the signing url into a website for users to sign on their phones, it's not working perfectly. The problem occurs after the user accepts and continues to sign, or the user clicks to redirect to any of the
                                                                                                  • Deletion of CRM rows giving error

                                                                                                    Hi, I am exporting data from a module into excel workbook. THis works fine... until...I export the same data 10 minutes later and I get duplicates in my sheet. There is code to "delete" the previous sheet but it is giving errors. The DELETION of records
                                                                                                  • How to hide tax Rate in the Sales invoice print-out

                                                                                                    Hello everyone, Can I get an enlightment for my issue that relate to the tax rate in the Sales invoice print-out?
                                                                                                  • Created delayed alerts

                                                                                                    We have a custom alert & rule that notifies our service alerts email address when new tickets are created but these alerts are sent out immediately when a ticket is created, is there a way to set the alerts to be sent out 15 minutes after the ticket is
                                                                                                  • Make list from Workdrive Folder

                                                                                                    Hi, Today, my challenge is to simplify and optimize my drop-down list where I retrieve the list of files present in a WorkDrive folder. I had to create a custom function to replace and display special characters. Then, I need the file ID to open it in
                                                                                                  • One Contact with Multiple Accounts with Portal enabled

                                                                                                    I have a contact that manages different accounts, so he needs to see the invoices of all the companies he manage in Portal but I found it not possible.. any idea? I tried to set different customers with the same email contact with the portal enabled and
                                                                                                  • Next Page