> ## 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 Generic Message

> Sends a generic message (text, media, etc.) to a contact. Note: This kind of message can only be sent within the 24-hour open window.



## OpenAPI

````yaml POST /api/pub/wa/send/msg
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/msg:
    post:
      tags:
        - Messages
      summary: Send a Generic Message
      description: >-
        Sends a generic message (text, media, etc.) to a contact. Note: This
        kind of message can only be sent within the 24-hour open window.
      requestBody:
        description: Generic message payload
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMsgRequest'
      responses:
        '200':
          description: Message successfully queued.
          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:
    SendMsgRequest:
      type: object
      properties:
        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'
        msg:
          type: object
          description: The message content.
          properties:
            messageType:
              type: string
              enum:
                - text
                - image
                - video
                - audio
                - document
                - interactive
                - contacts
                - location
              description: The type of message to send.
            text:
              type: object
              properties:
                body:
                  type: string
                preview_url:
                  type: boolean
            image:
              type: object
              properties:
                link:
                  type: string
                caption:
                  type: string
            video:
              type: object
              properties:
                link:
                  type: string
                caption:
                  type: string
            audio:
              type: object
              properties:
                link:
                  type: string
            document:
              type: object
              properties:
                link:
                  type: string
                caption:
                  type: string
                filename:
                  type: string
            location:
              $ref: '#/components/schemas/Location'
            contacts:
              type: array
              items:
                $ref: '#/components/schemas/Contact'
            interactive:
              $ref: '#/components/schemas/Interactive'
          example: 200
      required:
        - whatsapp
        - phone
        - msg
    Location:
      type: object
      description: Location message payload.
      properties:
        longitude:
          type: number
          description: Longitude in degrees.
        latitude:
          type: number
          description: Latitude in degrees.
        name:
          type: string
          description: Name of the location.
        address:
          type: string
          description: Address of the location.
      required:
        - longitude
        - latitude
    Contact:
      type: object
      description: Contact card payload.
      properties:
        addresses:
          type: array
          items:
            type: object
            properties:
              street:
                type: string
              city:
                type: string
              state:
                type: string
              zip:
                type: string
              country:
                type: string
              country_code:
                type: string
              type:
                type: string
        birthday:
          type: string
          description: YYYY-MM-DD
        name:
          type: object
          properties:
            formatted_name:
              type: string
            first_name:
              type: string
            last_name:
              type: string
            middle_name:
              type: string
            suffix:
              type: string
            prefix:
              type: string
          required:
            - formatted_name
        phones:
          type: array
          items:
            type: object
            properties:
              phone:
                type: string
              type:
                type: string
              wa_id:
                type: string
        emails:
          type: array
          items:
            type: object
            properties:
              email:
                type: string
              type:
                type: string
        org:
          type: object
          properties:
            company:
              type: string
            department:
              type: string
            title:
              type: string
        urls:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              type:
                type: string
      required:
        - name
    Interactive:
      type: object
      description: Interactive message payload.
      properties:
        type:
          type: string
          enum:
            - button
            - list
            - product
            - product_list
            - catalog_message
            - flow
            - voice_call
        header:
          type: object
          properties:
            type:
              type: string
              enum:
                - text
                - video
                - image
                - document
            text:
              type: string
              maxLength: 60
            video:
              type: object
              properties:
                link:
                  type: string
                caption:
                  type: string
            image:
              type: object
              properties:
                link:
                  type: string
                caption:
                  type: string
            document:
              type: object
              properties:
                link:
                  type: string
                caption:
                  type: string
                filename:
                  type: string
        body:
          type: object
          properties:
            text:
              type: string
              maxLength: 1024
        footer:
          type: object
          properties:
            text:
              type: string
              maxLength: 60
        action:
          type: object
          properties:
            buttons:
              type: array
              maxItems: 3
              items:
                type: object
                properties:
                  type: reply
                  reply:
                    type: object
                    properties:
                      title:
                        type: string
                        maxLength: 20
                      id:
                        type: string
                        maxLength: 256
                    required:
                      - title
                      - id
                required:
                  - type
                  - reply
            button:
              type: string
              maxLength: 20
            sections:
              type: array
              minItems: 1
              maxItems: 10
              items:
                type: object
                properties:
                  title:
                    type: string
                    maxLength: 24
                  rows:
                    type: array
                    maxItems: 10
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          maxLength: 200
                        title:
                          type: string
                          maxLength: 24
                        description:
                          type: string
                          maxLength: 72
                      required:
                        - id
                        - title
                  product_items:
                    type: array
                    maxItems: 30
                    items:
                      type: object
                      properties:
                        product_retailer_id:
                          type: string
                      required:
                        - product_retailer_id
            catalog_id:
              type: string
            product_retailer_id:
              type: string
            name:
              type: string
            parameters:
              type: object
      required:
        - type
        - action
    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.

````