Service
Introduction
You may subscribe to events by opening a Socket.IO connection to the WebSocket endpoint. The RTM API endpoint URL is:wss://message-socket.talqui.chat
The Socket.IO path is: /socket/
⚠️
/socket/ is the Socket.IO path option, it is not part of the connection URL. If you pass wss://message-socket.talqui.chat/socket as the URL, the client reads /socket as a namespace and keeps requesting the default path (/socket.io/), so the handshake never reaches the RTM API. Always keep only the host in the URL and declare the path in the client options.There is a limit on the maximum number of connections that can be simultaneously open with the RTM API (per-token, per-team and per-IP). This limit is quite high and can be revised at any time. Please make sure to teardown any unused connection before opening a new one. Most use cases require a single RTM API connection.
Authentication
The RTM API is authenticated during the Socket.IO handshake, through theauth object of the client options. Custom headers are not an option here — browsers do not allow headers to be set on a WebSocket handshake — so credentials always travel inside auth, and both fields below are always required:
The RTM API accepts the two plugin credential formats:
📣 An
Authorization that is invalid, expired or not scoped to the RTM API does not necessarily produce a connect_error. The transport may stay open while the connection remains unauthorized, and no event is ever delivered. If you connect successfully but never receive anything, review your auth object first.Listening to more than one tenant
A plugin is usually installed on many tenants, and a single connection can follow all of them. Beyond thetenantID sent in the handshake, you subscribe and unsubscribe tenants at any time by emitting the events below — that is how you follow every tenant that installed your plugin, and drop the ones that uninstalled it.
📣 Subscriptions live only for the duration of the connection. Emit
plugin:connect:tenants again on every connect event, otherwise a reconnection will leave you with an authenticated socket that receives nothing.Base Objects
Session
Session Base Object
- Identifier:
object:session:base - Description: Base version of session object
Session Extended Object
- Identifier:
object:session:extended - Description: Generally used over RTM API, it’s an version extended of session with some id-fields already populated
Events
This events below represents messages that you will receive when connected to RTM API over websocket, those messages should be listen one by one and does not have acknolodge in delivery, só it’s an notification event brokerSession Events
Events that ocurrs under namespace of sessions, sessions represents an conversation between contact with a tenant, those sessions are repSession Change Type
- Event:
session:set:change_type - Description: When session change his type between
auto,queuedormanual
What represents each session type:
auto: Session has this state when conversation is occurring under autonomous services, like chatbot, llms or anything similar.queued: This state only ocurrs when session is waiting to be handled by human, it’s an transitory state but can be the first state when you dont have participation of chatbots in flow.manual: Type when a session is assigned to a human, no one autonomous messages can be sent in this state.
📣 Session types queued and manual will always occur, but if you don’t have any chatbot installed in a tenant where the event occurs, the type auto will be skipped. This means that the initial state of a session will be queued, indicating that the session created is waiting for human treatment since its creation.
Session Set Routing
- Event:
session:set:routing - Description: Session was routed to an operator
Session Set Opened
- Event:
session:set:opened - Description: session was opened by some operator
Session Set Closed
- Event:
session:set:closed - Description: session was closed
Session Tag Added
- Event:
session:tag:added - Description: Session received a new tag
Session Tag Removed
- Event:
session:tag:removed - Description: Session has an tag removed
Session Rating Updated
- Event:
session:rating:updated - Description: Ocurrs when a session is rated by contact
Session Request Initiated
- Event:
session:request:initiated - Description: Triggered when an a session is started by tenant with some contact
Session Summary Processed
- Event:
session:summary:processed - Description: Triggered when an session is summarized, event holds the session object and summarization of what was said in that session
📣 This depends of some conditions: Until today session must have more than 5 messages to be summarized. Other filters can be applied on that event avoiding to be triggered for each session. You can perform our own post-session async operations listening to event
session:set:closedSession Metadata Updated
- Event:
session:meta:updated - Description: This event is fired when some metadata of session was changed.
📣 Very usefull to design reactions at plugin widget, you can listen that event on backend and then trigger reactions to widget instantly, like show some information or change pages.
Contact Events
Contact attributes updated
- Event:
contact:attributes:update - Description: Contact attributes was updated
Message Events
Message Received
- Event:
message:inbound - Description: Fired when a message is received at tenant