Partners

Create Partner User Session

Create a partner user session

post
/v1/partner/user/{userId}/session/create

Authorization

ChatBotKit API Secret * Required

HTTP Authorization Scheme: bearer

Path Parameters

userIdstring* Required

The ID of the user

Request Body * Required

Request Body Schema: application/json

durationInSecondsnumber

The lifetime of the session token in seconds

configobject

allowedRoutesarray

Glob patterns restricting which API routes the token may access

contactIdstring

Optional contact ID to include in the session token

import { ChatBotKit } from '@chatbotkit/sdk'

const cbk = new ChatBotKit({

secret: process.env.CHATBOTKIT_API_KEY!

})

const response = await cbk.partner.user.session.create(

userId,
{
"durationInSeconds":"number",
"config":{
"allowedRoutes":[
"string"
],
"contactId":"string"
}
}
)
{
"id":"string",
"token":"string",
"expiresAt":"number"
}
The session was created successfully