Skip to main content
POST
/
orgs
/
{org_id}
/
contacts
/
{contact_id}
/
channels
/
{channel_id}
/
chats
/
{chat_id}
/
messages
/
{message_id}
/
tools
/
{tool_call_id}
/
respond
Respond to Interactive Tool as a contact on a channel
curl --request POST \
  --url https://api.useinvent.com/orgs/{org_id}/contacts/{contact_id}/channels/{channel_id}/chats/{chat_id}/messages/{message_id}/tools/{tool_call_id}/respond \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "connection",
  "connection_id": "<string>"
}
'
{
  "id": "<string>",
  "model": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "messages": [
    {
      "role": "system",
      "parts": [
        {
          "type": "text",
          "text": "<string>",
          "audio": {
            "id": "<string>",
            "file_path": "<string>",
            "file_filename": "document.pdf",
            "file_size": 1024,
            "file_mimetype": "application/pdf",
            "file_url": "<string>",
            "created_at": "2023-11-07T05:31:56Z"
          },
          "start_timestamp": 123,
          "end_timestamp": 123
        }
      ]
    }
  ],
  "member": {
    "id": "<string>",
    "user": {
      "id": "<string>",
      "name": "<string>",
      "avatar": "<string>"
    },
    "session": {
      "id": "<string>"
    },
    "contact_channel": {
      "id": "<string>",
      "user_id": "<string>",
      "avatar": "<string>",
      "name": "<string>",
      "username": "<string>",
      "email": "jsmith@example.com",
      "phone": "<string>",
      "country": "<string>",
      "agent": "<string>",
      "ip": "<string>",
      "language": "<string>",
      "contact": {
        "id": "<string>",
        "name": "<string>",
        "blocked": true,
        "ai_replies_disabled": true,
        "is_admin": true
      },
      "link": "<string>"
    }
  },
  "error": "<string>",
  "broadcast_id": "<string>",
  "is_broadcast_message": true,
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "total_tokens": 123,
    "reasoning_tokens": 123,
    "input_tokens_cache_read": 123,
    "input_tokens_cache_write": 123,
    "turns": [
      {
        "input_tokens": 123,
        "output_tokens": 123,
        "total_tokens": 123,
        "reasoning_tokens": 123,
        "input_tokens_cache_read": 123,
        "input_tokens_cache_write": 123
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer token authentication using your API key

Path Parameters

org_id
string
required

Org ID

contact_id
string
required

Contact ID

channel_id
string
required

Channel ID

chat_id
string
required

Chat ID

message_id
string
required

The ID of the message with the pending tool.

tool_call_id
string
required

The ID of the tool call being responded to.

Body

A user response to an interactive tool, discriminated by response type.

type
enum<string>
required
Available options:
connection
connection_id
string
required

The connected connection id (con_...).

Response

200 - application/json

The chat message schema

id
string
required
role
enum<string>
required

The role of the message

Available options:
user,
assistant,
system,
tool,
event,
note
model
string
required

The model used for the message

status
enum<string>
required

The chat status

Available options:
RUNNING,
COMPLETED,
FAILED,
CANCELED
created_at
string<date-time> | null
required
updated_at
string<date-time> | null
required
messages
object[]

The message content

System message

member
object

The member of the chat

error
string

Error message if the message failed

broadcast_id
string

ID of the broadcast this message originates from

is_broadcast_message
boolean

Whether this message was sent via a broadcast template

usage
object

The usage information for the message