### Install and Run Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/pages/contact-auth/README.md Install the example project and run it locally. Open the provided URL in your browser to see the authentication flow. ```bash pnpm -F @examples/nextjs-pages-router-contact-auth dev ``` ```bash pnpm dev ``` -------------------------------- ### Install and Run Example (Bash) Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/stateless-chat-rsc/README.md Install the example project using pnpm and run the development server. Open the provided URL in your browser to view the application. ```bash pnpm -F @examples/nextjs-app-router-stateless-chat-rsc dev ``` ```bash pnpm dev ``` -------------------------------- ### Standalone Application Setup Commands Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/graphql-codegen/README.md Steps to install dependencies, configure the API key, generate GraphQL types, and start the development server for a standalone application. ```bash npm run bootstrap CHATBOTKIT_API_SECRET=your_api_secret_here npm run codegen npm run dev ``` -------------------------------- ### Install and Run Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/streaming-objects/README.md Instructions to install and run the Next.js streaming objects example. Navigate to the monorepo root or run as a standalone application. ```bash pnpm -F @examples/nextjs-app-router-streaming-objects dev ``` ```bash pnpm dev ``` -------------------------------- ### Install and Run Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/stateless-chat-rsc-functions-request/README.md Instructions for installing and running the example project using pnpm. Ensure you are in the root of the ChatBotKit Node SDK monorepo or running it as a standalone application. ```bash pnpm -F @examples/nextjs-app-router-stateless-chat-rsc-functions-request dev ``` ```bash pnpm dev ``` -------------------------------- ### Start the Next.js Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/pages/auth-chat/README.md Run this command from the root of the ChatBotKit Node SDK monorepo to start the example. ```bash pnpm -F @examples/nextjs-pages-router-auth-chat dev ``` -------------------------------- ### setup() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/slack/classes/SlackIntegrationClient.md Setups a slack integration. ```APIDOC ## setup() > **setup**(`slackId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{>}> Setups a slack integration. #### Parameters ##### slackId `string` #### Returns [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{>}> ``` -------------------------------- ### Run Example with pnpm Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/stateless-chat-rsc-functions/README.md Install and run the example project using pnpm. Open the provided URL in your browser to view the application. ```bash pnpm -F @examples/nextjs-app-router-stateless-chat-rsc-functions dev ``` ```bash pnpm dev ``` -------------------------------- ### Install and Run the Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/stateless-rag/README.md Instructions for running the stateless RAG example project using pnpm. Open http://localhost:3000 in your browser to view the result. ```bash pnpm -F @examples/nextjs-app-router-stateless-rag dev ``` ```bash pnpm dev ``` -------------------------------- ### Start Stateful Chat Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/pages/stateful-chat/README.md Run this command from the root of the ChatBotKit Node SDK monorepo to start the example. ```bash pnpm -F @examples/nextjs-pages-router-stateful-chat dev ``` -------------------------------- ### Start Development Server Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/hybrid/basic-chat/README.md Run this command to start the Next.js development server for the chat example. ```bash pnpm dev ``` -------------------------------- ### Install Hybrid Chat Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/hybrid/basic-chat/README.md Run this command from the root of the ChatBotKit Node SDK monorepo to install the example. ```bash pnpm -F @examples/nextjs-hybrid-router-stateless-chat ``` -------------------------------- ### setup() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/messenger/classes/MessengerIntegrationClient.md Setups a messenger integration. ```APIDOC ## setup() > **setup**(`messengerId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{>}> Setups a messenger integration. #### Parameters ##### messengerId `string` #### Returns [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{>}> ``` -------------------------------- ### Install and Run Vite React Stateless Chat Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/vite/react/stateless-chat/README.md Commands to install dependencies and start the backend and development servers for the stateless chat example. ```bash pnpm -F @examples/vite-react-stateless-chat dev pnpm -F @examples/vite-react-stateless-chat server ``` ```bash pnpm install pnpm server pnpm dev ``` -------------------------------- ### setup() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/googlechat/classes/GooglechatIntegrationClient.md Setups a Google Chat integration. ```APIDOC ## Method: setup ### setup(googlechatId) Setups a Google Chat integration. #### Parameters ##### googlechatId - `googlechatId` (string): The ID of the Google Chat integration to setup. #### Returns - `Promise<{}>`: A promise that resolves when the integration is setup. ``` -------------------------------- ### setup Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/whatsapp/classes/WhatsAppIntegrationClient.md Setups a whatsapp integration. ```APIDOC ## setup() ### Description Setups a whatsapp integration. ### Method setup ### Parameters #### Path Parameters - **whatsappId** (string) - Required - The ID of the whatsapp integration to setup. ### Returns - `Promise<{}>` - A promise that resolves when the integration is set up. ``` -------------------------------- ### setup() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/discord/classes/DiscordIntegrationClient.md Sets up a Discord integration. ```APIDOC ## setup() ### Signature ```typescript setup(discordId: string): Promise ``` ### Description Setups a discord integration. ### Parameters - **discordId** (`string`): The ID of the Discord integration to set up. ### Returns - `Promise`: A promise that resolves when the integration is set up. ``` -------------------------------- ### setup Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/teams/classes/TeamsIntegrationClient.md Setups a teams integration. ```APIDOC ## setup ### setup(teamsId: string): Promise<{}> Setups a teams integration. #### Parameters * **teamsId** (`string`) #### Returns * `Promise<{}>` ``` -------------------------------- ### setup() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/instagram/classes/InstagramIntegrationClient.md Sets up an Instagram integration. ```APIDOC ## setup() Setups an instagram integration. ### Parameters ##### instagramId - `string` ### Returns - [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise`<{}>`) ``` -------------------------------- ### setup() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/trigger/classes/TriggerIntegrationClient.md Setups a trigger integration. It requires a trigger ID and returns a Promise. ```APIDOC ## setup() ### Description Setups a trigger integration. ### Method ```javascript setup(triggerId: string): Promise<{}> ``` ### Parameters #### triggerId - **triggerId** (string) - Required - The ID of the trigger to setup. ### Returns - **Promise** - A Promise that resolves when the trigger integration is set up. ``` -------------------------------- ### setup Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/widget/classes/WidgetIntegrationClient.md Sets up a widget integration. ```APIDOC ## setup ### setup(widgetId: string) Sets up a widget integration. #### Parameters * **widgetId** (string) - The ID of the widget integration to set up. #### Returns Promise<{}> - A promise that resolves when the widget integration is set up. ``` -------------------------------- ### setup Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/email/classes/EmailIntegrationClient.md Setups a email integration. ```APIDOC ## setup ### setup(emailId: string) Setups a email integration. #### Parameters ##### emailId - `emailId` (string) - The ID of the email integration to setup. #### Returns - `Promise<{}>` - A promise that resolves when the email integration is setup. ``` -------------------------------- ### Run Example (Monorepo) Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/pages/partner-auth/README.md Navigate to the ChatBotKit Node SDK monorepo and run the example using pnpm. ```bash pnpm -F @examples/nextjs-pages-router-partner-auth dev ``` -------------------------------- ### list() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/classes/PlatformExampleClient.md Retrieves a list of all platform examples. ```APIDOC ## list() ### Signature ```typescript list(request?: PlatformExampleListRequest): ResponsePromise<{}, {}> ``` ### Description Retrieves a list of all platform examples. ### Parameters * **request?** (`PlatformExampleListRequest`) ### Returns * `ResponsePromise<{}, {}>` ``` -------------------------------- ### Run Stateless Chat Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/pages/stateless-chat/README.md Instructions for running the stateless chat example from the monorepo or as a standalone application. ```bash pnpm -F @examples/nextjs-pages-router-stateless-chat dev ``` ```bash pnpm dev ``` -------------------------------- ### fetch() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/classes/PlatformExampleClient.md Fetches a platform example. ```APIDOC ## fetch() ### Signature ```typescript fetch(exampleId: string): ResponsePromise<{}, never> ``` ### Description Fetches a platform example. ### Parameters * **exampleId** (`string`) ### Returns * `ResponsePromise<{}, never>` ``` -------------------------------- ### setup Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/twilio/classes/TwilioIntegrationClient.md Sets up a Twilio integration. ```APIDOC ## setup > **setup**(`twilioId`): `Promise`<{ }> Sets up a twilio integration. #### Parameters ##### twilioId - `twilioId` (string): The ID of the Twilio integration to set up. #### Returns - `Promise`<{ }>: A promise that resolves when the integration is set up. ``` -------------------------------- ### Run Next.js App Router Stateless Chat Example Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/stateless-chat/README.md Use this command to run the example from the monorepo root. Alternatively, navigate to the standalone application directory and run 'pnpm dev'. ```bash pnpm -F @examples/nextjs-app-router-stateless-chat dev ``` ```bash pnpm dev ``` -------------------------------- ### Install ChatBotKit Fetch SDK Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/fetch/README.md Install the SDK using npm. This command adds the package to your project dependencies. ```bash npm install @chatbotkit/fetch ``` -------------------------------- ### setup Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/telegram/classes/TelegramIntegrationClient.md Sets up a Telegram integration. ```APIDOC ## setup ### setup(telegramId: string): Promise Setups a telegram integration. #### Parameters ##### telegramId - `telegramId` (string) - The ID of the telegram integration to set up. #### Returns - `Promise` - A promise that resolves when the integration is set up. ``` -------------------------------- ### clonePlatformExample Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/functions/clonePlatformExample.md Clones a platform example by providing the client instance and the example ID. ```APIDOC ## Function: clonePlatformExample() > **clonePlatformExample**(`client`, `exampleId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) Clones a platform example. ### Parameters * **client** (`ChatBotKitClient`): The ChatBotKit client instance. * **exampleId** (`string`): The ID of the example to clone. ### Returns * A `Promise` that resolves with the cloned example data. ``` -------------------------------- ### Install ChatBotKit SDK Source: https://github.com/chatbotkit/node-sdk/blob/main/README.md Install the ChatBotKit SDK using npm. This command is typically run once at the beginning of a project. ```bash npm install @chatbotkit/sdk ``` -------------------------------- ### listPlatformExamples Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/README.md Lists all platform examples, with optional filtering and pagination. ```APIDOC ## listPlatformExamples ### Description Lists all platform examples. ### Method GET ### Endpoint /v1/examples ### Parameters #### Query Parameters - **filter** (string) - Optional - Filter criteria for the list. - **skip** (number) - Optional - Number of examples to skip. - **take** (number) - Optional - Number of examples to take. ### Response #### Success Response (200) - **body** (PlatformExampleListResponse) - The response body containing a list of examples. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/chatbotkit/node-sdk/blob/main/README.md Run this command after cloning the repository to install all project dependencies using pnpm. ```bash pnpm install ``` -------------------------------- ### Install ChatBotKit Widget Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/widget/README.md Install the ChatBotKit widget package using npm. ```bash npm install @chatbotkit/widget ``` -------------------------------- ### fetchPlatformExample Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/functions/fetchPlatformExample.md Fetches a specific platform example by its ID. ```APIDOC ## Function: fetchPlatformExample() > **fetchPlatformExample**(`client`, `exampleId`): [`ResponsePromise`](../../../../client/classes/ResponsePromise.md) ### Description Fetches a specific platform example using the provided client and example ID. ### Parameters #### client - **client** (`ChatBotKitClient`) - The ChatBotKit client instance. #### exampleId - **exampleId** (`string`) - The unique identifier for the example to fetch. ### Returns - [`ResponsePromise`](../../../../client/classes/ResponsePromise.md) - A promise that resolves with the response from the API. ``` -------------------------------- ### fetchPlatformExample Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/README.md Fetches a specific platform example by its ID. ```APIDOC ## fetchPlatformExample ### Description Fetches a specific platform example. ### Method GET ### Endpoint /v1/examples/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the example to fetch. ### Response #### Success Response (200) - **body** (PlatformExampleFetchResponse) - The response body containing the fetched example details. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### listPlatformExamples Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/functions/listPlatformExamples.md Lists available platform examples. It requires a client instance and optionally accepts a request object for filtering or pagination. ```APIDOC ## Function: listPlatformExamples() > **listPlatformExamples**(`client`, `request?`): [`ResponsePromise`](../../../../client/classes/ResponsePromise.md) Lists available platform examples. ### Parameters #### client - **client** (`ChatBotKitClient`) - Required - The ChatBotKit client instance. #### request - **request** (`PlatformExampleListRequest`) - Optional - An object to specify request parameters. ### Returns - [`ResponsePromise`](../../../../client/classes/ResponsePromise.md) - A promise that resolves with the response from the API. ``` -------------------------------- ### Install ChatBotKit Agent SDK Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/agent/README.md Install the necessary packages for the ChatBotKit Agent SDK and core SDK. ```bash npm install @chatbotkit/agent @chatbotkit/sdk ``` -------------------------------- ### clonePlatformExample Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/README.md Clones a platform example. This function allows for the duplication of existing examples. ```APIDOC ## clonePlatformExample ### Description Clones a platform example. ### Method POST ### Endpoint /v1/examples/clone ### Parameters #### Request Body - **body** (PlatformExampleCloneRequestBody) - Required - The request body for cloning an example. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **body** (PlatformExampleCloneResponse) - The response body containing details of the cloned example. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Install ChatBotKit CLI Globally Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/README.md Install the ChatBotKit CLI globally using npm to make its commands available system-wide. ```bash npm install --global @chatbotkit/cli ``` -------------------------------- ### Install ChatBotKit NextAuth SDK Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/nextauth/README.md Add the SDK and NextAuth.js to your project using npm. ```bash npm install @chatbotkit/nextauth next-auth ``` -------------------------------- ### Install ChatBotKit SDKs Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/next/docs/README.md Add the necessary ChatBotKit SDKs to your Next.js project. ```bash npm install @chatbotkit/next @chatbotkit/react @chatbotkit/sdk ``` -------------------------------- ### searchPlatformExamples Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/README.md Searches for platform examples based on a query. ```APIDOC ## searchPlatformExamples ### Description Searches for platform examples. ### Method POST ### Endpoint /v1/examples/search ### Parameters #### Request Body - **body** (PlatformExampleSearchRequestBody) - Required - The request body containing search parameters. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **body** (PlatformExampleSearchResponse) - The response body containing search results. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### searchPlatformExamples Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/functions/searchPlatformExamples.md Searches for platform examples using the provided client and request parameters. ```APIDOC ## Function: searchPlatformExamples() > **searchPlatformExamples**(`client`, `request`): `Promise`<{ }> Searches for platform examples. ### Parameters #### client - **client** (`ChatBotKitClient`) - Required - The ChatBotKit client instance. #### request - **request** (object) - Optional - The request parameters for searching examples. ### Returns - `Promise`<{ }> - A promise that resolves with an empty object upon successful execution. ``` -------------------------------- ### setupWidgetIntegration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/widget/v1/functions/setupWidgetIntegration.md Sets up the widget integration with the provided client and widget ID. Returns a Promise that resolves to an empty object upon successful setup. ```APIDOC ## Function: setupWidgetIntegration() > **setupWidgetIntegration**(`client`, `widgetId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) ### Parameters #### client - **client** (`ChatBotKitClient`) - Required - The ChatBotKit client instance. #### widgetId - **widgetId** (`string`) - Required - The ID of the widget to integrate. ### Returns - [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) A Promise that resolves to an empty object `{}` upon successful setup. ``` -------------------------------- ### Install ChatBotKit React SDK Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/react/docs/README.md Add the SDK to your React project using npm. ```bash npm install @chatbotkit/react ``` -------------------------------- ### Example .env File for Global Configuration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/README.md Configure your ChatBotKit API token globally by creating a `~/.cbk/env` file. This file is automatically loaded by the CLI. ```bash CHATBOTKIT_API_TOKEN=your_token_here ``` -------------------------------- ### Monorepo Installation and Generation Commands Source: https://github.com/chatbotkit/node-sdk/blob/main/examples/nextjs/app/graphql-codegen/README.md Commands to bootstrap, generate GraphQL types, and run the development server within the monorepo structure. ```bash pnpm -F @examples/nextjs-app-router-graphql-codegen bootstrap pnpm -F @examples/nextjs-app-router-graphql-codegen codegen pnpm -F @examples/nextjs-app-router-graphql-codegen dev ``` -------------------------------- ### setupWidgetIntegration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/widget/v1/README.md Sets up or configures a widget integration. This is used for the initial setup or modification of integration settings. ```APIDOC ## setupWidgetIntegration ### Description Sets up or configures a widget integration. ### Method POST ### Endpoint /v1/widget/integration/setup ### Parameters #### Request Body - **request** (WidgetIntegrationSetupRequest) - Required - The request body for setting up a widget integration. ### Request Example ```json { "example": "request body for setupWidgetIntegration" } ``` ### Response #### Success Response (200) - **response** (WidgetIntegrationSetupResponse) - The response from setting up a widget integration. #### Response Example ```json { "example": "response body for setupWidgetIntegration" } ``` ``` -------------------------------- ### PlatformExampleListRequest Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/v1/type-aliases/PlatformExampleListRequest.md The PlatformExampleListRequest type defines the parameters that can be used when requesting a list of platform examples. It supports optional cursor, order, and take parameters for pagination and sorting. ```APIDOC ## Type Alias: PlatformExampleListRequest > **PlatformExampleListRequest** This type alias represents the request object for listing platform examples. It allows for optional parameters to control pagination and sorting. ### Properties * **cursor?** (`string`) - Optional. A cursor for fetching the next page of results. * **order?** (`"desc"` | `"asc"`) - Optional. The order in which to sort the results. Can be either 'desc' (descending) or 'asc' (ascending). * **take?** (`number`) - Optional. The maximum number of results to return in a single request. ``` -------------------------------- ### Basic Next.js Example with useConversationManager Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/react/docs/README.md Demonstrates how to use the `useConversationManager` hook in a Next.js application to manage chat conversations. Includes setup for session creation and message handling. ```javascript // file: ./pages/index.jsx import { useState } from 'react' import { AutoTextarea, useConversationManager } from '@chatbotkit/react' export default function Index() { const [conversationId, setConversationId] = useState(null) const [token, setToken] = useState(null) const { text, setText, message, messages, thinking, submit, } = useConversationManager({ conversationId, token }) async function createSession() { const response = await fetch(`/api/session/create`) if (!response.ok) { throw new Error(`Unexpected error`) } const { conversationId, token } = await response.json() setConversationId(conversationId) setToken(token) } function handleOnKeyDown(event) { if (event.keyCode === 13) { event.preventDefault() submit() } } return (
{conversationId && token ? ( <> {messages.map(({ id, type, text }) => (
{type}: {text}
))} {message ? (
bot: {message.text}
) : null} {thinking && (
bot: thinking...
)} setText(e.target.value)} onKeyDown={handleOnKeyDown} placeholder="Type something..." style={{ border: 0, outline: 'none', resize: 'none', width: '100%', marginTop: '10px', }} /> ) : ( )}
) } ``` ```javascript // file: ./pages/api/conversation/complete.js import { ChatBotKit } from '@chatbotkit/sdk' import { stream } from '@chatbotkit/next/edge' const cbk = new ChatBotKit({ secret: process.env.CHATBOTKIT_API_SECRET, }) export default async function handler(req) { const { messages } = await req.json() return stream(cbk.conversation.complete(null, { messages })) } export const config = { runtime: 'edge', } ``` -------------------------------- ### NextAuth.js Configuration with ChatBotKitContactEmailProvider Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/nextauth/docs/contact/provider/functions/ChatBotKitContactEmailProvider.md Example of configuring NextAuth.js with the ChatBotKitContactAdapter and ChatBotKitContactEmailProvider. This setup enables passwordless authentication for contacts and requires a custom `sendVerificationRequest` function to deliver verification codes. ```typescript import NextAuth from 'next-auth' import { ChatBotKitContactAdapter, ChatBotKitContactEmailProvider, ContactMemoryStore, } from '@chatbotkit/nextauth/contact' export default NextAuth({ adapter: ChatBotKitContactAdapter({ secret: process.env.CHATBOTKIT_API_SECRET, store: new ContactMemoryStore(), autoCreateContact: true, autoUpdateContact: true, autoDeleteContact: false, }), providers: [ ChatBotKitContactEmailProvider({ async sendVerificationRequest({ identifier, token }) { // Send email with verification token to the user await sendEmail({ to: identifier, subject: 'Sign in to your account', text: `Your verification code is: ${token}`, }) }, }), ], session: { strategy: 'jwt', }, // ... other NextAuth configuration }) ``` -------------------------------- ### Streaming Example with ConversationClient Source: https://github.com/chatbotkit/node-sdk/blob/main/README.md Demonstrates streaming capabilities in Edge and Serverless environments using the ConversationClient. Ensure you have a valid configuration object and messages array. ```javascript import { ConversationClient } from '@chatbotkit/sdk/conversation/index.js' const client = new ConversationClient(/* configuration */) for await (const { type, data } of client .complete(null, { model: 'gpt-4', messages }) .stream()) { if (type === 'token') { process.stdout.write(data.token) } } ``` -------------------------------- ### PlatformExampleClient Constructor Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/classes/PlatformExampleClient.md Initializes a new instance of the PlatformExampleClient. ```APIDOC ## Constructor ### Signature ```typescript new PlatformExampleClient(options: ChatBotKitClientOptions): PlatformExampleClient ``` ### Parameters * **options** (`ChatBotKitClientOptions`) ### Returns * `PlatformExampleClient` ### Overrides * `ChatBotKitClient.constructor` ``` -------------------------------- ### list() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/tutorial/classes/PlatformTutorialClient.md Retrieves a list of all platform tutorials. This method can optionally accept a request object for filtering or pagination. ```APIDOC ## list() ### Description Retrieves a list of all platform tutorials. ### Method list ### Parameters #### Query Parameters - **request** (PlatformTutorialListRequest) - Optional - Request object for filtering or pagination. ### Returns [`ResponsePromise`](../../../client/classes/ResponsePromise.md)
{} ### Example ```typescript const tutorials = await client.platform.tutorial.list(); ``` ``` -------------------------------- ### get() Method Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/nextauth/docs/contact/adapter/classes/ContactMemoryStore.md Retrieves a value from the memory store using its key. This method overrides the `get` method from the base `ContactStore` class. ```APIDOC ## Method: get() > **get**(`key`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`"> Defined in: [contact/adapter.js:68](https://github.com/chatbotkit/node-sdk/blob/main/sdks/node/packages/nextauth/src/contact/adapter.js#L68) ### Parameters #### key `string` ### Returns [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`any`"> ### Overrides [`ContactStore`](ContactStore.md).[`get`](ContactStore.md#get) ``` -------------------------------- ### fetchPlatformTutorial Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/tutorial/v1/functions/fetchPlatformTutorial.md Fetches a specific tutorial by its ID using the provided ChatBotKitClient. ```APIDOC ## Function: fetchPlatformTutorial() > **fetchPlatformTutorial**(`client`, `tutorialId`): [`ResponsePromise`](../../../../client/classes/ResponsePromise.md) ### Parameters #### client [`ChatBotKitClient`](../../../../client/classes/ChatBotKitClient.md) #### tutorialId `string` ### Returns [`ResponsePromise`](../../../../client/classes/ResponsePromise.md) ``` -------------------------------- ### Constructor Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Initializes a new instance of the Solution class with configuration. ```APIDOC ## Constructor ### Description Initializes a new instance of the Solution class. ### Signature ```typescript new Solution(config?: { resources?: ( | { id?: string; properties?: {}; slug?: string; type?: "blueprint"; } | { id?: string; properties?: {}; slug?: string; type?: "bot"; } | { id?: string; properties?: {}; slug?: string; type?: "dataset"; } | { id?: string; properties?: {}; slug?: string; type?: "file"; } | { id?: string; properties?: {}; slug?: string; type?: "secret"; } | { id?: string; properties?: {}; slug?: string; type?: "skillset"; } | { id?: string; properties?: {}; slug?: string; type?: "widgetIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "sitemapIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "slackIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "discordIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "telegramIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "whatsappIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "messengerIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "notionIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "emailIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "triggerIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "supportIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "extractIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "mcpserverIntegration"; } | { id?: string; properties?: {}; slug?: string; type?: "twilioIntegration"; } )[]; version?: 1; }): Solution; ``` ``` -------------------------------- ### search() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/classes/PlatformExampleClient.md Searches platform examples. ```APIDOC ## search() ### Signature ```typescript search(request: any): Promise<{}> ``` ### Description Searches platform examples. ### Parameters * **request** (`any`) ### Returns * `Promise<{}>` ``` -------------------------------- ### clone() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/example/classes/PlatformExampleClient.md Clones a platform example. ```APIDOC ## clone() ### Signature ```typescript clone(exampleId: string): Promise<{}> ``` ### Description Clones a platform example. ### Parameters * **exampleId** (`string`) ### Returns * `Promise<{}>` ``` -------------------------------- ### type Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/ExtractIntegrationResource.md Gets the type of the resource. ```APIDOC ## type ### Description Gets the type of the resource. ### Signature ```typescript get type(): string ``` ### Returns `string` - The type of the resource. ``` -------------------------------- ### name Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/ExtractIntegrationResource.md Gets the name of the resource. ```APIDOC ## name ### Description Gets the name of the resource. ### Signature ```typescript get name(): string ``` ### Returns `string` - The name of the resource. ``` -------------------------------- ### fetch() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/tutorial/classes/PlatformTutorialClient.md Fetches a specific platform tutorial by its unique identifier. This method is used to retrieve the details of a single tutorial. ```APIDOC ## fetch() ### Description Fetches a platform tutorial. ### Method fetch ### Parameters #### Path Parameters - **tutorialId** (string) - Required - The unique identifier of the tutorial to fetch. ### Returns [`ResponsePromise`](../../../client/classes/ResponsePromise.md)
{} ### Example ```typescript const tutorial = await client.platform.tutorial.fetch('tutorial-id-123'); ``` ``` -------------------------------- ### Constructor Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/sitemap/classes/SitemapIntegrationClient.md Initializes a new instance of the SitemapIntegrationClient. ```APIDOC ## Constructor ### new SitemapIntegrationClient(options) Initializes a new instance of the SitemapIntegrationClient. #### Parameters ##### options - `options` (`ChatBotKitClientOptions`) - Options for the client. #### Returns - `SitemapIntegrationClient` - A new instance of SitemapIntegrationClient. ``` -------------------------------- ### setupSlackIntegration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/slack/v1/functions/setupSlackIntegration.md Sets up the Slack integration for your ChatBotKit client. ```APIDOC ## Function: setupSlackIntegration() > **setupSlackIntegration**(`client`, `slackId`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) ### Description Sets up the Slack integration for your ChatBotKit client. ### Parameters #### client - **client** (`ChatBotKitClient`) - Required - The ChatBotKit client instance. #### slackId - **slackId** (`string`) - Required - The Slack ID for the integration. ### Returns - A `Promise` that resolves with an empty object upon successful setup. ``` -------------------------------- ### Get Skillsets Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves a list of all skillsets. ```APIDOC ## Get Skillsets ### Description Get the skillsets. ### Method GET ### Endpoint /skillsets ### Returns [`SkillsetResource`](SkillsetResource.md)[] ``` -------------------------------- ### Constructor Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/slack/classes/SlackIntegrationClient.md Initializes a new instance of the SlackIntegrationClient. ```APIDOC ## Constructor > **new SlackIntegrationClient**(`options`): `SlackIntegrationClient` #### Parameters ##### options [`ChatBotKitClientOptions`](../../../client/interfaces/ChatBotKitClientOptions.md) #### Returns `SlackIntegrationClient` ``` -------------------------------- ### Get Skillset Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves the skillset configuration. ```APIDOC ## Get Skillset ### Description Get the skillset. ### Method GET ### Endpoint /skillset ### Returns `object` ``` -------------------------------- ### Get Secrets Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves a list of all secrets. ```APIDOC ## Get Secrets ### Description Get the secrets. ### Method GET ### Endpoint /secrets ### Returns [`SecretResource`](SecretResource.md)[] ``` -------------------------------- ### Get Secret Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves a specific secret. ```APIDOC ## Get Secret ### Description Get the secret. ### Method GET ### Endpoint /secret ### Returns `object` ``` -------------------------------- ### slug Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/ExtractIntegrationResource.md Gets the slug identifier for the resource. ```APIDOC ## slug ### Description Gets the slug identifier for the resource. ### Signature ```typescript get slug(): string ``` ### Returns `string` - The slug of the resource. ``` -------------------------------- ### setupWhatsAppIntegration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/integration/whatsapp/v1/README.md Sets up a new WhatsApp integration. ```APIDOC ## setupWhatsAppIntegration ### Description Sets up a new WhatsApp integration. ### Method POST ### Endpoint /integration/whatsapp/v1/setup ### Parameters #### Request Body - **requestBody** (WhatsAppIntegrationSetupRequestBody) - Required - The request body for setting up a WhatsApp integration. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **data** (WhatsAppIntegrationSetupResponseBody) - The response body containing details of the setup. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### EventClient Initialization and Usage Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/event/classes/EventClient.md Demonstrates how to initialize the EventClient and use its 'log' sub-client to list, export, and subscribe to events. ```APIDOC ## EventClient Defined in: [event/index.js:26](https://github.com/chatbotkit/node-sdk/blob/main/sdks/node/packages/sdk/src/event/index.js#L26) Event client for accessing event-related functionality. This client provides access to ChatBotKit's event system, including event logs that record all significant platform activities. Use the `log` sub-client to list, export, or subscribe to events. ### Constructor > **new EventClient**(`options`): `EventClient` #### Parameters ##### options [`ChatBotKitClientOptions`](../../client/interfaces/ChatBotKitClientOptions.md) #### Returns `EventClient` ### Properties #### log > **log**: [`EventLogClient`](../log/classes/EventLogClient.md) ### Example ```ts const client = new EventClient({ secret: 'your-secret' }) // List recent events const events = await client.log.list({ take: 100 }) // Export events for a specific conversation const exported = await client.log.export({ conversationId: 'conv_123' }) // Subscribe to live events (Pro+ only) const stream = client.log.subscribe() for await (const event of stream) { console.log('Live event:', event.data.type) } ``` ``` -------------------------------- ### type Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/SlackIntegrationResource.md Gets the type of the Slack integration resource. ```APIDOC ## type ### Description Gets the type of the Slack integration resource. ### Method GET ### Endpoint /type ### Returns `string` - The type of the resource. ``` -------------------------------- ### name Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/SlackIntegrationResource.md Gets the name of the Slack integration resource. ```APIDOC ## name ### Description Gets the name of the Slack integration resource. ### Method GET ### Endpoint /name ### Returns `string` - The name of the resource. ``` -------------------------------- ### Initialize and Use EventClient Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/event/classes/EventClient.md Instantiate the EventClient with your secret key. Use the `log` sub-client to list recent events, export events for a specific conversation, or subscribe to live event streams. Subscription to live events requires a Pro+ plan. ```typescript const client = new EventClient({ secret: 'your-secret' }) // List recent events const events = await client.log.list({ take: 100 }) // Export events for a specific conversation const exported = await client.log.export({ conversationId: 'conv_123' }) // Subscribe to live events (Pro+ only) const stream = client.log.subscribe() for await (const event of stream) { console.log('Live event:', event.data.type) } ``` -------------------------------- ### searchPlatformTutorials Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/tutorial/v1/functions/searchPlatformTutorials.md Searches for platform tutorials using the provided client and request parameters. Returns a Promise that resolves to an empty object. ```APIDOC ## Function: searchPlatformTutorials() > **searchPlatformTutorials**(`client`, `request`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) Searches for platform tutorials. ### Parameters * **client** (`ChatBotKitClient`): The ChatBotKit client instance. * **request** (object): An object containing the search parameters. (Specific fields not detailed in source) ### Returns * [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) A Promise that resolves to an empty object upon successful execution. ``` -------------------------------- ### type Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/NotionIntegrationResource.md Gets the type of the resource. Inherited from Resource. ```APIDOC ## type ### Description Gets the type of the resource. ### Method GET ### Endpoint /type ### Returns - **string** - The type of the resource. ``` -------------------------------- ### slug Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/NotionIntegrationResource.md Gets the slug of the resource. Inherited from Resource. ```APIDOC ## slug ### Description Gets the slug of the resource. ### Method GET ### Endpoint /slug ### Returns - **string** - The slug of the resource. ``` -------------------------------- ### name Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/NotionIntegrationResource.md Gets the name of the resource. Inherited from Resource. ```APIDOC ## name ### Description Gets the name of the resource. ### Method GET ### Endpoint /name ### Returns - **string** - The name of the resource. ``` -------------------------------- ### Get Slack Integrations Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves a list of all Slack integrations. ```APIDOC ## Get Slack Integrations ### Description Get the slack integrations. ### Method GET ### Endpoint /slackIntegrations ### Returns [`SlackIntegrationResource`](SlackIntegrationResource.md)[] ``` -------------------------------- ### load() Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Loads a solution from a configuration object or a file. ```APIDOC ## load(config) ### Description Loads a solution from a configuration object or a file. ### Parameters #### config - **config** (string | object) - The configuration object or file path for the solution. - `resources?`: Array of resource objects. - `version?`: Solution version. ### Returns - `Promise` - A promise that resolves with the loaded Solution object. ``` -------------------------------- ### Get Slack Integration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves the Slack integration configuration. ```APIDOC ## Get Slack Integration ### Description Get the slack integration. ### Method GET ### Endpoint /slackIntegration ### Returns `object` ``` -------------------------------- ### Create and List Integrations with ChatBotKit Source: https://context7.com/chatbotkit/node-sdk/llms.txt Demonstrates how to create Slack and WhatsApp integrations, and list widget integrations using the ChatBotKit SDK. Ensure your CHATBOTKIT_API_SECRET and other relevant tokens are set as environment variables. ```javascript import { ChatBotKit } from '@chatbotkit/sdk' const cbk = new ChatBotKit({ secret: process.env.CHATBOTKIT_API_SECRET }) // Create a Slack integration const { id: slackId } = await cbk.integration.slack.create({ name: 'My Slack Bot', botId: 'bot-abc123', botToken: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET, }) // Create a WhatsApp integration const { id: waId } = await cbk.integration.whatsapp.create({ name: 'WhatsApp Support', botId: 'bot-abc123', phoneNumberId: process.env.WA_PHONE_NUMBER_ID, accessToken: process.env.WA_ACCESS_TOKEN, }) // List all widget integrations const { items } = await cbk.integration.widget.list() console.log(items.map(w => w.name)) // Create an MCP server integration const { id: mcpId } = await cbk.integration.mcpserver.create({ name: 'My MCP Server', botId: 'bot-abc123', }) ``` -------------------------------- ### Get Sitemap Integrations Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves a list of all sitemap integrations. ```APIDOC ## Get Sitemap Integrations ### Description Get the sitemap integrations. ### Method GET ### Endpoint /sitemapIntegrations ### Returns [`SitemapIntegrationResource`](SitemapIntegrationResource.md)[] ``` -------------------------------- ### Constructor Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/McpServerIntegrationResource.md Initializes a new instance of the McpServerIntegrationResource class. ```APIDOC ## Constructor ### Signature ```typescript new McpServerIntegrationResource(config: McpServerIntegrationResourceConfig): McpServerIntegrationResource ``` ### Parameters #### config - **config** (McpServerIntegrationResourceConfig) - Required - Configuration object for the McpServerIntegrationResource. ### Returns - `McpServerIntegrationResource` - An instance of McpServerIntegrationResource. ``` -------------------------------- ### Get Sitemap Integration Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/Solution.md Retrieves the sitemap integration configuration. ```APIDOC ## Get Sitemap Integration ### Description Get the sitemap integration. ### Method GET ### Endpoint /sitemapIntegration ### Returns `object` ``` -------------------------------- ### Create a New ChatBotKit Application Source: https://github.com/chatbotkit/node-sdk/blob/main/tools/create-cbk-app/README.md Run this command to initialize a new ChatBotKit application with the specified name. ```bash npx create-cbk-app my-app ``` -------------------------------- ### list Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/platform/manual/classes/PlatformManualClient.md Retrieves a list of all available platform manuals. ```APIDOC ## list request? ### Description Retrieves a list of all platform manuals. ### Parameters #### Query Parameters - **request** ([`PlatformManualListRequest`](../v1/type-aliases/PlatformManualListRequest.md)) - Optional - Request object for listing manuals. ### Returns [`ResponsePromise`](../../../client/classes/ResponsePromise.md)
{} ``` -------------------------------- ### slug Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/cli/docs/solution/classes/SlackIntegrationResource.md Gets the slug identifier for the Slack integration resource. ```APIDOC ## slug ### Description Gets the slug identifier for the Slack integration resource. ### Method GET ### Endpoint /slug ### Returns `string` - The slug of the resource. ``` -------------------------------- ### Constructor Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/skillset/ability/classes/SkillsetAbilityClient.md Initializes a new instance of the SkillsetAbilityClient. ```APIDOC ## new SkillsetAbilityClient(options: ChatBotKitClientOptions): SkillsetAbilityClient ### Description Initializes a new instance of the SkillsetAbilityClient. ### Parameters #### options - **options** (ChatBotKitClientOptions) - Required - Options for the client. ### Returns - `SkillsetAbilityClient` - An instance of SkillsetAbilityClient. ``` -------------------------------- ### triggerTask Source: https://github.com/chatbotkit/node-sdk/blob/main/packages/sdk/docs/task/v1/README.md Triggers a task to start execution. Use this to manually initiate a task. ```APIDOC ## triggerTask ### Description Triggers a task to start execution. ### Method triggerTask(request: TaskTriggerRequest) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **request** (TaskTriggerRequest) - Required - The request object for triggering a task. ### Request Example ```json { "example": "TaskTriggerRequest object" } ``` ### Response #### Success Response (200) - **response** (TaskTriggerResponse) - The response object after triggering the task. #### Response Example ```json { "example": "TaskTriggerResponse object" } ``` ```