Send Promotion Template Messages via WhatsApp with Zoho Creator

Send Promotion Template Messages via WhatsApp with Zoho Creator

1. Requirement

Increase customer engagement and sales efficiency by sending promotions and advertisements directly to customers via WhatsApp by integrating Zoho Creator with WhatsApp Business Platform.

2. Use Case

A sales organization uses Zoho Creator for customer management and related operations. To enhance customer engagement and sales efficiency, the organization wants to send promotions and advertisements directly to customers through WhatsApp. This can be accomplished by integrating Zoho Creator with WhatsApp Business.
See How it Works

3. Pre-requisites

3.1. Initial Setup - Creating App in Meta Developer Account

  1. Create a Facebook account or use your existing Facebook account and register yourself as a Meta Developer with your Facebook account.
  2. Create a WhatsApp Business account with your existing phone number.
  3. Note: WhatsApp Business Platform operates on a conversation-based pricing system, where a conversation is initiated when you send a template message, which incurs a cost. Refer this link to learn more about this pricing model.
  4. Create an app in your Meta Developers account with WhatsApp product by following the instructions in this help document. Follow the on-screen instructions to configure WhatsApp for your app, including setting up a business phone number and verifying it.
You can find your created app listed in the My Apps section of your Meta Developers Account.


Click on the listed app to view its dashboard and other properties.

3.2. Configure API and Generate Permanent Access Tokens

  1. From the App Dashboard, navigate to API Setup under WhatsApp in the left pane.

  2. You will be prompted to select an existing Meta Business Account or request the platform to create a new one and click Continue. Learn how to create a Meta Business Account.

  3. You will receive a temporary access token and a test phone number for testing purposes, which will expire within 24 hours. To create a permanent access token, you need to add a system user to your business account.

3.3. Create Template

WhatsApp message templates allow you to use existing and pre-approved templates to send structured messages to customers. Learn how to create a  message template.
Here, we have created a template named 'promotion' and configured it as shown below.

4. Steps to Follow in Zoho Creator

4.1. Create Custom Connector for WhatsApp

  1. Navigate to the Custom Connectors page from the Microservices tab of your Creator account dashboard and click Create New Custom Connector.

    1. If you have previously created custom connectors, they will be displayed as cards on the custom connectors page. Click the +Create New icon in the top-right corner.

  2. Specify the Connector Name as 'WhatsApp' and the Description as 'Creator WhatsApp Integration' and click Create Custom Connector.

  3. Upload a WhatsApp logo for our custom connector for easy identifications, then click Save & Continue.

  4. Select API key Authentication, then click Save & Continue.

  5. On the next page, select Parameter Location as 'Query String'. Enter the Parameter Name as 'Enter Access Token' and the Parameter Key as 'access_token' as shown.

  6. Click Save and mark the connector as ready to use. This will allow you to create a WhatsApp connection.

  7. Click Add Connection. You will be prompted to create a connection using this connector.
  8. Note: Once you mark the connector as ready, it will appear under the Custom   Connectors section when you create a connection. You can then use it to create multiple WhatsApp connections with the same connector. Learn More

  9. Enter Connection Name as 'WhatsApp Connection' and select Connection Authorization Level as 'Administrators', then click Create and Authorize.

  10. Enter the permanent access token that you generated previously, then enter the Name for the Authorized Account as 'WhatsApp Account'

  11. Select the desired environments to use this authorization and click Authorize.

  12. Enable connection access to the applications where the connection will be used.

4.2. Create Form to Collect Customer Details

  1. Create a form with the following details to collect customer details.

Form

Form Link Name

Field Type

Field Name

Field Link Name

 

Customer Details

 

Customer_Details

Name

Customer Name

Customer_Name

Email

Email

Email

Phone

Phone

Phone

Address

Address

Address

4.3. Configure Workflows

  1. Create a workflow to execute on the successful submission of the Customer Details form, then select the Record Event as 'Created'. Name the workflow as 'Send Promotion' and click Create Workflow. This workflow will send the template message to the customer's phone number stored in the Phone field via WhatsApp.

  2. Click Add New Action > Deluge Script and add the following code to the Deluge editor.
  1.   //Send template message to customer's phone number using invokeURL task.
  2.   response = invokeUrl
  3.   [
  4.    url: "https://graph.facebook.com/v19.0/<PhoneNumberID>/messages"
  5.    type: POST
  6.    parameters: { "messaging_product": "whatsapp", "to": input.Phone_Number, "type": "template", "template": { "name": "promotion", "language": { "code": "en_US" } } }
  7.    connection: "whatsapp_connection"
  8.  ];
where,

''https://graph.facebook.com/v19.0/<PhoneNumberID>/messages"

is the URL mentions in the WhatsApp API documents for API calls to send messages.

<PhoneNumberID>

is the ID of the Phone number added in your WhatsApp Business Account. You can find it in the API Setup under WhatsApp in your App Dashboard of Meta application. Example : 328562393673662


"whatsapp_connection"

is the name of the WhatsApp connection created using Custom Connector.


5. See How it Works


  1. WhatsApp Business Platform - Cloud API
  2. Understand Connectors
  3. Create Custom Connector
  4. Understand Connections
  5. Create and Authorize Connections
  6. invokeURL task for API calls