Skip to main content
GET
/
templates
/
v1
/
{id}
curl -X GET "https://api.whaapy.com/templates/v1/tmpl-uuid" \
  -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. Te avisaremos cuando esté en camino.",
    "variables": ["{{1}}", "{{2}}"],
    "components": [
      {
        "type": "HEADER",
        "format": "IMAGE"
      },
      {
        "type": "BODY",
        "text": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado. Te avisaremos cuando esté en camino.",
        "example": {
          "body_text": [["Juan", "12345"]]
        }
      },
      {
        "type": "FOOTER",
        "text": "Gracias por tu compra"
      },
      {
        "type": "BUTTONS",
        "buttons": [
          {
            "type": "URL",
            "text": "Rastrear pedido",
            "url": "https://ejemplo.com/track/{{1}}"
          }
        ]
      }
    ],
    "createdAt": "2026-01-15T10:00:00Z",
    "updatedAt": "2026-01-15T10:00:00Z"
  }
}

Parámetros de Path

id
string
required
UUID del template
curl -X GET "https://api.whaapy.com/templates/v1/tmpl-uuid" \
  -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. Te avisaremos cuando esté en camino.",
    "variables": ["{{1}}", "{{2}}"],
    "components": [
      {
        "type": "HEADER",
        "format": "IMAGE"
      },
      {
        "type": "BODY",
        "text": "Hola {{1}}, tu pedido #{{2}} ha sido confirmado. Te avisaremos cuando esté en camino.",
        "example": {
          "body_text": [["Juan", "12345"]]
        }
      },
      {
        "type": "FOOTER",
        "text": "Gracias por tu compra"
      },
      {
        "type": "BUTTONS",
        "buttons": [
          {
            "type": "URL",
            "text": "Rastrear pedido",
            "url": "https://ejemplo.com/track/{{1}}"
          }
        ]
      }
    ],
    "createdAt": "2026-01-15T10:00:00Z",
    "updatedAt": "2026-01-15T10:00:00Z"
  }
}

Errores

{
  "error": "Template not found"
}

Campos de respuesta

CampoTipoDescripción
idstringUUID interno de Whaapy
namestringNombre del template (usado para enviar)
categorystringMARKETING, UTILITY, AUTHENTICATION
languagestringCódigo de idioma
statusstringEstado de aprobación
contentstringTexto del body (para preview)
variablesarrayVariables posicionales detectadas
componentsarrayEstructura completa del template

Usar el template

Una vez que tienes los detalles del template, puedes usarlo para enviar un mensaje:
const template = response.data;

// Enviar el template
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: 'header',
          parameters: [
            { type: 'image', image: { link: 'https://ejemplo.com/logo.png' } }
          ]
        },
        {
          type: 'body',
          parameters: template.variables.map((_, i) => ({
            type: 'text',
            text: i === 0 ? 'Juan' : '12345'  // Reemplazar con valores reales
          }))
        },
        {
          type: 'button',
          sub_type: 'url',
          index: 0,
          parameters: [
            { type: 'text', text: '12345' }  // Valor para {{1}} en la URL
          ]
        }
      ]
    }
  })
});