Chatbot Operations

Send a live chat message

Send a live chat message to an existing conversation of a chatbot. The message can be sent as a human agent (role: 'human'), as an assistant response (role: 'assistant') or as a user message (role: 'user').

Role behavior:

  • 'human' (default): The message is sent as a human agent. This automatically stops the AI bot so that it does not interfere with human assistance. The name and avatar parameters are used for the human agent's identity.
  • 'assistant': The message is sent as an AI assistant response. The AI bot continues to operate normally. The name and avatar parameters are ignored.
  • 'user': The message is sent as a user message. The AI bot continues to operate normally. The name and avatar parameters are ignored.

If you want to take over the conversation as a human agent, use the default 'human' role. If you want to send assistant responses without stopping the AI bot, use the 'assistant' role.

post/live-chat

Request

  • Base URL: https://api.chat-data.com/api/v2
  • URL: https://api.chat-data.com/api/v2/live-chat
  • Auth: HTTP bearer

Request body

chatbotIdstring required

The unique identifier of the chatbot.

messagestring required

The message text to be sent to the conversation. It must be a non-empty string (an empty string gets a 400); to send only files, send a blank string such as a single space.

conversationIdstring required

The unique identifier of the conversation. It must be an existing conversation of the chatbot.

role'human' | 'assistant' | 'user'

The role of the message sender. Valid values: 'human' (human agent), 'assistant' (AI response) or 'user' (end user/customer). When the role is 'assistant' or 'user', the name and avatar parameters are ignored.

namestring

The name of the human agent sending the message. Only used when the role is 'human'. If unset, the workspace owner's name is used as the agent name.

avatarstring uri

The URL of the avatar image for the message sender. Only used when the role is 'human'. If unset, the workspace owner's avatar is used as the human agent's avatar.

Example request

{
  "chatbotId": "6650f1c2a9e4b83d2c7a1f05",
  "message": "Hi Jane, I'm Alex from the support team. Let me check your order status for you.",
  "conversationId": "3f2b8c1e-9a4d-4e7b-8c2a-5d1e6f7a8b9c",
  "name": "Alex Chen",
  "avatar": "https://example.blob.core.windows.net/chatfiles/6650f1c2a9e4b83d2c7a1f05/agent-avatar.png"
}

Response

Successful response.

status'success' required
emailed_offline_messageboolean required

Whether the message was also emailed to the user because they were offline. This only happens when the role is 'human' and the conversation's lead has an email address.

is_user_onlineboolean required

Whether the user is currently online in the conversation.

Example response

{
  "is_user_online": true,
  "delivery": {
    "channel": "Whatsapp",
    "state": "accepted"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.