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

# Send a marketing message

> Send a WhatsApp marketing template message.

Use `to` for phone numbers. Use `recipient` for a BSUID or parent BSUID.
If both are present, the phone number in `to` takes precedence.




## OpenAPI

````yaml /api/meta/whatsapp/openapi-whatsapp.yaml post /{phone_number_id}/marketing_messages
openapi: 3.1.0
info:
  title: Kapso Meta Proxy API
  version: 1.0.0
  description: >
    Kapso's Meta Proxy API provides a unified interface to WhatsApp Business
    Platform with enhanced features and Kapso-specific extensions.


    This API acts as a proxy layer between your application and WhatsApp,
    adding:

    - Simplified authentication with project-level API keys

    - Enhanced message metadata and tracking

    - Conversation management capabilities

    - Voice call integration

    - Extended contact and template management


    ## Base URL


    All API requests are made to: `https://api.kapso.ai/meta/whatsapp/v24.0`


    ## Authentication


    The API supports authentication via **X-API-Key header** (recommended):


    ```

    X-API-Key: your_project_api_key

    ```


    Alternative: Bearer token authentication is also supported for backward
    compatibility:


    ```

    Authorization: Bearer your_access_token

    ```


    Note: X-API-Key is the recommended authentication method for the Meta Proxy
    API.
  contact:
    name: Kapso Support
    url: https://kapso.ai
    email: dev@kap.so
servers:
  - url: https://api.kapso.ai/meta/whatsapp/v24.0
    description: Production server
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Messages
    description: Send and retrieve WhatsApp messages
  - name: Conversations
    description: Manage WhatsApp conversations
  - name: Contacts
    description: Manage WhatsApp contacts
  - name: Templates
    description: Manage message templates
  - name: Media
    description: Upload and retrieve media files
  - name: Calls
    description: Manage voice calls
  - name: Settings
    description: Account settings and configuration
  - name: Business Profile
    description: Business profile management
  - name: Phone Numbers
    description: Phone number management
  - name: Flows
    description: WhatsApp Flow management (Beta)
  - name: Block Users
    description: Block and unblock WhatsApp users
  - name: Usernames
    description: Reserve and manage WhatsApp business usernames
paths:
  /{phone_number_id}/marketing_messages:
    parameters:
      - name: phone_number_id
        in: path
        required: true
        description: WhatsApp Business Phone Number ID
        schema:
          type: string
        example: '110987654321'
    post:
      tags:
        - Messages
      summary: Send a marketing message
      description: |
        Send a WhatsApp marketing template message.

        Use `to` for phone numbers. Use `recipient` for a BSUID or parent BSUID.
        If both are present, the phone number in `to` takes precedence.
      operationId: sendMarketingMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MarketingMessage'
            examples:
              marketing_template_to_bsuid:
                summary: Send marketing template to BSUID
                value:
                  messaging_product: whatsapp
                  recipient_type: individual
                  recipient: US.13491208655302741918
                  type: template
                  template:
                    name: promo_template
                    language:
                      code: en_US
      responses:
        '200':
          description: Message accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponse'
              examples:
                bsuid_success:
                  summary: Successful BSUID send
                  value:
                    messaging_product: whatsapp
                    contacts:
                      - input: US.13491208655302741918
                        user_id: US.13491208655302741918
                    messages:
                      - id: >-
                          wamid.HBgNMTU1NTE0OTU5Nzg1FQIAERgSMDhGRjdCMDEyOTcxQzFFQkFBAA==
                        message_status: accepted
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    MarketingMessage:
      type: object
      required:
        - messaging_product
        - type
        - template
      anyOf:
        - required:
            - to
        - required:
            - recipient
      properties:
        messaging_product:
          type: string
          enum:
            - whatsapp
          description: Always "whatsapp"
          example: whatsapp
        recipient_type:
          type: string
          enum:
            - individual
          default: individual
          description: Marketing messages are sent to individual recipients.
        biz_opaque_callback_data:
          type: string
          maxLength: 512
          description: Arbitrary string for tracking (echoed in webhooks)
        to:
          type: string
          description: Recipient phone number. Use `recipient` for BSUID sends.
          example: '15551234567'
        recipient:
          type: string
          description: >-
            Recipient BSUID or parent BSUID. If `to` is also present, the phone
            number in `to` takes precedence.
          example: US.13491208655302741918
        type:
          type: string
          enum:
            - template
          description: Marketing messages must use a WhatsApp template.
          example: template
        template:
          $ref: '#/components/schemas/TemplateMessage'
    SendMessageResponse:
      type: object
      required:
        - messaging_product
        - contacts
        - messages
      properties:
        messaging_product:
          type: string
          enum:
            - whatsapp
          example: whatsapp
        contacts:
          type: array
          items:
            type: object
            properties:
              input:
                type: string
                description: Input phone number, BSUID, or parent BSUID
                example: '15551234567'
              wa_id:
                type: string
                nullable: true
                description: >-
                  WhatsApp phone number when the message was sent to a phone
                  number
                example: '15551234567'
              user_id:
                type: string
                nullable: true
                description: BSUID or parent BSUID when the message was sent to `recipient`
                example: US.13491208655302741918
        messages:
          type: array
          items:
            type: object
            required:
              - id
            properties:
              id:
                type: string
                description: Message ID
                example: wamid.HBgNMTU1NTE0OTU5Nzg1FQIAERgSMDhGRjdBMDEyOTcxQzFFQkFBAA==
              message_status:
                type: string
                enum:
                  - accepted
                  - held_for_quality_assessment
                description: Message pacing status when applicable
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
            - code
          properties:
            message:
              type: string
              description: Human-readable error message
              example: Invalid phone number format
            type:
              type: string
              description: Error category
              example: OAuthException
            code:
              type: integer
              description: Error code
              example: 400
            error_subcode:
              type: integer
              description: More specific error code
              example: 1001
            fbtrace_id:
              type: string
              description: Facebook trace ID for debugging
              example: AXk7s_8dR4eVHp9Kq2MmNlO
    TemplateMessage:
      type: object
      required:
        - name
        - language
      properties:
        name:
          type: string
          description: Template name
          example: hello_world
        language:
          type: object
          required:
            - code
          properties:
            code:
              type: string
              description: Language code
              example: en_US
        components:
          type: array
          description: Template components with parameters
          items:
            type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        Project API key for authentication. This is the recommended
        authentication method.


        Get your API key from the Kapso dashboard under Integrations > API keys.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Bearer token authentication (alternative method).

        Note: X-API-Key authentication is recommended for the Meta Proxy API.

````