# Get Messages

`GET /messages`

> This is a subset of the full specification, limited to the `GET /messages` operation.
>
> You can find the full specification here: /_bundle/docs/guides/fin-custom-helpdesk/api.yaml

```yaml
openapi: 3.0.3
info:
  version: 0.0.1
  title: Fin Custom Helpdesk API
  description: This is a subset of the full specification, limited to the `GET /messages` operation.
  contact:
    name: Intercom Developer Support
    url: https://developers.intercom.com
  x-logo:
    url: https://www.intercom.com/favicon.ico
servers:
  - url: https://helpdesk.example.com/api/fin
    description: Your Custom Helpdesk API (replace with your actual domain)
security:
  - BearerAuth: []
tags:
  - name: Messages
    description: Manage messages within conversations
paths:
  /messages:
    get:
      tags:
        - Messages
      summary: Get Messages
      description: |
        Called during synchronization to pull in the messages from the conversation in your system.
        Messages which have already been synchronized will be ignored. New messages will be pulled into Fin’s version of the Conversation.
      operationId: getMessages
      parameters:
        - name: conversation_id
          description: The ID of the conversation in your system.
          in: query
          schema:
            type: string
        - name: after_id
          description: ID of the last seen message ID from the external system. As an optimization, the external service may choose to return only messages created after this.
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Messages retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Message'
              examples:
                example1:
                  summary: Multiple messages
                  value:
                    - id: msg_101
                      conversation_id: conv_456
                      message_type: comment
                      body: <p>Thank you for reaching out! I'd be happy to help.</p>
                      author:
                        id: agent_fin
                        user_type: agent
                        name: Fin AI Assistant
                        email: fin@company.com
                        alias: Fin
                        photo_url: https://example.com/avatars/fin.png
                      visibility: public
                      created_at: '2025-10-27T14:35:00.000Z'
                      attachments: []
                    - id: msg_102
                      conversation_id: conv_456
                      message_type: comment
                      body: <p>Great! Can you tell me about the Enterprise plan?</p>
                      author:
                        id: user_123
                        user_type: end_user
                        name: Jane Doe
                        email: jane@example.com
                        photo_url: https://example.com/avatars/jane.jpg
                        attributes:
                          attribute_1_name: attribute_1_value
                          attribute_2_name: attribute_2_value
                      visibility: public
                      created_at: '2025-10-27T14:37:00.000Z'
                      attachments: []
components:
  securitySchemes:
    BearerAuth:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://helpdesk.fin.com/api/auth/oauth/token
          scopes:
            read: Read access to the API (example)
            write: Write access to the API (example)
      description: OAuth2 access token configured in Fin Deployment UI
  schemas:
    EndUser:
      type: object
      description: |
        End user having a conversation with Fin or with an agent.
      required:
        - id
        - user_type
      properties:
        id:
          type: string
          description: Unique identifier for the user in your system
          example: user_123456
          nullable: false
        user_type:
          type: string
          description: Type of user
          enum:
            - end_user
          nullable: false
        name:
          type: string
          description: User's display name
          example: Jane Doe
          nullable: true
        email:
          type: string
          format: email
          description: User's email address
          example: jane.doe@example.com
          nullable: true
        photo_url:
          type: string
          format: uri
          description: URL to user's avatar/profile picture (displayed in Fin Messenger)
          example: https://example.com/avatars/jane.jpg
          nullable: true
        attributes:
          type: object
          description: Attributes associated with the end-user
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: number
              - type: boolean
              - type: string
                format: date-time
                description: ISO 8601 timestamp
                example: '2025-10-27T14:30:00.000Z'
          example:
            plan_type: enterprise
            signup_date: '2024-01-15'
            is_premium: true
          nullable: true
    Agent:
      type: object
      description: |
        Agent having a conversation with an end-user.
      properties:
        id:
          type: string
          description: Unique identifier for the user in your system
          example: agent_123456
        user_type:
          type: string
          description: Type of user
          enum:
            - agent
        name:
          type: string
          description: User's display name
          example: Jane Doe
          nullable: true
        email:
          type: string
          format: email
          description: User's email address
          example: jane.doe@example.com
          nullable: true
        photo_url:
          type: string
          format: uri
          description: URL to user's avatar/profile picture (displayed in Fin Messenger)
          example: https://example.com/avatars/jane.jpg
          nullable: true
        alias:
          type: string
          description: Agent's display alias (shown to end-users instead of real name)
          example: Support Jane
          nullable: true
    Message:
      type: object
      required:
        - id
        - conversation_id
        - message_type
        - body
        - author
        - visibility
        - created_at
      properties:
        id:
          type: string
          description: Unique identifier for the message in your system
          example: msg_001
        conversation_id:
          type: string
          description: ID of the parent conversation
          example: conv_456
        message_type:
          type: string
          description: Type of message
          enum:
            - comment
        body:
          type: string
          description: Message content in HTML format
          example: <p>Thank you for reaching out! I'd be happy to explain our pricing plans.</p>
        author:
          oneOf:
            - $ref: '#/components/schemas/EndUser'
            - $ref: '#/components/schemas/Agent'
          description: The user who authored the message.
        visibility:
          type: string
          description: |
            Who can see the message:
            - `public` - Visible to end-users (appears in Fin Messenger)
            - `private` - Only visible to agents (internal notes)
          enum:
            - public
            - private
          example: public
        created_at:
          type: string
          format: date-time
          description: When the message was created (ISO 8601 UTC)
          example: '2025-10-27T14:35:00.000Z'
        attachments:
          type: array
          description: Files attached to the message
          items:
            $ref: '#/components/schemas/Attachment'
    Attachment:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: |
            URL where the attachment can be accessed.
            Must be HTTPS. Consider using signed URLs with expiration for sensitive files.
          example: https://example.com/files/pricing-guide.pdf
        filetype:
          type: string
          description: |
            File type/extension.
          example: pdf
        filename:
          type: string
          description: Display name for the file
          example: Pricing Guide 2025
```
