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

# Send a WhatsApp template message

> Queues a template message on one of your WhatsApp connections and returns immediately with a `log_id`. Delivery is asynchronous — track it through your provider's delivery webhooks.

Which fields are required depends on the connection: AiSensy Campaign connections need `campaign_name`; every other connection needs `template_name` and `language_code`.

`to` is parsed, not pattern-matched, and carries no default country — it must include its own country code.



## OpenAPI

````yaml /openapi.json post /messaging/send
openapi: 3.1.0
info:
  title: Vocobase API
  version: '2.0'
  description: >-
    API for managing voice AI agents, documents, and calls on the Vocobase
    platform.
servers:
  - url: https://api.vocobase.com/api/v2
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Config
    description: >-
      Read and update account configuration, webhook settings, and telephony
      credentials.
  - name: Agents
    description: Create, read, update, and delete voice AI agents.
  - name: Voices
    description: >-
      List voice tiers, available voices, and stream preview audio for agent
      configuration.
  - name: Documents
    description: Upload, manage, and delete knowledge base documents.
  - name: Agent Documents
    description: Link and unlink documents to agents for knowledge base integration.
  - name: Calls
    description: Initiate outbound calls and view call history.
  - name: Phone Numbers
    description: >-
      Import DIDs, assign agents for inbound routing, and re-sync carrier
      Application bindings.
  - name: Inbound Routing Policies
    description: >-
      Define pre-answer routing decisions for inbound calls before AI sessions
      are created.
  - name: Telephony Connections
    description: Create, list, rename, and disconnect named V2 telephony connections.
  - name: VoiceLink Management
    description: Manage VoiceLink reseller clients, DID mapping, and readiness sync.
  - name: Projects
    description: Organize agents into projects. Every agent belongs to exactly one project.
  - name: Dictionaries
    description: Speech-recognition dictionary CRUD and agent attachment.
  - name: Sessions
    description: Browser-initiated WebRTC voice sessions for in-app voice agents.
  - name: Campaigns
    description: Batch outbound calling.
  - name: Billing
    description: Balance, transactions, and usage summaries.
  - name: Custom Functions
    description: HTTP endpoints the agent can call mid-conversation.
  - name: Extraction Sets
    description: Reusable sets of post-call extraction fields.
  - name: Lifecycle Hooks
    description: Automatic pre-call and post-call integration steps.
  - name: Messaging
    description: Bring-your-own WhatsApp sending.
  - name: Integration Logs
    description: Audit trail for integration calls.
  - name: Connectors
    description: Catalog of tools an agent can be connected to.
  - name: Customers
    description: B2B2B sub-tenants and their tool connections.
  - name: Agent Tools
    description: Binding connectors and connections to an agent.
paths:
  /messaging/send:
    post:
      tags:
        - Messaging
      summary: Send a WhatsApp template message
      description: >-
        Queues a template message on one of your WhatsApp connections and
        returns immediately with a `log_id`. Delivery is asynchronous — track it
        through your provider's delivery webhooks.


        Which fields are required depends on the connection: AiSensy Campaign
        connections need `campaign_name`; every other connection needs
        `template_name` and `language_code`.


        `to` is parsed, not pattern-matched, and carries no default country — it
        must include its own country code.
      operationId: sendWhatsappMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - connection_id
                - to
              properties:
                connection_id:
                  type: string
                  format: uuid
                to:
                  type: string
                  description: Destination in E.164, including the country code.
                campaign_name:
                  type: string
                  description: Required for AiSensy Campaign connections.
                template_name:
                  type: string
                  description: Required for all other connections.
                language_code:
                  type: string
                  description: Required with `template_name`, e.g. `en`.
                variables:
                  type: array
                  items:
                    type: string
                  description: Template body variables, in order.
                header_values:
                  type: array
                  items:
                    type: string
                  description: Template header variables, in order.
            example:
              connection_id: mc_4d5e6f70-8192-a3b4-c5d6-e7f809122334
              to: '+919876543210'
              campaign_name: renewal_followup
              variables:
                - Asha
                - 1 September
      responses:
        '202':
          description: Queued for delivery.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    type: object
                    properties:
                      log_id:
                        type: string
                        format: uuid
                        description: Use it to correlate provider delivery webhooks.
                      status:
                        type: string
                        const: QUEUED
              example:
                success: true
                data:
                  log_id: ml_5e6f7081-92a3-b4c5-d6e7-f80912233445
                  status: QUEUED
        '400':
          description: >-
            `VALIDATION_ERROR` for a missing or malformed field.
            `CONNECTION_INACTIVE` when the connection has not been verified.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: CONNECTION_INACTIVE
                  message: connection is not ACTIVE
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - success
        - error
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Invalid or missing API key
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: NOT_FOUND
              message: Resource not found
    RateLimitExceeded:
      description: Per-account rate limit exceeded. Retry after a short backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: RATE_LIMITED
              message: Rate limit exceeded. Retry after 60 seconds.
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: INTERNAL_ERROR
              message: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key in format: `rg_live_xxxx`. Pass as a Bearer token in the
        Authorization header.

````