Skip to main content
GET
/
templates
/
v1
curl -X GET "https://api.whaapy.com/templates/v1" \
  -H "Authorization: Bearer wha_xxxxx"
{
  "data": [
    {
      "id": "tmpl-uuid-1",
      "name": "order_confirmation",
      "category": "UTILITY",
      "language": "es_MX",
      "status": "APPROVED",
      "content": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado.",
      "variables": ["{{1}}", "{{2}}"],
      "components": [
        {
          "type": "BODY",
          "text": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado.",
          "example": {
            "body_text": [["Juan", "12345"]]
          }
        }
      ],
      "createdAt": "2026-01-15T10:00:00Z",
      "updatedAt": "2026-01-15T10:00:00Z"
    },
    {
      "id": "tmpl-uuid-2",
      "name": "welcome_message",
      "category": "MARKETING",
      "language": "es_MX",
      "status": "APPROVED",
      "content": "¡Bienvenido {{1}}! Gracias por contactarnos.",
      "variables": ["{{1}}"],
      "components": [
        {
          "type": "HEADER",
          "format": "IMAGE"
        },
        {
          "type": "BODY",
          "text": "¡Bienvenido {{1}}! Gracias por contactarnos."
        },
        {
          "type": "FOOTER",
          "text": "Equipo de Soporte"
        },
        {
          "type": "BUTTONS",
          "buttons": [
            {
              "type": "QUICK_REPLY",
              "text": "Ver catálogo"
            },
            {
              "type": "URL",
              "text": "Visitar web",
              "url": "https://ejemplo.com"
            }
          ]
        }
      ],
      "createdAt": "2026-01-10T08:00:00Z",
      "updatedAt": "2026-01-10T08:00:00Z"
    }
  ]
}
curl -X GET "https://api.whaapy.com/templates/v1" \
  -H "Authorization: Bearer wha_xxxxx"
{
  "data": [
    {
      "id": "tmpl-uuid-1",
      "name": "order_confirmation",
      "category": "UTILITY",
      "language": "es_MX",
      "status": "APPROVED",
      "content": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado.",
      "variables": ["{{1}}", "{{2}}"],
      "components": [
        {
          "type": "BODY",
          "text": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado.",
          "example": {
            "body_text": [["Juan", "12345"]]
          }
        }
      ],
      "createdAt": "2026-01-15T10:00:00Z",
      "updatedAt": "2026-01-15T10:00:00Z"
    },
    {
      "id": "tmpl-uuid-2",
      "name": "welcome_message",
      "category": "MARKETING",
      "language": "es_MX",
      "status": "APPROVED",
      "content": "¡Bienvenido {{1}}! Gracias por contactarnos.",
      "variables": ["{{1}}"],
      "components": [
        {
          "type": "HEADER",
          "format": "IMAGE"
        },
        {
          "type": "BODY",
          "text": "¡Bienvenido {{1}}! Gracias por contactarnos."
        },
        {
          "type": "FOOTER",
          "text": "Equipo de Soporte"
        },
        {
          "type": "BUTTONS",
          "buttons": [
            {
              "type": "QUICK_REPLY",
              "text": "Ver catálogo"
            },
            {
              "type": "URL",
              "text": "Visitar web",
              "url": "https://ejemplo.com"
            }
          ]
        }
      ],
      "createdAt": "2026-01-10T08:00:00Z",
      "updatedAt": "2026-01-10T08:00:00Z"
    }
  ]
}

Campos del template

CampoTipoDescripción
idstringUUID interno de Whaapy
namestringNombre del template (slug)
categorystringMARKETING, UTILITY, AUTHENTICATION
languagestringCódigo de idioma (ej: es_MX, en_US)
statusstringAPPROVED, PENDING, REJECTED
contentstringTexto del body con placeholders
variablesarrayLista de variables detectadas
componentsarrayComponentes del template

Estructura de componentes

Cada template puede tener los siguientes componentes:
{
  "type": "HEADER",
  "format": "TEXT" | "IMAGE" | "VIDEO" | "DOCUMENT",
  "text": "Texto del header (solo si format=TEXT)",
  "example": {
    "header_text": ["Ejemplo"]
  }
}

BODY

{
  "type": "BODY",
  "text": "Texto con {{1}} variables {{2}}",
  "example": {
    "body_text": [["valor1", "valor2"]]
  }
}
{
  "type": "FOOTER",
  "text": "Texto del footer"
}

BUTTONS

{
  "type": "BUTTONS",
  "buttons": [
    {
      "type": "QUICK_REPLY",
      "text": "Opción 1"
    },
    {
      "type": "URL",
      "text": "Visitar web",
      "url": "https://ejemplo.com/{{1}}"
    },
    {
      "type": "PHONE_NUMBER",
      "text": "Llamar",
      "phone_number": "+5215512345678"
    }
  ]
}
Solo se devuelven templates con estado APPROVED. Para ver templates pendientes o rechazados, usa el dashboard de Whaapy o el Meta Business Manager.

Usar template para enviar mensaje

Una vez que tienes el template, puedes enviarlo así:
const template = templates[0]; // order_confirmation

await fetch('https://api.whaapy.com/messages/v1', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer wha_xxxxx',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    to: '+5215512345678',
    type: 'template',
    template: {
      name: template.name,
      language: template.language,
      components: [
        {
          type: 'body',
          parameters: [
            { type: 'text', text: 'Juan' },      // {{1}}
            { type: 'text', text: '12345' }      // {{2}}
          ]
        }
      ]
    }
  })
});