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

# Get messages



## OpenAPI

````yaml https://megastream25-api.closebot.com/swagger/v1/swagger.json get /botMetric/messages
openapi: 3.0.1
info:
  title: CloseBot API
  version: v1
servers:
  - url: https://api.closebot.com
    description: CloseBot API Endpoint
security:
  - Key: []
paths:
  /botMetric/messages:
    get:
      tags:
        - BotMetric
      summary: Get messages
      parameters:
        - name: sourceId
          in: query
          description: Optional source ID.
          style: form
          schema:
            type: string
        - name: leadId
          in: query
          description: Optional lead ID.
          style: form
          schema:
            type: string
        - name: start
          in: query
          description: Optional start date.
          style: form
          schema:
            type: string
            format: date-time
        - name: end
          in: query
          description: Optional end date.
          style: form
          schema:
            type: string
            format: date-time
        - name: maxCount
          in: query
          description: Optional maximum number of messages to return.
          style: form
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BotMetricMessage'
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BotMetricMessage'
            text/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BotMetricMessage'
components:
  schemas:
    BotMetricMessage:
      type: object
      properties:
        messageId:
          type: string
          description: The unique ID of the message
          nullable: true
        sourceId:
          type: string
          description: The ID of the source
          nullable: true
        leadId:
          type: string
          description: The ID of the lead
          nullable: true
        botId:
          type: string
          description: The optional ID of the bot
          nullable: true
        personaId:
          type: string
          description: The optional ID of the persona
          nullable: true
        channel:
          type: string
          description: The optional channel of the message
          nullable: true
        fromBot:
          type: boolean
          description: Whether the message was sent from the bot
        direction:
          type: string
          description: The direction of the message (inbound or outbound)
          nullable: true
        message:
          type: string
          description: The content of the message
          nullable: true
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/BotMetricAttachment'
          description: The list of attachments associated with the message
          nullable: true
        timestamp:
          type: string
          description: The timestamp when the message was sent
          format: date-time
        activities:
          type: array
          items:
            $ref: '#/components/schemas/BotMetricActivity'
          description: The list of activities associated with the message
          nullable: true
      additionalProperties: false
    BotMetricAttachment:
      type: object
      properties:
        url:
          type: string
          description: The URL of the attachment
          nullable: true
      additionalProperties: false
    BotMetricActivity:
      type: object
      properties:
        activity:
          type: string
          nullable: true
        data:
          type: string
          nullable: true
        timeData:
          type: string
          format: date-time
          nullable: true
        faviconUrl:
          type: string
          nullable: true
      additionalProperties: false
  securitySchemes:
    Key:
      type: apiKey
      description: CloseBot API Key Authorization
      name: X-CB-KEY
      in: header

````