Reference
WhatsApp oficial
Plantillas y campañas de WhatsApp (API oficial de Meta).
Solo salen por un número de la API oficial de tu sede. El token necesita la
habilidad whatsapp:send (o *) en esa sede.
Enviar una plantilla
Sends an approved WhatsApp template to a phone number or to a CRM contact.
POST
/api/v1/whatsapp/messages
Funciona con la ventana de 24 h abierta o cerrada. El mensaje sale por la cola: la
respuesta confirma que quedó aceptado, no que Meta lo entregó; sigue su
estado con el webhook message.status_changed.
Un teléfono sin «+» se interpreta con el país de la sede. Si el teléfono no es un contacto todavía, se crea. Las plantillas con cabecera de imagen, video o documento no se pueden enviar por esta vía todavía.
message.status_changed solo avisa de mensajes de plantilla y de campaña,
no del resto de los chats.
Body parameters
-
phonestringTeléfono del destinatario. Obligatorio si no mandas
contact.Example:
+52 55 5555 5555 -
contactstringULID de un contacto del CRM. Obligatorio si no mandas
phone.Example:
01JD3X8Y2Q4R6T8V0W2Y4A6C8E -
channel_integrationstring requiredphone_number_iddel número oficial desde el que sale.Example:
109876543210987 -
templateobject requiredLa plantilla aprobada.
-
namestring requiredExample:
cupon_noviembre -
languagestring requiredExample:
es_MX
-
-
variablesobjectValores de los huecos. La clave es
body_1,header_nombre,buttons_0…; para el cuerpo basta1o el nombre.Example:
{"1":"Ana","2":"NOV20"}
curl --request POST \
"https://klozzo.com/api/v1/whatsapp/messages" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Idempotency-Key: required Un valor único por envío. Un reintento con la misma clave devuelve la primera respuesta sin enviar otra vez. Example: promo-2026-11-15-ana" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"phone\": \"+52 55 5555 5555\",
\"contact\": \"01JD3X8Y2Q4R6T8V0W2Y4A6C8E\",
\"channel_integration\": \"109876543210987\",
\"template\": {
\"name\": \"cupon_noviembre\",
\"language\": \"es_MX\"
},
\"variables\": {
\"1\": \"Ana\",
\"2\": \"NOV20\"
}
}"
const url = new URL(
"https://klozzo.com/api/v1/whatsapp/messages"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Idempotency-Key": "required Un valor único por envío. Un reintento con la misma clave devuelve la primera respuesta sin enviar otra vez. Example: promo-2026-11-15-ana",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"phone": "+52 55 5555 5555",
"contact": "01JD3X8Y2Q4R6T8V0W2Y4A6C8E",
"channel_integration": "109876543210987",
"template": {
"name": "cupon_noviembre",
"language": "es_MX"
},
"variables": {
"1": "Ana",
"2": "NOV20"
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/v1/whatsapp/messages';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Idempotency-Key' => 'required Un valor único por envío. Un reintento con la misma clave devuelve la primera respuesta sin enviar otra vez. Example: promo-2026-11-15-ana',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'phone' => '+52 55 5555 5555',
'contact' => '01JD3X8Y2Q4R6T8V0W2Y4A6C8E',
'channel_integration' => '109876543210987',
'template' => ['name' => 'cupon_noviembre', 'language' => 'es_MX'],
'variables' => [1 => 'Ana', 'NOV20'],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/v1/whatsapp/messages'
payload = {
"phone": "+52 55 5555 5555",
"contact": "01JD3X8Y2Q4R6T8V0W2Y4A6C8E",
"channel_integration": "109876543210987",
"template": {
"name": "cupon_noviembre",
"language": "es_MX"
},
"variables": {
"1": "Ana",
"2": "NOV20"
}
}
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Idempotency-Key': 'required Un valor único por envío. Un reintento con la misma clave devuelve la primera respuesta sin enviar otra vez. Example: promo-2026-11-15-ana',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
{
"data": {
"ulid": "01JD3X8Y2Q4R6T8V0W2Y4A6C8E",
"status": "queued",
"to": "+525555555555",
"contact": "01JD3X8Y2Q4R6T8V0W2Y4A6C9F",
"template": {
"name": "cupon_noviembre",
"language": "es_MX"
},
"channel_integration": "109876543210987"
}
}
-
dataobject-
ulidstring -
statusstring -
tostring -
contactstring -
templateobject-
namestring -
languagestring
-
-
channel_integrationstring
-
{
"message": "The phone field is invalid.",
"errors": {
"phone": [
"El teléfono no es válido."
]
}
}
Every error shares the same shape — message and errors.
See Errors.
Crear una campaña
Creates a WhatsApp campaign as a draft; nothing is sent until POST /api/v1/campaigns/{ulid}/send.
POST
/api/v1/campaigns
La audiencia puede ser segmentos y listas del CRM (por ULID), destinatarios
en el cuerpo, o ambas. Los destinatarios del cuerpo se guardan como una lista
aislada: no crean contactos. Con variables por destinatario, mapea el hueco
con source: list_attribute y key igual al nombre de la variable.
Body parameters
-
namestring requiredExample:
Cupón de noviembre -
channel_integrationstring requiredphone_number_iddel número oficial.Example:
109876543210987 -
templateobject required-
namestring requiredExample:
cupon_noviembre -
languagestring requiredExample:
es_MX
-
-
variable_mapobjectMapa
hueco → {source, key, default}.defaultes obligatorio.-
sourcestringMust not be greater than 30 characters.
Example:
n -
keystringMust not be greater than 120 characters.
Example:
g -
defaultstringMust not be greater than 1024 characters.
Example:
z
-
-
audienceobjectSegmentos y listas por ULID:
smart_list_ids,campaign_list_ids,contact_idsy las mismas conexclude_.Example:
[] -
recipientsobject[]Destinatarios en el cuerpo (hasta el tope configurado, 10 000 por defecto).
-
phonestring requiredExample:
+52 55 5555 5555 -
namestringExample:
Ana -
variablesobjectExample:
{"nombre":"Ana"}
-
-
reply_routestringA dónde van las respuestas:
inbox(defecto) ohuman.Example:
inbox -
scheduled_atstringISO-8601 con zona, futura.
/sendprograma la campaña para esa hora.Example:
2026-11-20T10:00:00-06:00
curl --request POST \
"https://klozzo.com/api/v1/campaigns" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Idempotency-Key: required Un valor único por operación. Un reintento con la misma clave devuelve la primera respuesta sin crear otra campaña. Example: campana-2026-11-cupon" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Cupón de noviembre\",
\"channel_integration\": \"109876543210987\",
\"template\": {
\"name\": \"cupon_noviembre\",
\"language\": \"es_MX\"
},
\"variable_map\": {
\"body_1\": {
\"source\": \"list_attribute\",
\"key\": \"nombre\",
\"default\": \"cliente\"
},
\"0\": {
\"source\": \"n\",
\"key\": \"g\",
\"default\": \"z\"
}
},
\"audience\": [],
\"recipients\": [
{
\"phone\": \"+52 55 5555 5555\",
\"name\": \"Ana\",
\"variables\": {
\"nombre\": \"Ana\"
}
}
],
\"reply_route\": \"inbox\",
\"scheduled_at\": \"2026-11-20T10:00:00-06:00\"
}"
const url = new URL(
"https://klozzo.com/api/v1/campaigns"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Idempotency-Key": "required Un valor único por operación. Un reintento con la misma clave devuelve la primera respuesta sin crear otra campaña. Example: campana-2026-11-cupon",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Cupón de noviembre",
"channel_integration": "109876543210987",
"template": {
"name": "cupon_noviembre",
"language": "es_MX"
},
"variable_map": {
"body_1": {
"source": "list_attribute",
"key": "nombre",
"default": "cliente"
},
"0": {
"source": "n",
"key": "g",
"default": "z"
}
},
"audience": [],
"recipients": [
{
"phone": "+52 55 5555 5555",
"name": "Ana",
"variables": {
"nombre": "Ana"
}
}
],
"reply_route": "inbox",
"scheduled_at": "2026-11-20T10:00:00-06:00"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/v1/campaigns';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Idempotency-Key' => 'required Un valor único por operación. Un reintento con la misma clave devuelve la primera respuesta sin crear otra campaña. Example: campana-2026-11-cupon',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Cupón de noviembre',
'channel_integration' => '109876543210987',
'template' => ['name' => 'cupon_noviembre', 'language' => 'es_MX'],
'variable_map' => [
'body_1' => ['source' => 'list_attribute', 'key' => 'nombre', 'default' => 'cliente'],
['source' => 'n', 'key' => 'g', 'default' => 'z'],
],
'audience' => [],
'recipients' => [
[
'phone' => '+52 55 5555 5555',
'name' => 'Ana',
'variables' => ['nombre' => 'Ana'],
],
],
'reply_route' => 'inbox',
'scheduled_at' => '2026-11-20T10:00:00-06:00',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/v1/campaigns'
payload = {
"name": "Cupón de noviembre",
"channel_integration": "109876543210987",
"template": {
"name": "cupon_noviembre",
"language": "es_MX"
},
"variable_map": {
"body_1": {
"source": "list_attribute",
"key": "nombre",
"default": "cliente"
},
"0": {
"source": "n",
"key": "g",
"default": "z"
}
},
"audience": [],
"recipients": [
{
"phone": "+52 55 5555 5555",
"name": "Ana",
"variables": {
"nombre": "Ana"
}
}
],
"reply_route": "inbox",
"scheduled_at": "2026-11-20T10:00:00-06:00"
}
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Idempotency-Key': 'required Un valor único por operación. Un reintento con la misma clave devuelve la primera respuesta sin crear otra campaña. Example: campana-2026-11-cupon',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
{
"data": {
"ulid": "01JD3X8Y2Q4R6T8V0W2Y4A6C8E",
"name": "Cupón de noviembre",
"status": "draft",
"stats": {
"total": 0,
"pending": 0,
"sent": 0,
"delivered": 0,
"read": 0,
"replied": 0,
"failed": 0,
"skipped": 0
}
}
}
-
dataobject-
ulidstring -
namestring -
statusstring -
statsobject-
totalinteger -
pendinginteger -
sentinteger -
deliveredinteger -
readinteger -
repliedinteger -
failedinteger -
skippedinteger
-
-
Lanzar una campaña
Schedules a draft WhatsApp campaign for its scheduled_at, or right away if it has none.
POST
/api/v1/campaigns/{campaign_ulid}/send
El motor la toma en el siguiente minuto. Repetir la llamada sobre una campaña ya programada no hace nada nuevo. Sobre una campaña que ya está enviándose, o terminada, responde 409 y no la relanza.
Aquí se exige todo completo: número, plantilla, variables y que la audiencia tenga a alguien que pueda recibirla.
Path parameters
-
campaign_ulidstring requiredULID de la campaña.
Example:
01JD3X8Y2Q4R6T8V0W2Y4A6C8E
curl --request POST \
"https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E/send" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Idempotency-Key: required Un valor único por operación. Example: lanzar-cupon-2026-11" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E/send"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Idempotency-Key": "required Un valor único por operación. Example: lanzar-cupon-2026-11",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E/send';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Idempotency-Key' => 'required Un valor único por operación. Example: lanzar-cupon-2026-11',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E/send'
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Idempotency-Key': 'required Un valor único por operación. Example: lanzar-cupon-2026-11',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers)
response.json()
{
"data": {
"ulid": "01JD3X8Y2Q4R6T8V0W2Y4A6C8E",
"status": "scheduled"
}
}
-
dataobject-
ulidstring -
statusstring
-
{
"message": "No query results for model."
}
Every error shares the same shape — message and errors.
See Errors.
{
"message": "Esta campaña ya está enviándose o terminó: no se puede lanzar otra vez."
}
Every error shares the same shape — message and errors.
See Errors.
Consultar una campaña
Returns a WhatsApp campaign's status and delivery metrics, counted over its frozen recipients.
GET
/api/v1/campaigns/{ulid}
skipped son los que no se pudieron mandar (sin teléfono, baja de marketing, duplicado).
Path parameters
-
ulidstring requiredULID de la campaña.
Example:
01JD3X8Y2Q4R6T8V0W2Y4A6C8E
curl --request GET \
--get "https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/v1/campaigns/01JD3X8Y2Q4R6T8V0W2Y4A6C8E'
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
{
"data": {
"ulid": "01JD3X8Y2Q4R6T8V0W2Y4A6C8E",
"status": "sending",
"stats": {
"total": 200,
"pending": 50,
"sent": 60,
"delivered": 60,
"read": 20,
"replied": 5,
"failed": 3,
"skipped": 2
}
}
}
-
dataobject-
ulidstring -
statusstring -
statsobject-
totalinteger -
pendinginteger -
sentinteger -
deliveredinteger -
readinteger -
repliedinteger -
failedinteger -
skippedinteger
-
-
{
"message": "No query results for model."
}
Every error shares the same shape — message and errors.
See Errors.