Summary
Want to automatically save new WhatsApp contacts to your LeadSquared CRM? This guide shows you how to connect WhatsApp (via Wati) to LeadSquared using Autocode in just 10 minutes. Every new WhatsApp message will create a lead with the sender's name and phone number.
Instructions
Prerequisites
Before starting, make sure you have:
A LeadSquared account with API access
A Wati account (your WhatsApp Business API provider)
An Autocode.com account (free tier works)
Step-by-Step Setup
1. Get Your LeadSquared API Keys
Log in to your LeadSquared account
Follow this tutorial to create your Access Key and Secret Key
Save both keys in a text editor - you'll need them soon
2. Create an Autocode Project
Sign up at Autocode.com
Click New Project and select Blank Project
Name your project (e.g., "WhatsApp to LeadSquared")
3. Add the Integration Code
Delete all default code in the editor
Copy and paste this code:
```javascript
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+" } ]
}); ```
Replace
YOUR_ACCESS_KEY
andYOUR_SECRET_KEY
with your actual LeadSquared keysClick Save in the top right
4. Connect Wati Webhook
Copy the URL shown at the bottom of your Autocode window
Log in to your Wati dashboard
Go to Webhooks > Add Webhook
Paste your Autocode URL
Set:
Event: New Contact Message
Status: Enabled
Click Save
That's it! Now, your new contacts will be automatically added to LeadSquared.
Frequently Asked Questions (FAQs)
Account Requirements
1. Do I need a paid LeadSquared plan for this integration?
→ No, this works with any LeadSquared account that has API access enabled. Both free and paid plans typically include this feature.
2. Can I use WhatsApp Business App instead of Wati?
→ No, this integration specifically requires Wati as it provides the necessary webhook functionality and WhatsApp Business API access.
3. Is there a limit to how many leads Autocode can process?
→ Autocode's free tier allows 50,000 requests/month, which should be sufficient for most small-medium businesses. Larger volumes may require upgrading.
Setup Process
4. Where exactly do I find the LeadSquared API keys?
→ Follow this guide to learn how to do this.
5. What if I get an error when saving the Autocode project?
→ Double-check:
All quotation marks and brackets in the code are correct
You've replaced both
YOUR_ACCESS_KEY
andYOUR_SECRET_KEY
No extra spaces before/after the API keys
6. Can I use a different region URL for LeadSquared?
→ Yes, replace api-in21.leadsquared.com
with your region's API endpoint if needed (e.g., api-us.leadsquared.com
for North America).