Before you start
You need:- A NewLead subaccount.
- An active text agent with WhatsApp connected.
- A WhatsApp template approved for that agent.
1
Create an API key
In the dashboard, open the subaccount and go to Settings › API. Create a key and copy it: it is shown only once.
2
Find your text agent
id of an agent whose status is active. Use it as <TEXT_AGENT_ID> in the next steps.3
Choose a template
name and language of a template whose status is approved. A WhatsApp conversation can only start with an approved template.4
Create a lead
The The API returns
Idempotency-Key header makes the request safe to repeat: a retry with the same key does not create anything twice.201 with the new lead. If the agent already has a WhatsApp or Lead Ads lead with that phone, it updates that lead and returns 200.5
Send the template
201 with the message. When the lead replies, your agent continues the conversation.Send values for template variables
Send values for template variables
If the template has variables, send their values in
template.components. This example fills {{1}} in the body:Next steps
Receive events
Get lead, message and call events at your URL.
Handle errors
Learn what each error means and when to retry.
Retry safely
Repeat a request without sending anything twice.
Use n8n
Build the same flow with the official node.