Table of Contents

LeadSquared WhatsApp Integration: Capture All New WhatsApp Contacts To LeadSquared

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

Heads up 🔔 - this could take around 10 minutes to complete.

Step 1: Get a LeadSquared Access and Secret key, and save it on a text editor. This tutorial can help you create your key.

Step 2: Create an Autocode.com account.

We’ll use Autocode as an intermediary here. Get started with a Blank Project.

Step 3: Copy code snippets to Autocode.

  • Delete all the code that is present in the window.
  • Copy and paste the code below.
  • Add your API keys (Access and Secret) from Step 1 in the code (marked in red).
  • Save the code.

 

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

let newmeeting = await lib.http.request['@1.1.6']

({

  method: 'POST', 

  url: `https://api-in21.leadsquared.com/v2/LeadManagement.svc/Lead.Create?accessKey=YOUR_ACCESS_KEY&secretKey=YOUR_SECRET_KEY`,

  headers :

  {

    'Content-Type': `application/json` 

  } ,

  body:

  `[

    {

      "Attribute":"FirstName",

      "Value":"`+context.params.senderName+`"

    },

    {

      "Attribute":"Phone",

      "Value": "`+context.params.waId+`"

    }

  ]`

});

Step 4: Add a Webhook URL to your WATI window.

  • Copy the URL in the bottom of your Autocode window.
  • Open your WATI Dashboard >> Webhooks.
  • Add the URL from Step 4 as a new Webhook. 
  • Enter the URL.
  • Select the Event as “New Contact Message”
  • Select the Status as Enabled.

That’s about it. This should move all your new contacts to LeadSquared automatically.

How did we do?

WATI LeadSquared Integration

Contact