Understand the Structure of the Bot Client Interfaces
There are two interfaces of the bot client:
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.
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.
RequestConfigobject contains the bot configuration variables.
BotSendMessageRequestobject contains the message and message options to start and continue a session.
BotEndSessionRequestobject contains the message to end the session.
- The return type is
BotResponsefor all session requests.
getHealthStatus()method returns the health status of the bot.
- To create an instance of either client, you require a runtime URL and authentication mechanism.