ChatBotKit Node SDK

Follow on Twitter ChatBotKit

ChatBotKit Node SDK

Welcome to the ChatBotKit Node SDK. This SDK offers a Node.js-based platform for effortlessly building conversational AI chatbots. With ChatBotKit, you can swiftly develop and deploy AI bots capable of natural language interactions.

SDK Features

  • Easy Setup: Quick and straightforward installation process.
  • Serverless Compatibility: Works seamlessly with modern runtime environments like Serverless, Edge, Vercel, Netlify, Cloudflare Workers, Deno, AWS Lambda, and more.
  • Modern Framework Support: Built-in support for CommonJS, ECMAScript Modules, async/await, streams, etc.
  • Customizability: Tailor the chatbot’s behavior and responses to fit specific use cases.
  • Multi-Platform: Deploy chatbots on websites, mobile apps, and messaging platforms like Slack, Discord, and WhatsApp.
  • Multi-Model: Support for a wide range of language models, including GPT-3, GPT-4, Claude, and more.

ChatBotKit Capabilities

  • πŸ—¨ Chat History: Review and reference past conversations.
  • πŸ’Ύ Custom Datasets: Organize data for bot responses.
  • πŸ’‘ Custom Skillset: Equip chatbots with unique abilities like image generation or web fetching.
  • πŸ“„ Document File Importing: Import various document file types into chatbot datasets.
  • 🎡 Media File Importing: Import a range of media file formats into chatbot datasets.
  • 🌐 Widget Integration: Seamlessly embed chatbots on websites with customizable options.
  • πŸ’¬ Slack, Discord, WhatsApp Bot Integrations: Easy integration with popular messaging platforms.
  • πŸ—Ί Sitemap Integration: Ingest website content into a searchable knowledge base.
  • πŸ€– Multi-vendor Model Support: Utilize advanced language models for conversation.
  • πŸŽ₯ Streaming: Enable/disable streaming capabilities.
  • πŸ”’ Data Security: Robust measures to protect user data.
  • πŸ•΅ Privacy Focus: Strong privacy controls to ensure responsible data handling.
  • 🚫 Content Moderation: Automatic scanning and flagging of abusive content.
  • πŸ’΅ Simple Pricing: Transparent and straightforward pricing.

Getting Started

Follow these steps to start with ChatBotKit:

  1. Installation:
    npm install @chatbotkit/sdk
  2. Usage: Implement the SDK in your chatbot project.

Streaming Example

This example demonstrates streaming capabilities in Edge and Serverless environments:

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') {

Next.js Example

This quick example demonstrates how to use the SDK in a Next.js project:

// 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',

// file: ./pages/index.js
import { AutoTextarea, useConversationManager } from '@chatbotkit/react'

export default function Index() {
const { thinking, text, setText, messages, submit } = useConversationManager({
endpoint: '/api/conversation/complete',

function handleOnKeyDown(event) {
if (event.keyCode === 13) {


return (
<div style={{ fontFamily: 'monospace', padding: '10px' }}>
{{ id, type, text }) => (
<div key={id}>
<strong>{type}:</strong> {text}
{thinking && (
<div key="thinking">
<strong>bot:</strong> thinking...
onChange={(e) => setText(}
placeholder="Type something..."
border: 0,
outline: 'none',
resize: 'none',
width: '100%',
marginTop: '10px',


Explore a range of examples here.

Some examples include:

Platform Example Description
Next.js Basic Chat A basic chatbot example, where the conversation is managed by ChatBotKit.
Next.js Stateless Chat A stateless chatbot example, where the conversation is managed by the client.
Next.js NextAuth Example Shows how to combine NextAuth and ChatBotKit
Node GPT4 Streaming AI chatbot A simple streaming AI chatbot example.
Cloudflare Workers GPT4 AI chatbot A streaming AI chatbot example for Cloudflare Workers.


The ChatBotKit Node SDK is comprised of the following packages:

Package Version Description
@chatbotkit/cli NPM The ChatBotKit CLI.
@chatbotkit/sdk NPM The ChatBotKit API SDK.
@chatbotkit/react NPM The ChatBotKit React SDK.
@chatbotkit/next NPM The ChatBotKit Next.js SDK.
@chatbotkit/nextauth NPM The ChatBotKit NextAuth.js SDK.
@chatbotkit/fetch NPM The ChatBotKit isometric fetch implementation.


  • Type Documentation: Detailed information on available types here.
  • Platform Documentation: Comprehensive guide to ChatBotKit here.
  • Platform Tutorials: Step-by-step tutorials for ChatBotKit here.


Encounter a bug or want to contribute? Open an issue or submit a pull request on our official GitHub repository.

Generated using TypeDoc