Table of Contents

How to send template message using Zoho CRM Workflow?

Helpdesk Updated by Helpdesk

Sending Messages automatically using Zoho CRM workflow

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/Notifications automatically from Zoho CRM Workflow

​ In order to automate the process where a newly created lead will get a welcome template message from WATI:

  1. Navigate to Settings -> Workflow Rules
  2. Click "Create Rule"
  3. Choose Lead as a module and name your Webhook Rule.
  4. Complete when and condition the way shown below
  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 code into 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 an 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

How did we do?

How to send template message using Zoho CRM Extension?

WATI Embedded Team Inbox in Zoho

Contact