---
title: "Send a message"
method: POST
path: "/chat/sessions/{session_id}/send"
---

# Send a message

`POST /chat/sessions/{session_id}/send`

Sends a message in a chat session. The message can be sent as either a contact or an agent.

## Path parameters

- `session_id` string, required

## Request body

- SendMessageInput
  - `sender` 'contact' | 'agent', required
  - `contact` object
    - `name` string
    - `email` string, email
    - `phone_number` string
    - `avatar_url` string
    - `custom_data` object
  - `custom_data` object — Session-level custom data to merge into the chat session. Use contact.custom_data for contact-level attributes.
  - `agent` object
    - `id` number
    - `name` string
    - `avatar_url` string
  - `message` object, required
    - `type` 'text', required
    - `text` string, required
    - `attachments` ChatAttachmentInput[]
      - `name` string, required — The name of the file
      - `url` string — The URL of the file (mutually exclusive with base64)
      - `base64` string — Base64-encoded file content (mutually exclusive with url). Can be a data URL (data:mimetype;base64,...) or raw base64 string.
      - `mime_type` string — MIME type of the file (e.g., "image/png", "application/pdf"). Optional if using data URL format or if type can be detected from file content.
  - `should_take_over_session_from_ai` boolean

## Response `200`

Default Response

- SendMessageOutput
  - `success` boolean, required
  - `data` union, required
    - object
      - `message` object, required
        - `id` string, required
    - union
      - object
        - `success` true, required
        - `code` union
          - string
          - 'session_assigned_to_human_agent'
          - 'response_cancelled'
          - 'skipping_unuseful_response'
          - 'duplicate_message_ignored'
          - 'ai_response_skipped_by_workflow'
        - `autopilotResponse` object
          - `type` 'text', required
          - `value` object, required
            - `error` boolean, required
            - `content` string, required
          - `id` string
          - `mightSolveUserIssue` boolean, required
          - `completelyAndFullyCoveredUserIssue` boolean, required
          - `debugInfo` object
            - `actionCalls` object[]
              - …
            - `actionSearchQuery` string
            - `knowledge` object[]
              - …
            - `knowledge_used` object[]
              - …
            - `work_instructions_scanned` object[]
              - …
            - `client_context` object, nullable — Context provided from the client. For example, dynamic metadata sent from the widget such as: the current product name on the page, the current Shopify shop domain, etc etc.
            - `additional_debug_data` object, nullable — Org-specific or message-type-specific debug data.
            - `custom_data` object, nullable
            - `whatsapp_template_request` unknown
            - `rule_violation_reflections` object[]
              - …
            - `tool_call_results_quick_reply_suggestions` object[]
              - …
            - `assignment_choice_summary` object, nullable
              - …
            - `destination_id` string
            - `destination_name` string
            - `destination_type` 'phone' | 'sip' | 'hangup'
            - `transfer_reason` string, nullable
            - `is_failover` boolean
            - `failover_source` 'stt' | 'llm' | 'tts'
            - `hangup_initiator` 'user' | 'agent' | 'system'
            - `hangup_reason` string
            - `duration_seconds` number
            - `call_direction` 'inbound' | 'outbound'
          - `mode` object
            - `id` string, required
            - `name` string, required
            - `slug` string
          - `didExitMode` boolean
        - `uiResponse` object
          - `type` 'ui', required
          - `value` object, required
            - `type` 'ui_component', required
            - `request_response` unknown, required
            - `name` string, required
            - `content` string
          - `mightSolveUserIssue` boolean, required
        - `sessionIsHandedOff` boolean
        - `resolveArgs` object
          - `summary` string, required — Summary of the conversation with the user to be viewed by a human agent.
          - `sentiment` 'angry' | 'happy' | 'neutral', required
        - `toolCallResultsQuickReplySuggestions` object[]
          - `tool_name` string, required
          - `suggestions` string[], required
      - object
        - `success` false, required
        - `error` object, required
          - `code` string
          - `message` string

## Other responses

- `500` — Internal Server Error

---

[API](https://skmtc.net/open/apis/opencx-api.md) · [All operations](https://skmtc.net/open/apis/opencx-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/open/opencx-api/versions/57b06b52302d/schema)
