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

# Send Template Message

> Send an approved WhatsApp template message. Use this to message users outside the 24-hour customer service window.



## OpenAPI

````yaml POST /messages/send-template
openapi: 3.1.0
info:
  title: bitbybit Messaging API
  description: Send and manage WhatsApp messages through the bitbybit Open API.
  version: 1.0.0
  contact:
    name: bitbybit Support
    url: https://bitbybit.studio
servers:
  - url: https://api.bitbybit.studio/whatsapp/open/v1
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /messages/send-template:
    post:
      tags:
        - Messages
      summary: Send a template message
      description: >-
        Send an approved WhatsApp template message. Use this to message users
        outside the 24-hour customer service window.
      operationId: sendTemplateMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - to
                - template_name
                - template_source
              properties:
                to:
                  type: string
                  description: Destination phone number
                  example: '6281234567890'
                template_name:
                  type: string
                  description: Name of the approved WhatsApp template
                  example: welcome_message
                template_source:
                  type: string
                  enum:
                    - CRM
                    - AUTH
                  description: Template source — CRM for business templates, AUTH for OTP
                sources:
                  type: string
                  enum:
                    - whatsapp cloud api
                    - whatsapp coex
                  description: Messaging channel to use
                params:
                  type: array
                  items:
                    type: string
                  description: Dynamic parameters to insert into the template placeholders
                  example:
                    - John
                    - Order123
                    - '2024-01-01'
                mediaUrl:
                  type: string
                  description: >-
                    Custom media URL for media templates — overrides the
                    template default
                ignoreActiveTicket:
                  type: boolean
                  default: false
                  description: >-
                    If true, skip sending when the chat is actively handled by
                    an agent
                countryCode:
                  type: string
                  nullable: true
                  description: Country code for number formatting
                  example: ID
      responses:
        '200':
          description: Template message sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      messageId2:
                        type: string
                      timestamp:
                        type: string
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: VALIDATION_ERROR
              message: Invalid request body
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_API_KEY
              message: Invalid or expired API key
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INSUFFICIENT_SCOPE
              message: API key does not have the required scope
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: RATE_LIMIT_EXCEEDED
              message: Too many requests. Please retry after the reset period.
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication. Create one in Settings > Developer.

````