Socket API

Socket API Chat Library that correspond to processes that transform your Custom Channel into a fully functional AI Chatbot.

This is the Chat Library of the Socket API that is currently available and compatible with the Captivate Chat platform. These are all intended to create processes that will transform your Custom Channel into a full-blown AI Chatbot.

The full documentation is available here.


socket_connected

Successful creation of a Channel session.

Emit : No Receive : Yes Payload

{
    "action": "receiveMessage",
    "event": {
        "event_type": "socket_connected",
        "event_id": "Vp6roFYZLPEFfcg=",
        "event_payload": {
            "socket_id": "Vp6roemHLPECFOQ="
        },
        "accepts_response_payload": false
    }
}

conversation_start

Send this event to start a new conversation in Captivate Chat. On successful creation, expect to receive bot_messages and be able to send user_messages.

Emit : Yes Receive : No Payload :


conversation_start (with metadata)

This action initiates a new conversation for a specific user and allows you to attach metadata, such as user details.

Emit: Yes Receive: No Payload:


conversation_start_success

This event is received event to start a new conversation in a Captivate Flow.

On successful creation, expect to receive bot_messages immediately with the same conversation_id received here. Consider this as a confirmation that conversation start request has been successful.

Emit : No Receive : Yes Payload :


user_message

User messages sent from the client application.

Emit : Yes Receive : No Payload


bot_message

Bot messages sent from the Chat Flow. Emit : No Receive : Yes Payload showing the model of the bot_message content

Payload example


sendMessage (with files)

This action sends a message from a user and includes file attachments.

Emit: Yes Receive: No Payload:


livechat_message

Live Chat messages sent from the connected live chat application (Slack, MS Teams, Freshdesk, etc.).

Emit : No Receive : Yes Payload


metadata

Metadata that can be set from the client application. This Captivate Chat document details how and why metadata is used in Captivate Chat. Examples of metadata that can be set are channel user data and sending preconfigured data depending on where the user is on the website. This metadata will be saved in Captivate Chat sessions and can be retrieved if required.

Emit : Yes Receive : No Payload


action

Aside from messages, actions can also be exchanged by the client application and Captivate Chat. Actions can be used for triggering events on both sides.

For example, a reserved CH action β€œescalateToHuman” can be emitted from the client application for this example scenario:

There is button in the Web Widget that the user can click to ask for a Live Chat agent for assistance. Client application should then emit an action to Captivate Chat, and the Chat Flow will handle the action accordingly.

It is also possible to receive an action from Captivate Chat for an example scenario:

A user asks the chatbot β€œHow do I reach you”, the chatbot then recognizes this and sends an outgoing action back to the channel with a title β€œredirectToContactUs”. It is up to the client application developer then to utilize the action received.

Emit : Yes Receive : Yes Payload


conversation_transcript_request

Send this event to request for the conversation transcripts associated with a socket connection. Expect to receive a conversation_transcript event as a response.

Emit : Yes Receive : No Payload :


get_conversations

Request the list of Conversation IDs for a specific user by providing their userId

Emit: Yes Receive: Yes Payload:

Sample Response:



delete_conversation

This action removes an existing conversation using conversation_id.

Emit: Yes Receive: No Payload:



delete_conversation (all conversations)

This action removes all existing conversation using userId

Emit: Yes Receive: No Payload:


delete_conversation_success

When a conversation is deleted, the server sends an event called delete_conversation_success.

This event provides confirmation that the deletion has happened.

Emit: No Receive: Yes Payload:


metadata_request

This action retrieves the metadata for a specific conversation using the conversation's unique ID (idChat).

Emit: Yes Receive: Yes Payload:


conversation_transcript

The returned transcript in response to conversation_transcript_request event.

Emit : No Receive : Yes Payload :

Payload example with user, agent, and bot messages:


conversation_update

Updates specific to a conversation session. Details for updates types will be provided in the next documents.

Emit : No Receive : Yes Payload :


general_error

Sent during errors.

Emit : No Receive : Yes Payload

Example – at the moment, this Invalid conversation_Id is the only possible error returned.

Last updated

Was this helpful?