Skip to main content

Getting Started

This guide will walk you through installing Chat SDK and creating your first bot.

Installation

1

Install the core SDK

First, install the core chat package:
2

Install platform adapters

Install adapters for the platforms you want to support:
You only need to install adapters for platforms you plan to use. Each adapter is a separate package:
  • @chat-adapter/slack - Slack
  • @chat-adapter/teams - Microsoft Teams
  • @chat-adapter/gchat - Google Chat
  • @chat-adapter/discord - Discord
  • @chat-adapter/telegram - Telegram
  • @chat-adapter/github - GitHub
  • @chat-adapter/linear - Linear
3

Install a state adapter

Install a state adapter for persistence:
Use @chat-adapter/state-memory only for development and testing. It stores state in memory and will lose all data on restart. For production, use @chat-adapter/state-redis or @chat-adapter/state-ioredis.

Quick Start

Create Your Bot

Create a new file bot.ts and initialize your bot:
bot.ts

Environment Variables

Configure your platform credentials via environment variables:
.env
Adapter constructors automatically read credentials from environment variables. You can also pass them explicitly as options.

Set Up Webhook Handlers

Create webhook endpoints for each platform. Here’s an example using Next.js App Router:
app/api/webhooks/slack/route.ts
The waitUntil option ensures webhook responses are fast (< 3 seconds) while message processing continues in the background. This is critical for platforms like Slack that retry if responses are slow.

Platform Configuration

Each platform requires specific configuration:
1

Slack

  1. Create a Slack app at api.slack.com/apps
  2. Enable Socket Mode or configure Event Subscriptions
  3. Add bot scopes: app_mentions:read, chat:write, channels:history
  4. Set your webhook URL to https://your-domain.com/api/webhooks/slack
  5. Install the app to your workspace
2

Microsoft Teams

  1. Register your app in Azure AD
  2. Create a Teams app manifest with your bot ID
  3. Configure messaging endpoint: https://your-domain.com/api/webhooks/teams
  4. Upload the app to Teams
3

Google Chat

  1. Create a Google Cloud project
  2. Enable Google Chat API
  3. Create a service account and download credentials JSON
  4. Configure webhook URL: https://your-domain.com/api/webhooks/gchat
  5. Publish the app

Verify Installation

Test your bot by:
  1. Starting your local server
  2. Using a tool like ngrok to expose your localhost
  3. Configuring your platform webhook URL to the ngrok URL
  4. @mentioning your bot in a channel
You should see your bot respond with “Hello! I’m listening to this thread.”

Next Steps

Basic Usage

Learn core concepts and event handlers

Event Handlers

Handle mentions, messages, reactions, and more

AI Streaming

Stream LLM responses to your chat

Interactive Cards

Build rich UI with buttons and modals