How to send template message using Zoho CRM Integration?

Helpdesk Updated by Helpdesk

Sending Message using Zoho CRM

Zoho CRM Integration with WATI can be done with any version of Zoho CRM, but to use the Workflow feature, you need the Zoho Professional Plan or higher

In this guide, we will talk about how you can send WhatsApp messages from Zoho CRM using our "WhatsApp Business for Zoho CRM" extension

Preferred Method (Using Extension)

  1. Navigate to our Extension on the Zoho App Marketplace and click "Install"

  1. Agree to the terms and click "Continue"
  1. Install for the users that you want to install for
  1. On "Settings", please add the API Endpoint URL and Bearer Token and click "Save"

These details shall be available on your WATI Accounts' API Docs Section

  1. On the Lead details or Contact details page, click on "Send WhatsApp" button
  1. Choose from a list of templates from WATI
  1. Preview the templates, add parameter values and press "Send"
  1. To send WhatsApp from Workflow, select the "sendWhatsApp" function and pass the template_name parameter, phone, name fields

Create a Zoho workflow webhook 

In order to automate the process where newly created lead will get welcome template message from WATI, these are the steps

  1. Navigate to Settings -> Workflow Rules
  2. Click "Create Rule"
  3. Choose Lead as module and name your Webhook Rule.
  4. Complete when and condition the way it's done in picture
  1. Click "instant actions" and choose "webhook"
  2. Click "Function"
  3. On the next page, choose ‘Write your own function’
  1. Fill in details for creating a new function
  1. Edit Arguments of the function as follows

Note:

  • Type # to choose the param value
  • template_name will be the WATI template name

  1. Copy the below in the function body
headerValue = Map();
headerValue.put("Authorization","{{your-bearer-token}}");
raw_data = {"template_name":"" + template_name + "","broadcast_name":"zoho_auto_" + template_name + "","parameters":"[{'name':'name', 'value': '" + name + "'}]"};
number = number.remove(" ");
number = number.remove("+");
number = number.remove("(");
number = number.remove(")");
number = number.remove("-");
resp = invokeurl
[
url :"{{your-wati-api-endpoint}}/api/v1/sendTemplateMessage/91" + number + "?SourceType=ZOHO"
type :POST
parameters:raw_data.toText()
headers:headerValue
detailed:true
content-type:"application/json"
];
info resp;
Note

You must replace these values in the above script - {{your-wati-api-endpoint}} and {{your-api-token}}

Please ensure updating the country code in the above example after /api/v1/sendTemplateMessage/

If you're using Zoho Creator, the deluge script may have to be modified.

Below is a example of a Zoho Creator Deluge Script -

void sendWhatsApp(string template_name, string phone, string name)
{
headerValue = Map();
headerValue.put("Authorization","{{your-api-token}}");
headerValue.put("Content-Type","application/json");
raw_data = {"template_name":template_name,"broadcast_name":template_name + "","parameters":"[{'name':'name', 'value': '" + name + "'},{'name':'shop_name', 'value': 'ABC'}]"};
resp = invokeurl
[
url :"{{your-wati-api-endpoint}}/api/v1/sendTemplateMessage/91" + phone + "?SourceType=ZOHO"
type :POST
parameters:raw_data.toString()
headers:headerValue
detailed:true
];
info resp;
}

(Optional) Function code snippet to update Contact Attribute in WATI from Zoho Deluge

raw_data_update_contact_attribute = {"customParams":{{'name':'email','value':email},{'name':'zoho_lead_id','value':lead_id}}};

resp = invokeurl
[
url :"{{your-wati-api-endpoint}}/api/v1/updateContactAttributes/" + number
type :POST
parameters:raw_data_update_contact_attribute.toText()
headers:headerValue
detailed:true
content-type:"application/json-patch+json"
];
  1. Save the function
  2. Save the workflow

Thanks

How did we do?

Zoho CRM Integration

WhatsApp Chat Button Integration

Contact