How To Capture New Contacts On ZOHO CRM From WATI

How To Capture New Contacts On ZOHO CRM From WATI

This article will outline how to use Zoho CRM to capture new contacts from WATI. You can now use existing workflows on Zoho CRM for all new leads from WATI as well.


Heads up – this could take more than 30 minutes to complete.


Capture all new contacts on Zoho CRM for Free

Step 1: Create the following accounts/ files:

  • Zoho CRM (Free Edition)
  • Autocode (Free Edition) – we will use Autocode as an intermediary between WATI and Zoho
  • Get started with a Blank project
  • Make a copy of this Google Spreadsheet, in your google account

Step 2: Create an app within Zoho Desk.

  • Go to Zoho API Console
  • Click on ADD CLIENT

  • Click on Self Client
  • Enter Scope as ZohoCRM.modules.ALL
  • Select a limit of 10 minutes (the default is 3 minutes)
  • Type anything under Description
  • Select your Production account
  • Press Create
  • From the pop-up that appears, copy the code

You have now created a Zoho App, and you have the following details:

  • Code
  • Client ID
  • Client Secret

Step 3: Go to this Postman link and create a fork

Note: You may need to create a Postman account before getting started.

  • Under Collections, click on Get tokens, and select the post request below.
  • In the window (on the right), select Params, and fill in the details that you received in Step 2.
  • Fill all 3 – client_id, client_secret and code.
  • Click on Send.

You will receive two tokens in the response – an authorization token and a refresh token.

  • Open up the Google Spreadsheet (the copy) and save the tokens as follows:
  • Authorisation token in cell H2, and refresh token in cell I2.

Step 4: Now, onto Autocode:

  • Gather data from Zoho Desk.
  • Organization ID: Settings > API > OrgId
  • Department ID: Settings > Departments > Choose the Department.
  • The ID is the number in the browser URL.

Open your Blank project on Autocode.

(sample window is added below)

  •  Delete all the code that is present in the window
  • Copy and paste the code below (add necessary data gathered above.

const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let tokencheck = await lib.googlesheets.query['@0.3.0'].select({
   range: `H1:I2`, // required
   bounds: 'FIRST_EMPTY_ROW',
let token = tokencheck.rows[0].fields.Token
  let newtoken = await lib.http.request['@1.1.6']
       method: 'POST',
       url: ``,
         'client_id': `<client ID>`,
         'client_secret': `<client secret>`,
  token = JSON.parse(newtoken.body.toString()).access_token
  let tokenreplace = await lib.googlesheets.query['@0.3.0'].update
       range: `H1:H2`,
       bounds: 'FULL_RANGE',
       limit: {
         'count': 1,
         'offset': 0
       fields: {
let zohoresult = await lib.http.request['@1.1.6'].post
   url: ``,
   headers: {
   "scope": "ZohoCRM.modules.ALL",
   "authorization": "Zoho-oauthtoken "+token
       "data": [
               "Last_Name": context.params.senderName,
               "Phone": context.params.waId


After you do this, the window will prompt you to connect a resource.

Learn More: How To Capture WATI Chats As Tickets On Zoho Desk

Now, connect your Google Spreadsheet created in Step 1. Ensure you select the right sheet (within the spreadsheet).


Save the code. Now, copy the URL at the bottom of the window (as shown below).


Step 5: Open your WATI Dashboard, and go to Webhooks. Now, add the URL from Step 4 as a new.



  • Enter the URL.
  • Select the Event as “New Contact Message”.
  • Select the Status as Enabled.

Step 6: Open your Google Spreadsheet.

  • Go to Extensions > Apps Script.
  • Copy and paste this code under

					function myFunction() {
 var read = SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('H2').setValue("")


Now, create a trigger to run this code every 30 minutes, and that should be it.

If everything above went well, all your new contacts will show up on Zoho CRM. 

Share This Post
Share on facebook
Share on linkedin
Share on twitter
Share on email
More To Explore
New call-to-action
New call-to-action