Create a contact in WATI when a new lead comes into ZOHO CRM

Jahnavi Prasad Updated by Jahnavi Prasad

Create a contact in WATI when a new lead comes into ZOHO CRM

To use the Workflow feature, you need the Zoho Professional Plan or higher

In this guide, we will talk about how you can set up automation such that whenever a lead comes into your Zoho Account from any 3rd party source (FB Leads, Instagram Ads, etc) you can add them as a contact in WATI.

  1. Navigate to Zoho Settings -> Workflow Rules
  2. Click "Create Rule"
  3. Choose Lead as a module and name your Webhook Rule.
  4. Complete when and condition as shown below
  5. Click instant actions and choose Function
  6. On the next page, click + New Function and choose Write your own
  1. Fill in details for creating a new function
  2. Edit Arguments of the function as follows

Note:

  • Type # to choose the param value
  • The Left side values must be exactly 'number' and 'LeadName'. Do not change this.
  • You only need the Phone Number and Name of the lead to add them as a contact in WATI.
  1. Copy the below code into the function body
headerValue = Map();
headerValue.put("Authorization","{{your-access-token}}");
raw_data = {"name": ""+ LeadName +"","customParams": []};
number = number.remove(" ");
number = number.remove("+");
number = number.remove("(");
number = number.remove(")");
number = number.remove("-");
resp = invokeurl
[
url :"{{your-wati-api-endpoint}}/api/v1/addContact/91" + number + "?SourceType=ZOHO"
type :POST
parameters:raw_data.toText()
headers:headerValue
detailed:true
content-type:"application/json"
];
info resp;
Important
You must replace {{your-access-token}} in line 2 and {{your-wati-api-endpoint}} in line 11 with your Bearer token and API Endpoints. Ref: Where can I find the API Endpoint URL and Bearer Token?
Please ensure updating the country code in line 11 after /api/v1/addContact/
  1. Save the function
  2. Save the workflow

How did we do?

Assign chats in WATI based on Lead owner in Zoho CRM

Contact