Send Chat Leads to Your CRM With a Webhook
Wire Alee chat leads to your CRM, Google Sheet, or email using a webhook: the payload fields, mapping, testing, and how to secure the endpoint.
A lead that lands in your chat at 11pm is only worth something if it reaches the place you actually work — your CRM, a Google Sheet, or your inbox — before the visitor cools off. Alee captures name, email and phone right inside the conversation, and a webhook pushes each one out the moment it's collected. This guide covers the payload Alee sends, how to wire it to the tools you already use, how to test it properly, and how to secure the endpoint so nobody can spam fake leads at it.
What a webhook actually does here
A webhook is just a URL you own that Alee calls with an HTTP POST whenever a new lead is captured. Alee packs the lead's details into a small JSON body and sends it to that URL; whatever lives at the other end — your CRM, an automation tool like n8n, a Google Apps Script, a Zapier/Make catch hook — receives the data and does something with it. The flow is event-driven:
- A visitor chats and shares their name, email or phone.
- Alee records the lead against that bot and conversation.
- Alee fires a POST to your webhook URL with the lead as JSON.
- Your endpoint routes it — a new CRM contact, a row in a sheet, an email, or a WhatsApp ping via your automation.
Before you wire anything, make sure lead capture itself is switched on for the bot. Open the bot's settings and turn on collecting name / email / phone in the chat (the lead form), so there are leads to send in the first place. See the features overview for where lead capture sits in the dashboard.
The webhook payload: what Alee sends
When a lead is captured, Alee POSTs a JSON body to your URL. Confirm the exact field names by sending one real test (more on that below), but a lead payload carries the fields you'd expect:
- The contact fields — name, email and phone as captured in the chat. Any of these can be blank if the visitor only gave one or two.
- Which bot it came from — a bot identifier and display name, so an Agency or Scale account running many client bots can route each lead to the right place.
- When it happened — a capture timestamp.
- Conversation context — a conversation reference, and often the question that triggered the capture, so your follow-up knows what the person was asking about.
- Any extra fields you asked for — if you customised the lead form to ask one more thing, expect it alongside the standard fields.
A realistic shape looks like this:
```json
{
"event": "lead.captured",
"bot": { "id": "bot_8fk2", "name": "Sunrise Gym" },
"lead": {
"name": "Anita Sharma",
"email": "anita@example.com",
"phone": "+91 98xxxxxx21"
},
"message": "Do you have evening batches for women?",
"conversationid": "conv19a7",
"captured_at": "2026-06-18T17:42:09Z"
}
```
The headline rule: don't hard-code assumptions about field names — log one real payload first, then map from what you actually receive. A single live test (covered below) shows you the real keys to build your mapping against.
Wiring it to where you work
The webhook URL is the only thing that changes between destinations. Pick the tool, get a URL that accepts a POST, and paste it into the bot's webhook field (in the leads / integrations area of the bot's settings).
Google Sheets
The no-cost favourite for solo founders and small teams.
- Create a sheet with columns: Name, Email, Phone, Bot, Message, Captured At.
- In the sheet, open Extensions → Apps Script and write a
doPost(e)function that parsese.postData.contentsas JSON and appends a row. - Deploy it as a Web app, set access to "Anyone", and copy the deployment URL.
- Paste that URL into Alee's webhook field and save.
Every lead now drops in as a new row — a free, shareable CRM your whole team can see.
A real CRM (HubSpot, Zoho, Pipedrive, etc.)
Most CRMs don't take a raw webhook in the exact shape Alee sends, so put a thin translator in the middle:
- n8n (self-host or cloud) — add a Webhook trigger node, paste its URL into Alee, then map Alee's fields onto the CRM node's "create/update contact" fields. n8n is the cleanest fit because you can branch, dedupe and enrich before the contact is created.
- Zapier or Make — start a Zap/Scenario with a "Catch Hook" trigger, paste its URL into Alee, and connect the second step to your CRM.
The mapping step is where you translate Alee's lead.email into the CRM's email field, push message into a note, and tag the contact with the bot name.
Sometimes you just want the lead in your inbox. Point the webhook at an automation tool (n8n, Zapier, Make) whose action is "send email" and template the body with the lead's fields, or at a tiny serverless function (Cloudflare Workers, Vercel, a Google Apps Script) that formats and sends the mail.
WhatsApp / Slack / Telegram
For India-facing teams, speed-to-lead on WhatsApp wins deals. Route the webhook through n8n or Make into your WhatsApp Business API, a Slack incoming webhook, or a Telegram bot so a new lead pings the right person within seconds. Alee can also share a booking link inside the chat, so qualified visitors self-schedule while the lead lands in your CRM.
A short worked example: leads into a Google Sheet
Say you run a coaching business and want every lead in a shared sheet.
- Make a sheet, add the header row, and open Extensions → Apps Script.
- Paste a handler:
```javascript
function doPost(e) {
var data = JSON.parse(e.postData.contents);
var lead = data.lead || {};
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.appendRow([
lead.name || "",
lead.email || "",
lead.phone || "",
(data.bot || {}).name || "",
data.message || "",
data.captured_at || new Date().toISOString()
]);
return ContentService.createTextOutput("ok");
}
```
- Deploy as a web app, copy the URL, paste it into the bot's webhook field, save.
- Open the bot's preview, run a test chat, and hand over a fake name and email when the lead form appears. A row appears in the sheet — a free lead pipeline with zero monthly cost.
Testing the webhook properly
Don't wait for a real visitor to discover it's broken.
- Send a test lead. Use the bot's preview/test chat, start a conversation, and complete the lead form with throwaway details so a genuine payload fires through the live path.
- Inspect the raw payload once. Point the webhook at a free request-bin style URL (a "view incoming requests" endpoint) for the very first test, so you can see the exact JSON Alee sends and copy the real field names. Then switch the URL back to your real destination.
- Confirm it arrived and routed — check that the row, contact or email actually appeared, not just that the request was received.
- Test the empty and messy cases. Give only an email and no phone, then only a phone, to confirm your handler tolerates blank fields. Use a name with an apostrophe, an emoji or Devanagari characters to confirm nothing breaks on encoding.
- Re-check after any change. If you edit the lead form to ask a new field, re-test so your mapping picks it up.
If a lead doesn't arrive: confirm lead capture is on, the URL is saved exactly (no trailing space), your endpoint returns a 2xx status, and check your automation tool's execution log for the inbound request.
Securing the endpoint
Your webhook URL is publicly reachable, so assume someone could find it and POST junk. A few layers keep it clean.
- Keep the URL secret and unguessable. Treat it like a password — don't paste it in public docs, screenshots or client-side code. If it leaks, rotate the URL (most tools let you regenerate it) and update it in Alee.
- Add a shared secret. Append a hard-to-guess token as a query parameter or expect it in a header, and have your endpoint reject any request that doesn't carry it. This single step stops most drive-by spam.
- Verify the signature if one is provided. If Alee includes a signature header, validate it against your shared secret using a constant-time comparison (
crypto.timingSafeEqualin Node,hmac.compare_digestin Python) so requests can't be forged. - Validate the shape before you act, so a malformed or hostile body never creates a bad contact, and use HTTPS only so the lead's name, email and phone are encrypted in transit.
- Rate-limit if you can. Cap how many requests your endpoint accepts per minute so a flood can't run up your automation bill.
For India-facing businesses handling personal data under the DPDP regime, this matters beyond spam: keep lead data encrypted in transit, only collect what you'll use, and make sure whoever receives the webhook is somewhere you're comfortable storing customer contact details.
Keep it healthy
- Dedupe on email. A returning visitor can fill the form twice; have your CRM update the existing contact instead of creating a duplicate.
- Tag by bot. Agency and Scale accounts run many bots — always write the bot name onto the lead so attribution is obvious.
- Watch your analytics. Alee's per-bot lead count and lead-rate tell you whether leads are being captured; your CRM tells you whether they're arriving. If the two diverge, your webhook is the suspect.
A webhook turns Alee from a helpful answer engine into a lead machine that feeds the rest of your stack automatically. Set it once, test it honestly, secure it, and every conversation that ends with a name and an email shows up exactly where your team already works. Browse more guides for related setups, or see how Alee stacks up in Alee vs SiteGPT.
Frequently asked questions
Do I need a paid plan to use webhooks?
Webhooks send out the leads your bot captures, and lead capture is part of how Alee works across plans. Your plan governs how many bots and monthly messages you get, not whether you can wire a webhook — check the pricing page for what each tier includes.
What if I don't have a CRM yet?
A Google Sheet is a perfectly good first CRM. Point the webhook at a Google Apps Script that appends a row, and you have a free, shareable, searchable list of every lead — upgrade to a real CRM later by just swapping the webhook URL.
Will leads still be saved if my webhook fails?
Yes. The webhook is a delivery mechanism, not the system of record — Alee still records every captured lead in your dashboard, so you can see it under the bot's analytics even if the destination was temporarily down. Fix the endpoint and re-send or re-export as needed.
Ready to turn conversations into contacts? [Start free](/signup) with Alee, switch on lead capture, and wire your first webhook today.
Try it in your own Alee bot
Train it on your site, embed it anywhere, capture leads 24/7. Free to start, no card.