# Create Message

`POST /messages`

> This is a subset of the full specification, limited to the `POST /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 `POST /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:
    post:
      tags:
        - Messages
      summary: Create Message
      description: |
        Used during synchronization to push new messages into your helpdesk. These messages may come from either the end-user or Fin.
        Note that the author of the Fin messages will be the agent selected to represent Fin on initial setup of the integration.
      operationId: createMessage
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                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.

                    Supported HTML tags are:
                    - Paragraphs `<p>`
                    - Heading 1, Heading 2 `<h1>` `<h2>` (note h3 to h6 appears as a h2)
                    - Bold `<b>`
                    - Italic `<i>`
                    - Links `<a>`
                    - Images `<img>` (can be linked)
                    - Line breaks `<br>`
                    - Code blocks `<code>`
                    - Unordered lists `<ul>`
                    - Ordered lists `<ol>`
                  example: <p>Hi! I'd like to know more about your pricing plans.</p>
                author:
                  type: object
                  description: The user who authored the message.
                  properties:
                    id:
                      type: string
                      description: Unique identifier for the user in your system
                      example: user_123456
                    user_type:
                      type: string
                      description: Type of user
                      enum:
                        - end_user
                        - agent
                visibility:
                  type: string
                  description: Message visibility
                  enum:
                    - public
                    - private
                created_at:
                  type: string
                  format: date-time
                  description: ISO 8601 timestamp
                  example: '2025-10-27T14:30:00.000Z'
                object_id:
                  type: string
                  description: Unique identifier for the message in our system
                  example: '123456'
                attachments:
                  type: array
                  description: Array of attachments (can be empty)
                  items:
                    $ref: '#/components/schemas/Attachment'
      responses:
        '201':
          description: Message created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
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
```
