How To Capture WATI Chats On Zoho Desk As Tickets?

Capture all new WATI chats on Zoho Desk as tickets for Free

Capture New WATI Chats On Zoho Desk As Tickets For Free

This article will outline how to use Zoho Desk to capture new chats from WATI.

If you are already using Zoho Desk, it will now become a single source of all your customer queries. For others, Zoho Desk offers a ticketing solution with advanced features. For instance, you can now assign Round Robin rules for your support team.

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

Step 1: Create the following accounts/ files:

  • Zoho Desk (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 .
  • Select a limit of 10 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.

  • 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 and save the tokens as follows:
  • Authorization 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).

Read More: How To Capture Contacts On Zoho CRM from WATI

					const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});

let ticketcheck = await lib.googlesheets.query['@0.3.0'].select({

 range: `A:F`, // required

 bounds: 'FIRST_EMPTY_ROW',

 where: [


     'Phone__is': context.params.waId,

     'Status__is': "OPEN"



 limit: { 

   'count': 0,

   'offset': 0






 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_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: {

   "orgId": "",

   "authorization": "Zoho-oauthtoken "+token





     "subject": context.params.senderName+" "+context.params.waId,










    let newticket = await lib.googlesheets.query['@0.3.0'].insert({

   range: `A:F`,

   fieldsets: [


       'Ticket': context.params.ticketId,

       'Created': context.params.created,

       'Phone': context.params.waId,

       'Sender': context.params.senderName,

       'Zoho Ticket':,

       'Status': "OPEN"






After you do this, the window will prompt you to connect a resource. Now, connect your Google Spreadsheet created in Step 1.

Ensure you select the right sheet (within the spreadsheet).

Save the code. This will create a URL at the bottom of your window. Copy this URL.

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

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 chats will show up on Zoho Desk. 

But, you will still need to close tickets on both WATI and Zoho. There is a way to avoid this – we’ll share this in our next blog post.

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