Add an opt-in lead (sends their first message)
const url = 'https://app.whatsetter.com/api/v1/campaigns/example/leads';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"phone":"+33612345678","name":"Marie Dupont","email":"marie@acme.fr","source_url":"crm:hubspot","additional_data":{"offre":"Pack Pro","ville":"Lyon","budget":"500-1000"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.whatsetter.com/api/v1/campaigns/example/leads \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "phone": "+33612345678", "name": "Marie Dupont", "email": "marie@acme.fr", "source_url": "crm:hubspot", "additional_data": { "offre": "Pack Pro", "ville": "Lyon", "budget": "500-1000" } }'The CRM primitive for opt-in leads: when someone signs up on your client’s funnel or CRM, push them here and WhatSetter runs the exact same pipeline as the campaign’s public sales-page webhook, with the anti-ban protections applied automatically:
- Phone validation and WhatsApp-registration check, deduplication against leads already contacted.
- Daily first-contact quota and anti-bot pacing: over-quota leads are queued for the next window, never dropped.
- The AI writes a personalized first message from the campaign’s
template, the lead’s name, the source, and every key you pass in
additional_data(budget, city, product of interest, plan…). - The lead lands in the campaign and the agent handles replies.
The pipeline is asynchronous, so the endpoint answers 202 as soon as
the lead is accepted. Follow progress with GET /leads (filter on
campaign_id) or the signed webhooks. Accepts the campaign document
id or its campaign_id slug in the path. Requires scope
messages:send.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Campaign document id, or its campaign_id slug.
Request Bodyrequired
Section titled “Request Bodyrequired”object
International format, e.g. +33612345678.
Where the lead came from (defaults to api).
Free-form CRM fields (up to 30 keys, 2000 characters total). The AI uses them to personalize the first message.
object
Example
{ "phone": "+33612345678", "name": "Marie Dupont", "email": "marie@acme.fr", "source_url": "crm:hubspot", "additional_data": { "offre": "Pack Pro", "ville": "Lyon", "budget": "500-1000" }}Responses
Section titled “Responses”Lead accepted into the first-contact pipeline
object
object
Example
{ "data": { "status": "accepted" }}Missing, unknown or revoked API key
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}The key lacks the required scope
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Resource not found in this workspace
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Campaign is not active
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}Invalid parameter or body
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}First-message pipeline unreachable
object
object
Examplegenerated
{ "error": { "code": "example", "message": "example" }}
