> ## 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 (v2)

> Same as **Send a Template Message**, but the template values go straight into the body instead of inside `dynamicData`.

```json
{ "template": "60c7…", "phone": "+919876543210", "firstname": "Riya", "order_id": "1042" }
```

`template`, `phone` and `whatsapp` are reserved. Every other key is a template value:
- variables by name (case-insensitive), e.g. `{{1}}` → `"1"`, `{{firstname}}` → `"firstname"`;
- `header_handle`, `location`, `otpCode`, `coupon_code`, `expiration_time_ms`, `flow_action`, carousel `card_0_…` keys and the rest, exactly as in v1 `dynamicData`.

Variables you leave out are filled from the contact's attributes when they match. v1 keeps working unchanged.



## OpenAPI

````yaml POST /api/pub/v2/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/v2/wa/send/template:
    post:
      tags:
        - Messages
      summary: Send a Template Message (v2)
      description: >-
        Same as **Send a Template Message**, but the template values go straight
        into the body instead of inside `dynamicData`.


        ```json

        { "template": "60c7…", "phone": "+919876543210", "firstname": "Riya",
        "order_id": "1042" }

        ```


        `template`, `phone` and `whatsapp` are reserved. Every other key is a
        template value:

        - variables by name (case-insensitive), e.g. `{{1}}` → `"1"`,
        `{{firstname}}` → `"firstname"`;

        - `header_handle`, `location`, `otpCode`, `coupon_code`,
        `expiration_time_ms`, `flow_action`, carousel `card_0_…` keys and the
        rest, exactly as in v1 `dynamicData`.


        Variables you leave out are filled from the contact's attributes when
        they match. v1 keeps working unchanged.
      operationId: sendTemplateV2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendTemplateV2Request'
      responses:
        '200':
          description: Message successfully queued. The message object is returned.
          content:
            application/json:
              schema:
                $ref: 79c7b132-06c6-42d0-a056-34231219a2db
        '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:
    SendTemplateV2Request:
      type: object
      required:
        - template
        - phone
      properties:
        template:
          type: string
          description: The _id of the WhatsApp template to send.
          example: 60c72b2f9b1d8e001f8a1b2d
        phone:
          type: string
          description: The recipient's phone number with country code.
          example: '+919876543210'
        whatsapp:
          type: string
          description: >-
            The _id of the WhatsApp account to send from. Optional: defaults to
            the number the template belongs to.
      additionalProperties:
        description: >-
          Any other key is a template value, written at the top level of the
          body. Use the same keys as v1 `dynamicData`.
      example:
        template: 60c72b2f9b1d8e001f8a1b2d
        phone: '+919876543210'
        firstname: Riya
        order_id: '1042'
        header_handle: https://example.com/offer.jpg
    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.

````

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