# Notify Fin of Conversation Events

`POST /custom_helpdesk_conversation_event/{integration_id}`

> This is a subset of the full specification, limited to the `POST /custom_helpdesk_conversation_event/{integration_id}` 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 /custom_helpdesk_conversation_event/{integration_id}` 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: Webhooks
    description: Notify Fin when conversations change
paths:
  /custom_helpdesk_conversation_event/{integration_id}:
    post:
      parameters:
        - name: integration_id
          in: path
          schema:
            type: string
          required: true
          description: The ID of your integration. You can find this in the Fin Deployment UI.
          example: a3c729d4e8f6b15c
      tags:
        - Webhooks
      summary: Notify Fin of Conversation Events
      description: |
        This endpoint handles two distinct use cases depending on whether an `event_type` is provided:

        ## 1. Conversation Synchronization (default behavior)

        When you **omit the `event_type` field**, Fin will synchronize the conversation by pulling the latest data from your endpoints. Use this when:
        - An agent sends a message
        - The conversation state changes (status, assignee, etc.)
        - Any other conversation data changes that Fin should know about

        **Example payload:**
        ```json
        {
          "conversation_id": "conv_456"
        }
        ```

        ## 2. Agent Typing Indicator

        When you set `event_type` to `agent_typing`, Fin will display a typing indicator to the end-user in the Fin Messenger. **No synchronization occurs** - this is purely a real-time UI update.

        Use this when an agent starts typing a response in your helpdesk. The typing indicator automatically dismisses after a few seconds.

        **Important:** When using `event_type: "agent_typing"`, the `data.agent` field is **required** and must include the agent's `id`, `user_type`, `name`, and `email`.

        **Example payload:**
        ```json
        {
          "conversation_id": "conv_456",
          "event_type": "agent_typing",
          "data": {
            "agent": {
              "id": "agent_001",
              "user_type": "agent",
              "name": "Sarah Johnson",
              "email": "sarah.johnson@company.com"
            }
          }
        }
        ```
      operationId: customHelpdeskConversationEvent
      servers:
        - url: https://api.intercom.io/hooks/standalone
          description: Fin Webhook US Endpoint
        - url: https://api.eu.intercom.io/hooks/standalone
          description: Fin Webhook EU Endpoint
        - url: https://api.au.intercom.io/hooks/standalone
          description: Fin Webhook AU Endpoint
      security:
        - WebhookSignature: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - conversation_id
              properties:
                conversation_id:
                  type: string
                  description: ID of the conversation in your system
                  example: conv_456
                event_type:
                  type: string
                  description: |
                    Optional. The type of event that occurred.

                    - **Omitted or null**: Fin will synchronize the conversation by pulling the latest data from your endpoints.
                    - `agent_typing`: Displays a typing indicator to the end-user. No synchronization occurs. Requires `data.agent` to be provided.
                  enum:
                    - agent_typing
                data:
                  type: object
                  description: |
                    Additional event data. Required when `event_type` is `agent_typing`.
                  properties:
                    agent:
                      $ref: '#/components/schemas/Agent'
                      description: |
                        The agent who is typing. **Required** when `event_type` is `agent_typing`.
                        Must include: `id`, `user_type` (must be "agent"), `name`, and `email`.
            examples:
              conversation_sync:
                summary: Conversation Synchronization
                value:
                  conversation_id: conv_456
              agent_typing:
                summary: Agent Typing Indicator
                value:
                  conversation_id: conv_456
                  event_type: agent_typing
                  data:
                    agent:
                      id: agent_001
                      user_type: agent
                      name: Sarah Johnson
                      email: sarah.johnson@company.com
      responses:
        '204':
          description: Webhook accepted
        '400':
          description: |
            Invalid payload. Common causes:
            - `event_type` is `agent_typing` but `data.agent` is missing or invalid
            - `data.agent` is missing required fields (`id`, `user_type`, `name`, `email`)
        '401':
          description: Invalid or missing signature
        '404':
          description: Custom helpdesk integration not found
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
    WebhookSignature:
      type: apiKey
      in: header
      name: X-Webhook-Key
      description: |
        Webhook key for the custom helpdesk integration. Obtained from Fin Deployment UI.
  schemas:
    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
````
