Documentación para Desarrolladores

Envíe mensajes de WhatsApp con una API que ya conoce

Si ya ha utilizado la API de WhatsApp Cloud de Meta, ya conoce la nuestra. Misma ruta, mismo JSON, misma autenticación Bearer.

01Inicio Rápido

Tres cosas y su primer mensaje estará en camino: la URL base, una clave de dispositivo y el endpoint de mensajes.

Base URL
https://api.smartsybox.com
Authentication
Authorization: Bearer <YOUR_DEVICE_KEY>
Content type
application/json

El Endpoint

POST /v26.0/{phone-number-id}/messages
El segmento de versión se acepta en cualquier formato v — mantenga lo que usa su código actual.

02Envíe su primer mensaje

Un mensaje de texto plano. El cuerpo es el payload estándar de Cloud API.

cURL
curl -X POST https://api.smartsybox.com/v26.0/PHONE_NUMBER_ID/messages \
  -H "Authorization: Bearer YOUR_DEVICE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "15551234567",
    "type": "text",
    "text": { "body": "Hello from SyBox 👋" }
  }'
C# · HttpClient
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;

var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", "YOUR_DEVICE_KEY");

string json = @"{
  ""messaging_product"": ""whatsapp"",
  ""to"": ""15551234567"",
  ""type"": ""text"",
  ""text"": { ""body"": ""Hello from SyBox"" }
}";

var res = await http.PostAsync(
    "https://api.smartsybox.com/v26.0/PHONE_NUMBER_ID/messages",
    new StringContent(json, Encoding.UTF8, "application/json"));

Console.WriteLine(await res.Content.ReadAsStringAsync());

La Respuesta

Recibe exactamente lo que devuelve Meta, con el mismo estado HTTP.

200 OK · application/json
{
  "messaging_product": "whatsapp",
  "contacts": [{ "input": "15551234567", "wa_id": "15551234567" }],
  "messages": [{ "id": "wamid.HBgLMTU1NTEyMzQ1NjcVAgARGBI…" }]
}

03Cualquier tipo de mensaje funciona

Dado que el cuerpo se reenvía sin cambios, se admiten todos los tipos de mensajes de Cloud API.

Request body · template
{
  "messaging_product": "whatsapp",
  "to": "15551234567",
  "type": "template",
  "template": {
    "name": "hello_world",
    "language": { "code": "en_US" }
  }
}

04Muestre sus datos junto al chat

Cuando un agente abre una conversación, SyBox llama a SU endpoint y muestra lo que devuelva junto al chat.

Request · SyBox → your endpoint
POST YOUR_ERP_URL
Authorization: Bearer YOUR_ERP_KEY
X-Sybox-Action: lookup

# body: { "data": "<json string>" } — the decoded "data":
{
  "phone": "15551234567",
  "email": "customer@example.com",
  "ref": ""
}
Your reply · application/json
{
  "renderAs": "table",
  "content": [
    { "Order": "#10432", "Status": "Shipped", "Total": "1,250 MAD" }
  ]
}

renderAs

Establezca renderAs para indicar a SyBox cómo mostrar su contenido:

table
Rows & columns. content = an array of flat objects (or { rows: [ … ] }). Object keys become the column headers.
cards · kpi
Compact tiles (a balance, an order count). content = an array of { label, value } (or { cards: [ … ] }).
feed · list · thread
A timeline of rich cards. content = an array of { title, text, date, tags, media:[{ type, url, name }] }.
message
A single message-style card (one record laid out as a note).
html
Your own trusted HTML — content = a string. Use only for markup you generate yourself.
sections
Several blocks at once: content = { sections: [ { title, renderAs, content } ] } — mix a table + cards + a feed in one reply.
json
The default when renderAs is omitted — SyBox pretty-prints your content as-is.

Añada sybox_ref a cualquier fila de tabla para hacerla interactiva.

Enviamos teléfono y correo — responda con { renderAs, content }.

05Abra un caso desde su propio sistema

Su sistema solicita a SyBox la apertura de un registro unificado de atención.

cURL
curl -X POST "https://api.smartsybox.com/v1/case" \
  -H "Authorization: Bearer $SYBOX_CASE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_unique_id": "CUST-10432",
    "header": "Screen replacement not delivered",
    "description": "Paid on 12 Aug, promised in 3 days, still nothing.",
    "ext_ref": "TICKET-99817"
  }'

Los campos

customer_unique_id
Su propio ID de registro de cliente.
header / description
Se requiere al menos uno. El encabezado es lo que ven los agentes en la lista.
ext_ref
Su número de ticket.
El cliente ya debe existir en el sistema.
Use una clave de tipo 'case'.

06Transfiera mensajes desde otro programa

Para cualquier canal externo: notas de POS, alertas de dispositivos o registros heredados.

cURL
curl -X POST "https://api.smartsybox.com/v1/inbound" \
  -H "Authorization: Bearer $SYBOX_INBOUND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "212600112233",
    "text": "Order 4821 has left the warehouse."
  }'
Solo entrada por diseño. Esta ruta escribe en la conversación.

07Errores

Los errores se devuelven intactos desde Meta con sus mismos códigos de estado.

4xx · application/json
{
  "error": {
    "message": "(#131030) Recipient phone number not in allowed list",
    "type": "OAuthException",
    "code": 131030
  }
}

08Obtener una clave de dispositivo

Las claves se crean dentro de su espacio de trabajo.

  • Abra su espacio de trabajo → Configuración → Claves de API.
  • Cada clave está vinculada a un número y se puede revocar en cualquier momento.
  • Su token real de WhatsApp nunca sale de nuestro servidor.
  • El gateway está desactivado por defecto.

WhatsApp, Messenger, and Instagram are trademarks of Meta Platforms, Inc.
SyBox™ is an independent product built on Meta Cloud API.

SMART SOUQ

SMART SOUQ SARL AU · RC Marrakech N° 154779 · RC Fès N° 87323 · ICE 003587569000031
© 2026. All rights reserved.