> ## Documentation Index
> Fetch the complete documentation index at: https://developers.insuranceboosters.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Variables con nombre

> Envía variables nombradas en el body con parameter_name.

Guía de [Enviar plantilla](/whatsapp/enviar-plantilla) · [Tipos de plantilla](/whatsapp/tipos-de-plantilla)

Para plantillas con `parameter_format: NAMED`, usa `parameter_name` con el nombre exacto de cada variable (ej. `nombre`, `monto`).

El playground se precarga con la estructura de `components`. Completa `to`, `name`, `language` y los `parameter_name` antes de enviar.


## OpenAPI

````yaml openapi/examples/variables-con-nombre.json POST /whatsapp/{phoneNumberId}/template
openapi: 3.1.0
info:
  title: Insurance Boosters API - Variables con nombre en el body
  version: 1.0.0
servers:
  - url: https://api.insuranceboosters.com/api/v1
    description: Producción
security:
  - IbApiKey: []
paths:
  /whatsapp/{phoneNumberId}/template:
    post:
      tags:
        - WhatsApp
      summary: Variables con nombre en el body
      description: Envía una plantilla de WhatsApp aprobada a un destinatario.
      operationId: sendWhatsAppTemplate_variables_con_nombre
      parameters:
        - name: phoneNumberId
          in: path
          required: true
          description: >-
            Identificador de tu línea de WhatsApp. Solicítalo con tu ejecutivo
            de cuenta.
          schema:
            type: string
            example: '123456789012345'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTemplateRequest'
            example:
              to: ''
              name: ''
              language: es
              components:
                - type: body
                  parameters:
                    - type: text
                      parameter_name: nombre
                      text: María
                    - type: text
                      parameter_name: monto
                      text: $1,500
                    - type: text
                      parameter_name: fecha_limite
                      text: 15/08/2026
      responses:
        '200':
          description: Plantilla enviada correctamente.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendTemplateResponse'
        '400':
          description: >-
            Solicitud inválida (campos faltantes, components incorrectos o URL
            de media no accesible).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleErrorResponse'
              example:
                error: Missing Recipient Phone Number (to).
        '401':
          description: API key inválida o línea sin credenciales de WhatsApp.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleErrorResponse'
              example:
                message: Invalid API key.
        '404':
          description: Línea de WhatsApp no encontrada.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleErrorResponse'
              example:
                error: Phone line not found
        '500':
          description: Error del servicio.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleErrorResponse'
              example:
                error: Internal server error
      security:
        - IbApiKey: []
components:
  schemas:
    SendTemplateRequest:
      type: object
      required:
        - to
        - name
      properties:
        to:
          type: string
          description: >-
            Teléfono del destinatario en formato E.164 (solo dígitos, sin `+`).
            Ejemplo México: 5215512345678.
          x-default: ''
        name:
          type: string
          description: Nombre exacto de la plantilla aprobada.
          x-default: ''
        language:
          type: string
          description: Código de idioma de la plantilla. Por defecto `es`.
          default: es
          example: es
        components:
          type: array
          description: >-
            Componentes dinámicos (`header`, `body`, `button`). Omitir o enviar
            `[]` si la plantilla no tiene variables.
          items:
            $ref: '#/components/schemas/TemplateComponent'
          default: []
        inactiveBot:
          type: boolean
          description: >-
            Si es `true`, desactiva respuestas automáticas para ese contacto
            tras el envío.
          default: false
    SendTemplateResponse:
      type: object
      properties:
        messaging_product:
          type: string
          enum:
            - whatsapp
        contacts:
          type: array
          items:
            type: object
            properties:
              input:
                type: string
              wa_id:
                type: string
        messages:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Identificador del mensaje enviado.
    SimpleErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    TemplateComponent:
      oneOf:
        - $ref: '#/components/schemas/HeaderComponent'
        - $ref: '#/components/schemas/BodyComponent'
        - $ref: '#/components/schemas/ButtonComponent'
      discriminator:
        propertyName: type
        mapping:
          header:
            $ref: '#/components/schemas/HeaderComponent'
          body:
            $ref: '#/components/schemas/BodyComponent'
          button:
            $ref: '#/components/schemas/ButtonComponent'
    HeaderComponent:
      title: Encabezado (header)
      type: object
      required:
        - type
        - parameters
      properties:
        type:
          type: string
          enum:
            - header
        parameters:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/ImageParameter'
              - $ref: '#/components/schemas/VideoParameter'
              - $ref: '#/components/schemas/DocumentParameter'
            discriminator:
              propertyName: type
              mapping:
                image:
                  $ref: '#/components/schemas/ImageParameter'
                video:
                  $ref: '#/components/schemas/VideoParameter'
                document:
                  $ref: '#/components/schemas/DocumentParameter'
    BodyComponent:
      title: Cuerpo (body)
      type: object
      required:
        - type
        - parameters
      properties:
        type:
          type: string
          enum:
            - body
        parameters:
          type: array
          items:
            $ref: '#/components/schemas/TextParameter'
    ButtonComponent:
      title: Botón (button)
      type: object
      required:
        - type
        - sub_type
        - index
        - parameters
      properties:
        type:
          type: string
          enum:
            - button
        sub_type:
          type: string
          enum:
            - url
            - quick_reply
            - copy_code
          description: Tipo de botón dinámico.
        index:
          type: string
          description: Índice del botón en la plantilla (base 0, como string).
          example: '0'
        parameters:
          type: array
          items:
            $ref: '#/components/schemas/ButtonParameter'
    ImageParameter:
      title: Imagen
      type: object
      required:
        - type
        - image
      properties:
        type:
          type: string
          enum:
            - image
        image:
          title: Archivo de imagen
          type: object
          required:
            - link
          properties:
            link:
              type: string
              format: uri
              description: URL pública de la imagen (HTTPS). Es el único campo requerido.
    VideoParameter:
      title: Video
      type: object
      required:
        - type
        - video
      properties:
        type:
          type: string
          enum:
            - video
        video:
          title: Archivo de video
          type: object
          required:
            - link
          properties:
            link:
              type: string
              format: uri
    DocumentParameter:
      title: Documento
      type: object
      required:
        - type
        - document
      properties:
        type:
          type: string
          enum:
            - document
        document:
          title: Archivo PDF
          type: object
          required:
            - link
          properties:
            link:
              type: string
              format: uri
            filename:
              type: string
    TextParameter:
      title: Texto
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
        parameter_name:
          type: string
          description: Nombre del parámetro cuando la plantilla usa variables con nombre.
    ButtonParameter:
      oneOf:
        - $ref: '#/components/schemas/ButtonTextParameter'
        - $ref: '#/components/schemas/ButtonPayloadParameter'
        - $ref: '#/components/schemas/ButtonCouponParameter'
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/ButtonTextParameter'
          payload:
            $ref: '#/components/schemas/ButtonPayloadParameter'
          coupon_code:
            $ref: '#/components/schemas/ButtonCouponParameter'
    ButtonTextParameter:
      title: Texto para URL
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
          description: Fragmento que se concatena al final de la URL del botón.
    ButtonPayloadParameter:
      title: Payload quick reply
      type: object
      required:
        - type
        - payload
      properties:
        type:
          type: string
          enum:
            - payload
        payload:
          type: string
    ButtonCouponParameter:
      title: Código copiar
      type: object
      required:
        - type
        - coupon_code
      properties:
        type:
          type: string
          enum:
            - coupon_code
        coupon_code:
          type: string
  securitySchemes:
    IbApiKey:
      type: apiKey
      in: header
      name: x-ib-api-key
      description: API key emitida por Insurance Boosters.

````