Understand the Structure of the Bot Client Interfaces
There are two interfaces of the bot client: BasicChatbotClient
and SessionManagedChatbotClient
.
With the BasicChatbotClient
interface, there’s a separate method to start and continue the session. You track the session using the bot’s runtime session ID. To start a session, you provide an ExternalSessionId
of an external channel, such as a Slack or Twitter thread, to startChatSession()
. Then the bot generates a unique internal session ID, which you use as the RuntimeSessionId
, to send subsequent messages or end the active session.
The SessionManagedChatbotClient
interface adds session management capabilities to the basic bot client. With the session-managed client, there’s no startChatSession()
method and RuntimeSessionId
. You start the session and send subsequent messages using the same method sendMessage()
. You only need the ExternalSessionId
since the client maps the external session ID to the internal one in the cache. For example, you could use a Slack thread ID to track all bot messages in a session without knowing the bot’s internal session ID.
Here are the features that both basic bot and session-managed clients share.
- The
RequestConfig
object contains the bot configuration variables. - The
BotSendMessageRequest
object contains the message and message options to start and continue a session. - The
BotEndSessionRequest
object contains the message to end the session. - The return type is
BotResponse
for all session requests. - The
getHealthStatus()
method returns the health status of the bot. - To create an instance of either client, you require a runtime URL and authentication mechanism.