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

# Send WhatsApp Template

> Queues a pre-approved WhatsApp template message for sending to a contact.



## OpenAPI

````yaml POST /api/pub/wa/send/template
openapi: 3.1.0
info:
  title: AdsEra REST API
  description: >-
    Welcome to the AdsEra REST API. Use our API to integrate powerful,
    multi-channel communication (Email and WhatsApp) directly into your
    applications. Automate transactional messages, trigger marketing campaigns,
    manage your audience, and track performance programmatically.
  contact:
    name: Shubham
    email: shubham@adsera.in
  version: 1.0.0
servers:
  - url: https://app.adsera.in
    description: Production Server
security:
  - AppIdAuth: []
    AppSecretAuth: []
paths:
  /api/pub/wa/send/template:
    post:
      tags:
        - Messages
      summary: Send a Template Message
      description: >-
        Queues a pre-approved WhatsApp template message for sending to a
        contact.
      requestBody:
        description: Message payload
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTemplateRequest'
      responses:
        '200':
          description: Message successfully queued. The message object is returned.
          content:
            application/json:
              schema:
                $ref: e9ad6a12-77cd-45ff-8e69-0744e0505912
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - AppIdAuth: []
          AppSecretAuth: []
components:
  schemas:
    SendTemplateRequest:
      type: object
      properties:
        template:
          type: string
          description: The _id of the WhatsAppTemplate to send.
          example: 60c72b2f9b1d8e001f8a1b2d
        whatsapp:
          type: string
          description: The _id of the WhatsApp account to send from.
          example: 60c72b2f9b1d8e001f8a1b2c
        phone:
          type: string
          description: The recipient's phone number in E.164 format.
          example: '+911234567890'
        dynamicData:
          type: object
          description: Key-value pairs for dynamic template variables.
          additionalProperties: true
          example:
            otpCode: required in AUTHENTICATION Template
            FIRSTNAME: Guest
            order_id: '12345'
            header_handle: MEDIA public url according to header type
            location:
              latitude: 40.741895
              longitude: -73.989308
              name: location name
              address: location address
            coupon_code: required in COPY_CODE Buttons
      required:
        - template
        - whatsapp
        - phone
    ErrorResponse:
      type: object
      properties:
        status:
          type: integer
          example: 500
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Internal Server Error!
  responses:
    BadRequest:
      description: >-
        Bad Request. A required field is missing or an item is in an invalid
        state.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            MissingTemplate:
              value:
                status: 400
                success: false
                error: Template id not provided!
            TemplateNotApproved:
              value:
                status: 400
                success: false
                error: Template is not approved!
            WabaNotConnected:
              value:
                status: 400
                success: false
                error: WhatsApp Account Not Connected or Exist!
    Unauthorized:
      description: Unauthorized. The API keys are missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 401
            success: false
            error: 'Unauthorized: Please provide valid API credentials.'
    NotFound:
      description: >-
        Not Found. The requested resource (template, contact) could not be
        found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 404
            success: false
            error: Template not found!
    InternalServerError:
      description: Internal Server Error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    AppIdAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your application's unique ID.
    AppSecretAuth:
      type: apiKey
      in: header
      name: x-api-secret
      description: Your application's secret key.

````