Saltar al contenido principal
POST
/
v1
/
waba
/
send-template
curl -X POST "https://api.contactship.ai/v1/waba/send-template" \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "chn_abc123",
    "contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
    "template_name": "primer_contacto_v1",
    "language_code": "es",
    "components": [
      {
        "type": "BODY",
        "parameters": [
          { "type": "text", "parameter_name": "nombre", "text": "Juan Pérez" },
          { "type": "text", "parameter_name": "fecha", "text": "ayer" }
        ]
      }
    ]
  }'
{
  "success": true,
  "message": "Plantilla enviada y guardada",
  "data": {
    "message_id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "provider_id": "wamid.HBgNMTIxMjM0NTY3ODkwFQIAERgSM...",
    "thread_id": "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901"
  }
}
Sends a pre-approved WhatsApp Business message template to a contact. Templates must be approved by Meta before use. Use Get WhatsApp Templates to list available templates.
WhatsApp requires using templates to initiate conversations that have been inactive for more than 24 hours. Free-form messages can only be sent within an active 24-hour window.

Headers

x-api-key
string
requerido
Your API key for authentication.

Body

channel_id
string
requerido
UUID of the WABA channel to send from.
contact_id
string
requerido
UUID of the contact to message.
template_name
string
requerido
Name of the approved WhatsApp template (e.g. primer_contacto_v1).
language_code
string
predeterminado:"es"
Language code for the template (e.g. es, en_US). Defaults to es.
components
array
Template variable substitutions. Structure follows the Meta Cloud API format.
thread_id
string
UUID of an existing thread. If provided, channel_id and contact_id are inferred automatically.
save_message
boolean
predeterminado:"true"
Whether to save the message in the conversation thread. Defaults to true.

Response

success
boolean
true if the template was sent successfully.
data
object

Error Codes

  • 400 Bad Request — Missing fields, invalid channel, or template not found
  • 401 Unauthorized — Invalid or missing API key
  • 404 Not Found — Contact not found
  • 500 Internal Server Error — Meta API error or internal failure

Code Examples

curl -X POST "https://api.contactship.ai/v1/waba/send-template" \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_id": "chn_abc123",
    "contact_id": "c1d2e3f4-a5b6-7890-cdef-123456789012",
    "template_name": "primer_contacto_v1",
    "language_code": "es",
    "components": [
      {
        "type": "BODY",
        "parameters": [
          { "type": "text", "parameter_name": "nombre", "text": "Juan Pérez" },
          { "type": "text", "parameter_name": "fecha", "text": "ayer" }
        ]
      }
    ]
  }'
{
  "success": true,
  "message": "Plantilla enviada y guardada",
  "data": {
    "message_id": "msg-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "provider_id": "wamid.HBgNMTIxMjM0NTY3ODkwFQIAERgSM...",
    "thread_id": "thr-b2c3d4e5-f6a7-8901-bcde-f12345678901"
  }
}