chat-sdk

Build multi-platform chat bots for Slack, Teams, Discord, and Linear with one TypeScript SDK.

74|11|Updated Jul 4, 2024
One-click install
npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill chat-sdk-opensourceagi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: chat-sdk
Source: https://github.com/OpenSourceAGI/qwksearch-research-agent/tree/main/apps/qwk-in-lobe/.agents/skills/chat-sdk
Command: npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill chat-sdk-opensourceagi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires chat, @chat-adapter/slack, @chat-adapter/teams, @chat-adapter/gchat, @chat-adapter/discord, @chat-adapter/github, @chat-adapter/linear, @chat-adapter/state-redis.

What problem does it solve? Writing chat bots separately for Slack, Microsoft Teams, Google Chat, Discord, GitHub, and Linear means duplicating event handling, webhook routing, and message formatting for every platform. This Skill provides a unified TypeScript SDK so bot logic is written once and deployed across all supported platforms. ## Core Features & Use Cases - Unified Event Handlers: Handle mentions, subscribed thread messages, slash commands, reactions, button actions, and modals through one normalized API. - Streaming AI Responses: Pass any AsyncIterable, such as the AI SDK's textStream, directly to thread.post for live-streamed bot replies. - JSX Cards and Interactive Components: Build interactive cards with buttons, selects, fields, and images using JSX components rendered per platform. - Pluggable State Adapters: Persist thread subscriptions with Redis or ioredis in production and in-memory state during development. - Use Case: Build a support bot that responds to @mentions in Slack and Discord, streams answers from an LLM, and posts approval cards with action buttons, all from a single codebase. ## Quick Start Use the chat-sdk skill to scaffold a Slack bot that responds to new mentions and streams an AI-generated reply into the thread.

Frequently Asked Questions about chat-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a Slack bot in TypeScript that responds to mentions?

Create a Chat instance with the Slack adapter configured with your bot token and signing secret, then register an onNewMention handler. Inside the handler, call thread.subscribe and thread.post to reply in the conversation.

How to stream AI responses into a chat thread?

Pass any AsyncIterable of strings directly to thread.post, such as the textStream from the AI SDK's agent.stream call. The SDK handles progressive message updates across supported platforms automatically.

Does the chat SDK support platforms besides Slack?

Yes, adapters exist for Microsoft Teams, Google Chat, Discord, GitHub Issues, and Linear Issues. You configure each adapter in the Chat constructor and the same event handlers work across all of them.

What state storage should I use for production chat bots?

Use the Redis state adapter (@chat-adapter/state-redis) or the ioredis variant for production deployments. The in-memory state adapter is intended only for development since it does not persist subscriptions across restarts.

How do I add interactive buttons and cards to bot messages?

Set jsxImportSource to chat in tsconfig, then post JSX components like Card, CardText, Button, and Actions. Handle button clicks by registering an onAction handler with the matching action id.