Skip to main content
By the end of this guide you have a lead in NewLead and an open WhatsApp conversation that your agent continues when the lead replies.

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

Copy the id of an agent whose status is active. Use it as <TEXT_AGENT_ID> in the next steps.
3

Choose a template

Note the 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 Idempotency-Key header makes the request safe to repeat: a retry with the same key does not create anything twice.
Include the country code in phone. A number without it returns 400 parameter_invalid.
The API returns 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

The API returns 201 with the message. When the lead replies, your agent continues the conversation.
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.