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

# Send a WhatsApp message

> Sends one WhatsApp message: a session message (text, media, location, contacts or interactive) inside the
24-hour customer service window, or an approved template at any time.

This route queues the message and returns at once (`async`). Use `/messages/whatsapp/sync` to wait until the
message is created and get its `id`. Track delivery with the `Message.WA.Status.Received` webhook or
`GET /messages/{messageId}/status`.




## OpenAPI

````yaml /api-reference/openapi.json post /devapi/accounts/{accountId}/messages/whatsapp
openapi: 3.1.0
info:
  title: Gallabox Developer API
  version: 0.0.1
  summary: >-
    Send WhatsApp messages, manage contacts and conversations, and automate your
    Gallabox inbox.
  description: >
    The Gallabox Developer API lets your systems send WhatsApp and Instagram
    messages, keep contacts in sync, work

    the shared inbox, manage templates and broadcasts, and receive events
    through webhooks.


    ## Overview

    The API follows REST. URLs name resources, methods say what to do with them
    (`GET` reads, `POST` creates or

    acts, `PATCH` and `PUT` update, `DELETE` removes), request bodies are JSON
    (`Content-Type: application/json`),

    and every response is JSON. All requests go to `https://server.gallabox.com`
    over HTTPS, under `/devapi`.


    ## Concepts

    - **Account ID** (`accountId`): your Gallabox account. Most URLs contain it,
    as in
      `/devapi/accounts/{accountId}/contacts`, and it must be the account the API key belongs to. `GET /devapi/me`
      returns it.
    - **Channel ID** (`channelId`): one connected WhatsApp number, Instagram
    account, web chat or email inbox. Sending
      a message needs one. `GET /devapi/accounts/{accountId}/channels` lists them.
    - **Contact**, **conversation** and **message** IDs are 24-character
    hexadecimal strings returned by the API and
      included in webhook events.

    ## Authentication

    Create an API key on the **Settings** page in Gallabox. Send the key and its
    secret as headers on every

    request:


    ```http

    GET /devapi/me HTTP/1.1

    Host: server.gallabox.com

    apiKey: <your API key>

    apiSecret: <your API secret>

    ```


    `GET /devapi/me` is a good first call: it returns your user and account. A
    missing or wrong key returns `401`.

    Each key belongs to one account and has a permission scope (`all`,
    `restricted` or `read-only`) that decides

    what it may do.


    ## Rate limits

    - **General limit:** each account can make 200 requests a minute (your plan
    may allow more). Responses carry
      `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (when the window resets). Over the limit
      you get `429` with `X-RateLimit-Retry-After`, the seconds to wait.
    - **Message sending:** the send endpoints (marked `x-rate-limit:
    message-send`) use a separate limit per plan:
      8, 16 or 5,000 messages every 5 seconds. Over the limit you get `429` with `Retry-After`, the seconds to wait.

    ```http

    HTTP/1.1 429 Too Many Requests

    X-RateLimit-Limit: 200

    X-RateLimit-Remaining: 0

    X-RateLimit-Retry-After: 42


    {"status": "RequestLimitHit", "message": "Account rate limit exceeded. Too
    many requests per minute."}

    ```


    ## Plans and permissions

    Some endpoints need a plan feature (listed under `x-entitlements`) or a
    permission on the API key's role

    (listed under `x-permissions`). Either one missing returns `403`, and each
    endpoint's `403` response says

    which. If the account is disconnected, every call returns `402` until it is
    active again.


    ## Errors

    Errors return a JSON body with `status` and `message`. Validation errors
    (`422`) add `error`, a readable

    summary, and `errors`, the problem with each field.


    | Code | Meaning |

    | --- | --- |

    | `401` | The API key or secret is missing or wrong. |

    | `402` | The account is disconnected. |

    | `403` | The plan doesn't include the feature, or the key's role doesn't
    allow the action. |

    | `404` | The resource doesn't exist in this account. |

    | `421` | A send was refused because of the contact's settings, such as no
    opt-in. |

    | `422` | The request failed validation. |

    | `429` | Rate limit reached. |
  contact:
    name: Gallabox Support
    url: https://gallabox.com
  license:
    name: Proprietary
servers:
  - url: https://server.gallabox.com
    description: Production
security:
  - apiKey: []
    apiSecret: []
tags:
  - name: Account
    description: The API key's account and wallet balance.
  - name: Messages
    description: Send WhatsApp messages, track delivery and read message history.
  - name: Direct Send
    description: >-
      Send a Utility message without creating a template first; Meta creates the
      template automatically.
  - name: Instagram
    description: Send Instagram direct messages.
  - name: Contacts
    description: Create, update, find and delete contacts, and manage their tags.
  - name: Segments
    description: Saved contact filters, used as broadcast audiences.
  - name: Tags
    description: The account's tags.
  - name: Custom Fields
    description: Custom contact fields.
  - name: Conversations
    description: Assign, tag, resolve and annotate conversations in the shared inbox.
  - name: WhatsApp Templates
    description: Create, list and edit WhatsApp message templates.
  - name: Broadcasts
    description: Send a template to a segment and read per-recipient results.
  - name: Webhooks
    description: >-
      Subscribe a URL to account events. Event payloads are listed under
      Webhooks in the reference.
  - name: WhatsApp Groups
    description: Create and manage WhatsApp groups, their participants and messages.
  - name: Users and Teams
    description: Invite and remove users, set availability, and map users to teams.
  - name: Channels
    description: The account's WhatsApp, Instagram and other channels.
  - name: Click-to-WhatsApp Ads
    description: Report conversions from Click-to-WhatsApp ads to Meta.
  - name: Analytics
    description: Template analytics and exports.
  - name: Media
    description: Upload media to use in messages and templates.
paths:
  /devapi/accounts/{accountId}/messages/whatsapp:
    post:
      tags:
        - Messages
      summary: Send a WhatsApp message
      description: >
        Sends one WhatsApp message: a session message (text, media, location,
        contacts or interactive) inside the

        24-hour customer service window, or an approved template at any time.


        This route queues the message and returns at once (`async`). Use
        `/messages/whatsapp/sync` to wait until the

        message is created and get its `id`. Track delivery with the
        `Message.WA.Status.Received` webhook or

        `GET /messages/{messageId}/status`.
      operationId: sendWhatsAppMessage
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/checkActiveSession'
        - $ref: '#/components/parameters/checkOptIn'
      requestBody:
        $ref: '#/components/requestBodies/SendWhatsAppMessage'
      responses:
        '202':
          $ref: '#/components/responses/MessageAccepted'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: >-
            Access denied.


            - **Plan:** the account's plan doesn't include sending messages
            through the API. Upgrade the plan to use this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                planFeature:
                  summary: Plan doesn't include the feature
                  value:
                    status: FORBIDDEN
                    message: Action not allowed - Please upgrade your plan
        '421':
          $ref: '#/components/responses/MisdirectedRequest'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/MessageRateLimited'
components:
  parameters:
    accountId:
      name: accountId
      in: path
      required: true
      description: Your Gallabox account ID. Must be the API key's own account.
      schema:
        $ref: '#/components/schemas/ObjectId'
    checkActiveSession:
      name: checkActiveSession
      in: query
      required: false
      description: >-
        Applies to non-template messages in `sync` mode only. When `true`, the
        request fails with `422` if more than 24 hours have passed since the
        contact last wrote to this number. Ignored in `async` mode.
      schema:
        type: boolean
    checkOptIn:
      name: checkOptIn
      in: query
      required: false
      description: >-
        Applies to template messages. When `true`, a template to a contact who
        has not opted in is refused: `sync` returns `421`; in `async` mode the
        message is not sent.
      schema:
        type: boolean
  requestBodies:
    SendWhatsAppMessage:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SendWhatsAppMessageRequest'
          examples:
            text:
              summary: Text message
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: text
                  text:
                    body: Your order has shipped.
            template:
              summary: Template with variables
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: template
                  template:
                    templateName: order_shipped
                    bodyValues:
                      name: Priya
                      order_id: '1042'
            templateWithMedia:
              summary: Template with an image header
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  phone: '919876543210'
                whatsapp:
                  type: template
                  template:
                    templateName: new_collection
                    headerValues:
                      mediaUrl: https://example.com/banner.jpg
                    bodyValues:
                      '1': Priya
            image:
              summary: Image with caption
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  phone: '919876543210'
                whatsapp:
                  type: image
                  image:
                    link: https://example.com/invoice.png
                    caption: Your invoice
            buttons:
              summary: Interactive reply buttons
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  phone: '919876543210'
                whatsapp:
                  type: interactive
                  interactive:
                    type: button
                    body:
                      text: Confirm your appointment for tomorrow at 10:00?
                    action:
                      buttons:
                        - type: reply
                          reply:
                            id: confirm
                            title: Confirm
                        - type: reply
                          reply:
                            id: reschedule
                            title: Reschedule
            video:
              summary: Video
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: video
                  video:
                    link: https://example.com/demo.mp4
                    caption: How to set up your device
            document:
              summary: Document (PDF)
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: document
                  document:
                    link: https://example.com/invoice-1042.pdf
                    filename: invoice-1042.pdf
                    caption: Your invoice
            audio:
              summary: Audio
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: audio
                  audio:
                    link: https://example.com/message.mp3
            sticker:
              summary: Sticker
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: sticker
                  sticker:
                    link: https://example.com/thanks.webp
            location:
              summary: Location
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: location
                  location:
                    latitude: 12.9716
                    longitude: 77.5946
                    name: Gallabox Store
                    address: MG Road, Bengaluru
            contactCard:
              summary: Contact card
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: contacts
                  contacts:
                    - name:
                        formatted_name: Gallabox Support
                        first_name: Gallabox
                      phones:
                        - phone: '+919000000000'
                          type: WORK
            list:
              summary: Interactive list
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: interactive
                  interactive:
                    type: list
                    body:
                      text: Choose a delivery slot
                    action:
                      button: View slots
                      sections:
                        - title: Tomorrow
                          rows:
                            - id: slot_am
                              title: 9 AM – 12 PM
                            - id: slot_pm
                              title: 2 PM – 6 PM
            ctaUrl:
              summary: Button with a URL
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: interactive
                  interactive:
                    type: cta_url
                    body:
                      text: Track your order
                    action:
                      name: cta_url
                      parameters:
                        display_text: Track order
                        url: https://example.com/track/1042
            product:
              summary: Single product
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: interactive
                  interactive:
                    type: product
                    body:
                      text: Back in stock
                    action:
                      catalog_id: '1234567890'
                      product_retailer_id: SKU-RED-M
            productList:
              summary: Multiple products
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: interactive
                  interactive:
                    type: product_list
                    header:
                      type: text
                      text: New arrivals
                    body:
                      text: Picked for you
                    action:
                      catalog_id: '1234567890'
                      sections:
                        - title: Shirts
                          product_items:
                            - product_retailer_id: SKU-RED-M
                            - product_retailer_id: SKU-BLU-M
            templateUrlButton:
              summary: Template with a dynamic URL button
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: template
                  template:
                    templateName: order_tracking
                    bodyValues:
                      order_id: '1042'
                    buttonValues:
                      - index: 0
                        sub_type: url
                        parameters:
                          type: text
                          text: '1042'
            templateCoupon:
              summary: Template with a coupon code
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                  tags:
                    - name: diwali-campaign
                whatsapp:
                  type: template
                  template:
                    templateName: festive_offer
                    bodyValues:
                      '1': Priya
                    buttonValues:
                      - index: 0
                        sub_type: copy_code
                        parameters:
                          type: coupon_code
                          coupon_code: DIWALI20
            templateAuthentication:
              summary: Authentication (OTP) template
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: template
                  template:
                    templateName: login_otp
                    bodyValues:
                      '1': '482913'
                    buttonValues:
                      - index: 0
                        sub_type: url
                        parameters:
                          type: text
                          text: '482913'
            templateFlow:
              summary: Template with a WhatsApp Flow button
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: template
                  template:
                    templateName: book_appointment
                    buttonValues:
                      - index: 0
                        sub_type: flow
                        parameters:
                          type: action
                          action:
                            flow_token: booking-1042
            templateCatalog:
              summary: Catalog template
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                whatsapp:
                  type: template
                  template:
                    templateName: browse_catalog
                    buttonValues:
                      - index: 0
                        sub_type: catalog
                        parameters:
                          type: action
                          action:
                            thumbnail_product_retailer_id: SKU-RED-M
            templateToBot:
              summary: Template whose reply goes to a bot
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                botId: 6650a1b2c3d4e5f6a7b8c9b1
                whatsapp:
                  type: template
                  template:
                    templateName: feedback_request
            templateReplyTo:
              summary: Template whose reply goes to a team
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                replyTo:
                  assigneeType: team
                  assigneeId: 6650a1b2c3d4e5f6a7b8c9c1
                whatsapp:
                  type: template
                  template:
                    templateName: callback_request
            notification:
              summary: Template sent as a notification
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                context:
                  type: notification
                whatsapp:
                  type: template
                  template:
                    templateName: payment_reminder
                    bodyValues:
                      amount: ₹1,250
            tagContact:
              summary: Tag the contact while sending
              value:
                channelId: 6650a1b2c3d4e5f6a7b8c9d0
                recipient:
                  name: Priya
                  phone: '919876543210'
                  tags:
                    - name: diwali-campaign
                whatsapp:
                  type: text
                  text:
                    body: Thanks for your order!
  responses:
    MessageAccepted:
      description: >
        The message was accepted. `sync` returns the Gallabox message `id`;
        `async` returns the `localMessageId` (yours,

        or one Gallabox generated). `warnings` lists anything in the request
        that was ignored.


        For WhatsApp, running out of message credits doesn't fail the request.
        The message is saved but not sent: its

        status becomes `error` with error code `1044` (`Insufficient message
        credits`). Check it with the message status

        endpoint.
      content:
        application/json:
          schema:
            type: object
            properties:
              id:
                $ref: '#/components/schemas/ObjectId'
              localMessageId:
                type: string
              status:
                type: string
                enum:
                  - ACCEPTED
              message:
                type: string
              warnings:
                type: array
                items: {}
          examples:
            sync:
              value:
                id: 6650a1b2c3d4e5f6a7b8c9d2
                status: ACCEPTED
                message: Message received and being sent to recipient
                warnings: []
            async:
              value:
                localMessageId: order-1042-confirmation
                status: ACCEPTED
                message: Message received and being sent to recipient
                warnings: []
    Unauthorized:
      description: >-
        The API key or secret is missing or wrong, or the key does not belong to
        `{accountId}`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: Unauthorized
            message: Unauthorized
    PaymentRequired:
      description: >
        The account is disconnected, usually because its plan has lapsed. Every
        API call returns this until the account

        is active again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: PAYMENT_REQUIRED
            message: Account is Disconnected
    MisdirectedRequest:
      description: >-
        The send was refused because of the contact's settings, for example
        `checkOptIn=true` and the contact has not opted in.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: MISDIRECTED_REQUEST
            message: The contact opted out of templates messages!
    UnprocessableEntity:
      description: Validation failed. `errors` names each invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    MessageRateLimited:
      description: >
        The account went over its plan's message-sending limit: 8, 16 or 5,000
        messages every 5 seconds. Wait for

        `Retry-After` seconds and try again.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: RequestLimitHit
            message: >-
              Messaging rate limit exceeded for your plan. Limit is 8 messages
              per 5s.
  schemas:
    Error:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          description: >-
            Error category, for example `ERROR`, `UNAUTHORIZED`,
            `PAYMENT_REQUIRED`, `RequestLimitHit`.
        message:
          type: string
          description: Human-readable description.
        error:
          description: >-
            Extra detail. For validation errors, a comma-separated summary of
            every field error.
    ObjectId:
      type: string
      pattern: ^[a-fA-F0-9]{24}$
      description: A 24-character hexadecimal ID.
      examples:
        - 6650a1b2c3d4e5f6a7b8c9d0
    SendWhatsAppMessageRequest:
      type: object
      required:
        - channelId
        - recipient
        - whatsapp
      properties:
        channelId:
          $ref: '#/components/schemas/ObjectId'
        recipient:
          $ref: '#/components/schemas/MessageRecipient'
        whatsapp:
          $ref: '#/components/schemas/OutgoingWhatsAppMessage'
        localMessageId:
          type: string
          description: >-
            Your own reference for this message, returned in async responses and
            webhooks.
        botId:
          $ref: '#/components/schemas/ObjectId'
          description: Hand the conversation to this bot; the contact's reply goes to it.
        context:
          $ref: '#/components/schemas/MessageContext'
        replyTo:
          $ref: '#/components/schemas/ReplyTo'
        retryConfig:
          type: object
          description: >-
            Retry the message if WhatsApp refuses it with error 131049 (Meta's
            per-user marketing limit) or a rate limit. `smart`: Gallabox picks
            retry times until `maxDate`. `manual`: retry at the times you list.
          properties:
            mode:
              type: string
              enum:
                - smart
                - manual
            smart:
              type: object
              properties:
                maxDate:
                  type: string
                  format: date-time
                  description: Stop retrying after this time.
            manual:
              type: object
              properties:
                timestamps:
                  type: array
                  items:
                    type: string
                    format: date-time
    ValidationError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            errors:
              type: array
              description: One object mapping each invalid field to its message.
              items:
                type: object
                additionalProperties:
                  type: string
      examples:
        - status: ERROR
          message: Invalid Input
          error: channelId is required
          errors:
            - channelId: channelId is required
    MessageRecipient:
      type: object
      description: >-
        Who to send to. Give `phone` or `identifier`. A new contact is created
        if none exists.
      properties:
        phone:
          type: string
          description: >-
            Phone number with country code, digits only, for example
            `919876543210`.
        identifier:
          type: string
          description: Phone number or WhatsApp BSUID (for example `IN.1234567890`).
        name:
          type: string
          description: Name for a new contact.
        tags:
          type: array
          description: Tags to add to the contact.
          items:
            $ref: '#/components/schemas/TagRef'
    OutgoingWhatsAppMessage:
      type: object
      required:
        - type
      description: Set `type` and the object of the same name.
      properties:
        type:
          type: string
          enum:
            - text
            - template
            - image
            - video
            - audio
            - document
            - sticker
            - location
            - contacts
            - interactive
        text:
          type: object
          required:
            - body
          properties:
            body:
              type: string
              maxLength: 4096
            preview_url:
              type: boolean
        template:
          $ref: '#/components/schemas/TemplateMessageValues'
        image:
          $ref: '#/components/schemas/MessageMedia'
        video:
          $ref: '#/components/schemas/MessageMedia'
        audio:
          $ref: '#/components/schemas/MessageMedia'
        document:
          $ref: '#/components/schemas/MessageMedia'
        sticker:
          $ref: '#/components/schemas/MessageMedia'
        location:
          type: object
          required:
            - latitude
            - longitude
          properties:
            latitude:
              type: number
            longitude:
              type: number
            name:
              type: string
            address:
              type: string
        contacts:
          type: array
          description: Contact cards, in WhatsApp's contacts format.
          items:
            type: object
        interactive:
          $ref: '#/components/schemas/InteractiveMessage'
    MessageContext:
      type: object
      properties:
        type:
          type: string
          enum:
            - notification
            - default
          description: >-
            `notification` doesn't open an inbox conversation, add to unread
            counts or notify agents; a conversation opens when the contact
            replies. `default` treats the message like one sent from the inbox.
            When you send neither `botId` nor a context type, the API uses
            `notification`.
    ReplyTo:
      type: object
      description: Who handles the contact's reply.
      properties:
        assigneeType:
          type: string
          enum:
            - bot
            - user
            - team
        assigneeId:
          $ref: '#/components/schemas/ObjectId'
    TagRef:
      type: object
      description: A tag by name. Created if it doesn't exist.
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 50
    TemplateMessageValues:
      type: object
      required:
        - templateName
      description: An approved template and the values for its variables.
      properties:
        templateName:
          type: string
        templateId:
          $ref: '#/components/schemas/ObjectId'
        headerValues:
          type: object
          properties:
            mediaUrl:
              type: string
              format: uri
              description: Public URL of the header image, video or document.
            mediaName:
              type: string
              description: File name shown for a document header.
            mediaUploadId:
              $ref: '#/components/schemas/ObjectId'
            textValues:
              type: object
              additionalProperties: true
        bodyValues:
          type: object
          additionalProperties: true
          description: >-
            Body variable values, keyed by variable name (named templates) or
            position ("1", "2"…).
        buttonValues:
          type: array
          items:
            type: object
            required:
              - index
              - sub_type
              - parameters
            properties:
              index:
                type: integer
              sub_type:
                type: string
                examples:
                  - url
                  - quick_reply
                  - copy_code
                  - flow
                  - catalog
                  - mpm
                  - order_details
              parameters:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - payload
                      - text
                      - action
                      - coupon_code
                  payload:
                    type: string
                  text:
                    type: string
                  coupon_code:
                    type: string
                  action:
                    type: object
                    description: >-
                      For `flow`, `catalog`, `mpm` and `order_details` buttons,
                      in WhatsApp's format (for example `flow_token`,
                      `thumbnail_product_retailer_id`).
        cardValues:
          type: array
          description: Values for each card of a carousel template.
          items:
            type: object
            properties:
              index:
                type: integer
              headerValues:
                type: object
                properties:
                  mediaUrl:
                    type: string
                  mediaUploadId:
                    $ref: '#/components/schemas/ObjectId'
              bodyValues:
                type: object
                additionalProperties: true
              buttonValues:
                type: array
                items:
                  type: object
    MessageMedia:
      type: object
      description: Send a public `link`, or the ID of media you uploaded.
      properties:
        link:
          type: string
          format: uri
        id:
          type: string
        caption:
          type: string
        filename:
          type: string
    InteractiveMessage:
      type: object
      required:
        - type
        - action
      properties:
        type:
          type: string
          enum:
            - button
            - list
            - cta_url
            - product
            - product_list
            - flow
            - address_message
            - order_details
            - order_status
            - location_request_message
            - call_permission_request
            - request_contact_info
            - voice_call
        header:
          type: object
          properties:
            type:
              type: string
              enum:
                - text
                - image
                - video
                - document
            text:
              type: string
            image:
              $ref: '#/components/schemas/MessageMedia'
            video:
              $ref: '#/components/schemas/MessageMedia'
            document:
              $ref: '#/components/schemas/MessageMedia'
        body:
          type: object
          properties:
            text:
              type: string
        footer:
          type: object
          properties:
            text:
              type: string
        action:
          type: object
          description: >-
            Depends on `type`: `buttons` for `button`; `button` plus `sections`
            for `list`; `catalog_id` plus `product_retailer_id` for `product`;
            `catalog_id` plus `sections[].product_items` for `product_list`;
            `name` plus `parameters` for `cta_url`, `flow`, `address_message`,
            `order_details` and similar.
          properties:
            buttons:
              type: array
              maxItems: 3
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - reply
                      - cta_url
                  reply:
                    type: object
                    properties:
                      id:
                        type: string
                      title:
                        type: string
                        maxLength: 20
            button:
              type: string
              description: Label of the button that opens a list.
            sections:
              type: array
              items:
                type: object
                properties:
                  title:
                    type: string
                  rows:
                    type: array
                    items:
                      type: object
                      required:
                        - id
                        - title
                      properties:
                        id:
                          type: string
                        title:
                          type: string
                        description:
                          type: string
                    description: For `list` messages.
                  product_items:
                    type: array
                    items:
                      type: object
                      required:
                        - product_retailer_id
                      properties:
                        product_retailer_id:
                          type: string
            name:
              type: string
              description: >-
                Action name for `cta_url`, `flow`, `address_message`,
                `order_details` and similar.
            parameters:
              type: object
              additionalProperties: true
              description: Action parameters, in WhatsApp's format for the action `name`.
            catalog_id:
              type: string
              description: Your Meta commerce catalog ID.
            product_retailer_id:
              type: string
              description: The product's retailer ID (SKU) in the catalog.
  headers:
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apiKey
      description: API key from Settings → API keys.
    apiSecret:
      type: apiKey
      in: header
      name: apiSecret
      description: Secret shown once when the API key is created.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.