> ## 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.

# Get a Conversation

> A contact's WhatsApp messages, both ways, newest first: what the customer wrote and what the AI, your team, templates and campaigns sent. Use it to show the chat inside your CRM.



## OpenAPI

````yaml GET /api/pub/wa/messages
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/messages:
    get:
      tags:
        - Message
      summary: Get a Conversation
      description: >-
        A contact's WhatsApp messages, both ways, newest first: what the
        customer wrote and what the AI, your team, templates and campaigns sent.
        Use it to show the chat inside your CRM.
      operationId: getConversation
      parameters:
        - name: phone
          in: query
          required: true
          description: >-
            The contact's phone with country code. Spaces, + and dashes are
            ignored.
          schema:
            type: string
            example: '919876543210'
        - name: whatsapp
          in: query
          required: false
          description: >-
            Only messages on this WhatsApp number (its id from List WhatsApp
            Numbers). Leave out for all your numbers.
          schema:
            type: string
        - name: before
          in: query
          required: false
          description: >-
            Only messages before this time. Pass the last message's at to read
            older messages.
          schema:
            type: string
            format: date-time
        - name: limit
          in: query
          required: false
          description: How many messages, 1 to 200. Default 50.
          schema:
            type: integer
            example: 50
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/Conversation'
        '400':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrmError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            Your plan has no API access, has expired, or doesn't include
            WhatsApp.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrmError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrmError'
components:
  schemas:
    Conversation:
      type: object
      properties:
        contact:
          type: string
          example: '919876543210'
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ConversationMessage'
          description: Newest first.
        hasMore:
          type: boolean
          description: >-
            true when older messages exist: call again with before = the last
            message's at.
    CrmError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Contact not found
    ConversationMessage:
      type: object
      properties:
        id:
          type: string
          description: AdsEra message id.
        messageId:
          type: string
          description: WhatsApp's message id (wamid).
        whatsapp:
          type: string
          description: Id of your WhatsApp number that sent or received it.
        businessNumber:
          type: string
          example: '919800000000'
        direction:
          type: string
          enum:
            - inbound
            - outbound
          description: inbound = from the customer.
        sentBy:
          type: string
          example: AI
          description: >-
            Customer, AI, Team, Team (WhatsApp app), Broadcast (bulk campaign)
            or Automation (sequence).
        type:
          type: string
          example: text
        status:
          type: string
          example: read
          description: sent, delivered, read, failed…
        preview:
          type: string
          example: Hi Priya, your demo is at 4 pm today.
          description: >-
            The message as readable text. Templates come with their values
            filled in; media shows as [Image: caption].
        at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        status:
          type: integer
          example: 500
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Internal Server Error!
  responses:
    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.'
  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.