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

# Get messages by conversation id

> Get messages by conversation id.



## OpenAPI

````yaml /api-reference/conversations/openapi.json get /conversations/{conversationId}/messages
openapi: 3.0.0
info:
  title: Conversations API
  description: Documentation for Conversations API
  version: '1.0'
  contact: {}
servers:
  - url: https://services.leadconnectorhq.com
security: []
tags:
  - name: Conversations
    description: Documentation for Conversations API
  - name: Search
    description: Documentation for Conversations API
  - name: Email
    description: Documentation for Conversations API
  - name: Messages
    description: Documentation for Conversations API
  - name: Providers
    description: Documentation for Conversations API
paths:
  /conversations/{conversationId}/messages:
    get:
      tags:
        - Messages
      summary: Get messages by conversation id
      description: Get messages by conversation id.
      operationId: get-messages
      parameters:
        - name: Version
          in: header
          description: API Version
          required: true
          schema:
            type: string
            enum:
              - '2021-04-15'
        - name: conversationId
          required: true
          in: path
          description: Conversation ID as string
          schema:
            example: tDtDnQdgm2LXpyiqYvZ6
            type: string
        - name: lastMessageId
          required: false
          in: query
          description: Message ID of the last message in the list as a string
          schema:
            example: tDtDnQdgm2LXpyiqYvZ6
            type: string
        - name: limit
          required: false
          in: query
          description: >-
            Number of messages to be fetched from the conversation. Default
            limit is 20
          schema:
            example: 20
            type: number
        - name: type
          required: false
          in: query
          description: Types of message to fetched separated with comma
          schema:
            example: TYPE_SMS,TYPE_CALL
            enum:
              - TYPE_CALL
              - TYPE_SMS
              - TYPE_EMAIL
              - TYPE_FACEBOOK
              - TYPE_GMB
              - TYPE_INSTAGRAM
              - TYPE_WHATSAPP
              - TYPE_ACTIVITY_APPOINTMENT
              - TYPE_ACTIVITY_CONTACT
              - TYPE_ACTIVITY_INVOICE
              - TYPE_ACTIVITY_PAYMENT
              - TYPE_ACTIVITY_OPPORTUNITY
              - TYPE_LIVE_CHAT
              - TYPE_INTERNAL_COMMENTS
              - TYPE_ACTIVITY_EMPLOYEE_ACTION_LOG
            type: string
      responses:
        '200':
          description: List of messages for the conversation id of the given type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessagesByConversationResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedDTO'
      security:
        - bearer:
            - conversations/message.readonly
