Chat Integrations

Create Chat Integration Session

Create a Chat session token for one contact

post
/v1/integration/chat/{chatIntegrationId}/session/create

Description

A trusted backend calls this with the owner's credentials for a person it has signed in. The returned token lets that person's browser send to the listed destinations and list their recent messages, and nothing else.

Authorization

ChatBotKit API Secret * Required

HTTP Authorization Scheme: bearer

Path Parameters

chatIntegrationIdstring* Required

The ID of the Chat integration the person enters the server through

Request Body * Required

Request Body Schema: application/json

contactIdunknown

The contact of the person, as a contact ID or alias, or as a contact object with a fingerprint

destinationsarray

The

durationInSecondsnumber

How long the token is valid, from 60 to 3600 seconds (default 900)

import { ChatBotKit } from '@chatbotkit/sdk'

const cbk = new ChatBotKit({

token: process.env.CHATBOTKIT_API_TOKEN!

})

const response = await cbk.integration.chat.session.create(

chatIntegrationId,
{
"contactId":"",
"destinations":[
"string"
],
"durationInSeconds":"number"
}
)
{
"token":"string",
"expiresAt":"number",
"destinations":[
"string"
]
}
The session token was created successfully