How to trigger a multi-step campaign from a webhook
This tutorial describes how the system receives the Campanhas de múltiplos passos (Multi-step campaigns, formerly WhatsApp Flows) webhook and how to send data to enroll a new contact in an automated flow.
In this article
Important: The multi-step campaign webhook is used to trigger the automation from external systems (CRM, RD Station, in-house integrations, etc.).
Watch the step-by-step video (in Portuguese):
Prerequisites
- Account with the Campanhas de múltiplos passos (Multi-step campaigns) feature enabled.
- Set up a multi-step campaign with WhatsApp templates — tutorial here.
- Active flow with at least one step set up.
- Phone present and valid after normalization (required for WhatsApp).
If the flow is a draft but already has steps, the backend may activate the flow automatically on the first successful call.
Where this appears in the interface
On the flow screen, the card shows the name, description, metrics (enrollments, completions), WhatsApp channel, Webhook trigger, and the webhook URL you need to set up in the source system.

Illustrative example (screen above):
- Flow name: Contato pós conversão (Post-conversion contact)
- Description: Message sent after the conversion in RD Station
- Channel: WhatsApp
- Trigger: Webhook
- URL: https://atendimento.leadster.com.br/webhooks/whatsapp_flows/{flow_id}/{token}
{flow_id} is the flow's numeric identifier (4 in the visible URL example). {token} is an automatically generated secret — don't share it publicly; use it only in trusted integrations.
HTTP endpoint
- Method: POST
- Path: /webhooks/whatsapp_flows/:flow_id/:token
- Full URL: https://atendimento.leadster.com.br/webhooks/whatsapp_flows/{flow_id}/{token}
Authentication
The token in the path must match the token stored in the flow. These are also accepted:
- query string: ?token=...
- header: X-Webhook-Token: ...
Requests without a valid token get 401 Unauthorized.
Body format (Content-Type)
Supported formats:
- application/json (recommended)
- application/x-www-form-urlencoded
- multipart/form-data
Other types may be interpreted as JSON in the raw body.
The internal flow_id and token parameters aren't part of the business payload — the rest of the JSON becomes the processed payload.
Standard format (recommended for in-house APIs)
Phone (required)
One of these fields (JSON root):
phone, phone_number, phoneNumber, mobile, whatsapp, customer_phone, among others defined in the StandardProcessor.
Name (optional)
E.g.: name, full_name, first_name + last_name, customer_name, etc.
Email (optional)
E.g.: email, email_address, contact_email, etc.
Initial enrollment status (optional)
initial_status, status, enrollment_status — default active.
Other fields
Any other root-level key becomes an additional contact attribute (except the reserved keys listed in the processor).
Minimal example
{
"phone": "5511999998888",
"name": "Maria Silva",
"email": "maria@example.com"
}
Example with curl
Use the full URL copied from the flow panel (flow_id + token in the path). Example call (replace {flow_id} and {token} with your flow's data):
curl -sS -X POST \
'https://atendimento.leadster.com.br/webhooks/whatsapp_flows/{flow_id}/{token}' \
-H 'Content-Type: application/json' \
-d '{
"phone": "5511999998888",
"name": "João Teste",
"email": "joao@example.com"
}'
Responses seen in practice
- Flow not active (paused, archived, etc.): {"success":false,"error":"Flow is not active"}
- Success — contact created/found and enrolled: {"success":true,"message":"Contact enrolled successfully","enrollment_id":4183,"contact_id":75899}
The enrollment_id and contact_id values change with each enrollment. Make sure the flow is active in the panel before integrating; otherwise, fix the status and try again.
Security: the token in the URL is secret. Don't commit real tokens to public repositories; use environment variables or CI secrets instead. If the token leaks, use regenerate token in the flow and update the URL in your integrations.
Phone normalization
- Accepts numbers with or without +.
- Short local numbers may get a country code based on the flow settings (default_country_dial_code / default_country_code) or inbox/account heuristics.
Webhook variables → custom attributes
In the flow's webhook_config, you can list webhook_variables. The values are filled in from the payload or from the normalized additional attributes and are available to templates (Liquid) in the steps, truncated to 255 characters.
API responses
Success — 200 OK
{
"success": true,
"message": "Contact enrolled successfully",
"enrollment_id": 123,
"contact_id": 456
}
(enrollment_id and contact_id are the real IDs in your account.)
Common mistakes
- 401: Invalid token
- 403: Campanhas de múltiplos passos (Multi-step campaigns) feature turned off
- 404: Flow not found
- 422: Incompatible flow, flow not active (Flow is not active), no steps, missing phone, business rule, etc.
- 500: Internal error
Quick integration checklist
- Copy the webhook URL from the flow screen (or build it with flow_id + a valid token).
- Set up the source system to send a POST with Content-Type: application/json.
- Include at least the phone in the body, in a format the processor accepts (Standard or the detected one).
- Handle 200 with success: true and store enrollment_id / contact_id if needed for auditing.