Conversation Sessions
Create Conversation Session
Create conversation session
Description
Conversation tokens allow client-side applications to create a unique, authenticated credential for each conversation. This token can be used to interact with the conversation/{conversationId}/send, conversation/{conversationId}/receive, and conversation/{conversationId}/message/create routes. By creating an individual token for each conversation, a client-side application is able to directly access and manipulate the conversation through these routes. Without conversation tokens, a client-side application would need to authenticate and access conversation routes through a server-side application, which can be more complex and require additional infrastructure. By providing a way for client-side applications to authenticate and access the conversation routes directly, the token route simplifies the process of integrating with the API and makes it more convenient for developers to build AI applications.
Authorization
ChatBotKit API Secret * Required
HTTP Authorization Scheme: bearer
Path Parameters
conversationIdstring* Required
The ID of the conversation
Request Body * Required
Request Body Schema: application/json
durationInSecondsnumber
The maximum amount of time this session will stay open
import { ChatBotKit } from '@chatbotkit/sdk'
const cbk = new ChatBotKit({
secret: process.env.CHATBOTKIT_API_KEY!
})
const response = await cbk.conversation.session.create(
conversationId,{)}"durationInSeconds":"number"
{"id":"string","token":"string","expiresAt":"number"}