Socket Event Types

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 CH. On successful creation, expect to receive bot_messages and be able to send user_messages. Emit : Yes Receive : No Payload :

{
    "action": "sendMessage",
    "event": {
        "event_type": "conversation_start",
        "event_payload": {
            // userId - optional. if not provided, CH will assign "anon" as the userId.
            "userId": "super-unique-user-id",
            // userBasicInfo - optional. if provided, basic info is sent in livechat and chatbot
            "userBasicInfo": { //optional
                "firstName": "John",
                "lastName": "Doe",
                "email": "[email protected]"
            //DEV NOTE: Add phone number nalang here   
            },
            // userData - optional. if provided, basic info is sent in livechat and chatbot
            "userMetadata": {
            
            }
            //DEV NOTE: CHANGE TO userMetadata, metadata updates will be pushed here too.
        }
    }
}

conversation_start_success

This event is received event to start a new conversation in CH. 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 Captivate Hub. Emit : No Receive : Yes Payload showing the model of the bot_message content

Payload example

livechat_message

Livechat 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 CH documentarrow-up-right details how and why metadata is used in Captivate Hub. Examples of metadata that can be set are channel user data and sending preconfigured data depending on where the user is in the website. This metadata will be saved in CH sessions and can be if required. Emit : Yes Receive : No Payload

action

Aside from messages, actions can also be exchanged by the client application and Captivate Hub. 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 chat widget that the user can click to ask for a livechat agent for assistance. Client application should then emit an action to CH, and CH will handle the action accordingly.

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

A user asks the chatbot β€œHow do I reach you”, the chatbot then recognizes this and sends an outgoing actionarrow-up-right 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 :

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 docs.

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.