components:
  schemas:
    GetMessagesByConversationResponseDto:
      type: object
      properties:
        messages:
          type: object
          properties:
            lastMessageId:
              type: string
              description: Id of the last message in the messages array
              example: p1mRSHeLDhAms5q0LMr4
            nextPage:
              type: boolean
              description: >-
                Next page value true indicates only 20 message is in the
                response. Rest of the messages are in the next page. Please use
                the lastMessageId value in the query to get the next page
                messages
              example: true
            messages:
              description: Array of messages
              type: array
              items:
                $ref: '#/components/schemas/GetMessageResponseDto'
          required:
            - lastMessageId
            - nextPage
            - messages
      required:
        - messages
    BadRequestDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        message:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
    UnauthorizedDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        message:
          type: string
          example: 'Invalid token: access token is invalid'
        error:
          type: string
          example: Unauthorized
      required:
        - statusCode
        - message
        - error
    GetMessageResponseDto:
      type: object
      properties:
        id:
          type: string
          example: ve9EPM428h8vShlRW1KT
        altId:
          type: string
          description: Alternative identifier for the message
          example: msg_123456789
        type:
          type: number
          example: 1
        messageType:
          type: string
          description: Type of the message as a string
          example: SMS
          enum:
            - TYPE_CALL
            - TYPE_SMS
            - TYPE_EMAIL
            - TYPE_SMS_REVIEW_REQUEST
            - TYPE_WEBCHAT
            - TYPE_SMS_NO_SHOW_REQUEST
            - TYPE_CAMPAIGN_SMS
            - TYPE_CAMPAIGN_CALL
            - TYPE_CAMPAIGN_EMAIL
            - TYPE_CAMPAIGN_VOICEMAIL
            - TYPE_FACEBOOK
            - TYPE_CAMPAIGN_FACEBOOK
            - TYPE_CAMPAIGN_MANUAL_CALL
            - TYPE_CAMPAIGN_MANUAL_SMS
            - TYPE_GMB
            - TYPE_CAMPAIGN_GMB
            - TYPE_REVIEW
            - TYPE_INSTAGRAM
            - TYPE_WHATSAPP
            - TYPE_CUSTOM_SMS
            - TYPE_CUSTOM_EMAIL
            - TYPE_CUSTOM_PROVIDER_SMS
            - TYPE_CUSTOM_PROVIDER_EMAIL
            - TYPE_IVR_CALL
            - TYPE_ACTIVITY_CONTACT
            - TYPE_ACTIVITY_INVOICE
            - TYPE_ACTIVITY_PAYMENT
            - TYPE_ACTIVITY_OPPORTUNITY
            - TYPE_LIVE_CHAT
            - TYPE_LIVE_CHAT_INFO_MESSAGE
            - TYPE_ACTIVITY_APPOINTMENT
            - TYPE_FACEBOOK_COMMENT
            - TYPE_INSTAGRAM_COMMENT
            - TYPE_CUSTOM_CALL
            - TYPE_INTERNAL_COMMENT
            - TYPE_ACTIVITY_EMPLOYEE_ACTION_LOG
        locationId:
          type: string
          example: ve9EPM428h8vShlRW1KT
        contactId:
          type: string
          example: ve9EPM428h8vShlRW1KT
        conversationId:
          type: string
          example: ve9EPM428h8vShlRW1KT
        dateAdded:
          type: string
          example: '2024-03-27T18:13:49.000Z'
        body:
          type: string
          example: Hi there
        direction:
          type: string
          enum:
            - inbound
            - outbound
        status:
          type: string
          enum:
            - connected
            - delivered
            - failed
            - opened
            - pending
            - read
            - scheduled
            - sent
            - undelivered
            - clicked
            - opt_out
        contentType:
          type: string
          example: text/plain
        attachments:
          description: >-
            An array of attachment URLs. Attachments will be empty for Call and
            Voicemails, type 1 and 10. Please use get call recording API to
            fetch call recording and voicemails.
          type: array
          items:
            type: string
        meta:
          $ref: '#/components/schemas/MessageMeta'
        source:
          type: string
          enum:
            - workflow
            - bulk_actions
            - campaign
            - api
            - app
          description: Message source
        userId:
          type: string
          description: User Id
          example: ve9EPM428kjkvShlRW1KT
        conversationProviderId:
          type: string
          description: Conversation Provider Id
          example: ve9EPM428kjkvShlRW1KT
        chatWidgetId:
          type: string
          description: Chat Widget Id
          example: 67b0cc8cf14b19d85ace7s35
      required:
        - id
        - type
        - messageType
        - locationId
        - contactId
        - conversationId
        - dateAdded
        - direction
        - contentType
    MessageMeta:
      type: object
      properties:
        callDuration:
          type: string
          description: Call duration in seconds
          example: 120
        callStatus:
          type: string
          description: >-
            Call status - can be pending, completed, answered, busy, no-answer,
            failed, canceled, or voicemail
          example: completed
          enum:
            - pending
            - completed
            - answered
            - busy
            - no-answer
            - failed
            - canceled
            - voicemail
        email:
          type: object
          description: >-
            meta will contain email, for message type 3 (email). messageIds is
            list of all email message ids under the message thread
          example:
            email:
              messageIds:
                - ve9EPM428kjkvShlRW1KT
                - ve9EPs1028kjkvShlRW1KT
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Use the Access Token generated with user type as Sub-Account (OR)
        Private Integration Token of Sub-Account.
      type: http

````