bot

Routes inbound chat platform messages to AI agents and replies via platform clients.

Updated Jan 27, 2026
One-click install
npx skills add https://github.com/SmallAi-API/smaihub --skill bot-smallai-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bot
Source: https://github.com/SmallAi-API/smaihub/tree/main/.agents/skills/bot
Command: npx skills add https://github.com/SmallAi-API/smaihub --skill bot-smallai-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Connecting AI agents to external chat platforms like Discord, Slack, Telegram, Feishu, Lark, QQ, and WeChat requires handling webhooks, message routing, credentials, and platform-specific quirks. This Skill maps the entire bot architecture so you can work on inbound webhooks, agent execution, and gateway lifecycle without getting lost. ## Core Features & Use Cases - Inbound Message Routing: Understand how webhooks flow through the Chat SDK, BotMessageRouter, and AgentBridgeService to reach AiAgentService and back out via per-platform clients. - Execution & Connection Modes: Navigate in-memory vs queue (QStash) execution modes and webhook/websocket/polling connection modes, including the gateway cron lifecycle for persistent platforms. - Platform Extension: Follow the documented steps to add a new platform with definition, schema, client factory, and protocol spec. - Use Case: When a Slack bot stops replying after a credentials update, use this Skill to trace cache invalidation via BotMessageRouter.invalidateBot and the TRPC update mutation. ## Quick Start Use the bot skill to explain how an inbound Discord mention flows from the webhook route to the agent reply.

Frequently Asked Questions about bot

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

FAQPage Schema
How do I add a new chat platform to the bot system?

Create a directory under src/server/services/bot/platforms with definition.ts, schema.ts, client.ts, const.ts, and protocol-spec.md files. Implement a ClientFactory returning a PlatformClient, register it in platforms/index.ts, add the UI icon, and add i18n keys for the schema labels.

How does inbound webhook message routing work for bot platforms?

A POST to /api/agent/webhooks/[platform]/[appId] hits BotMessageRouter, which lazy-loads the bot, merges schema defaults with provider settings, and registers Chat SDK handlers. Events then flow to AgentBridgeService, which executes the agent via AiAgentService and replies through the platform client.

What is the difference between in-memory and queue execution modes?

In-memory mode runs execAgent with stepCallbacks in one process, editing a progress message live with a 30-minute timeout. Queue mode posts step and completion webhooks delivered via QStash to /api/agent/webhooks/bot-callback, returning immediately while BotCallbackService handles updates.

Which platforms support markdown and message editing in bot replies?

Discord, Slack, and Telegram support both markdown and message editing. Feishu and Lark strip markdown but support edits, while QQ and WeChat support neither, so only final plain-text replies are sent.

Why does a bot stop responding after updating its credentials?

The router caches loaded bots in memory, but the TRPC update and delete mutations call BotMessageRouter.invalidateBot to clear the cache. If changes do not take effect, verify the invalidation ran and that the gateway client was stopped via GatewayService.stopClient.

How do persistent websocket bots run on serverless platforms like Vercel?

GatewayService pushes connect requests to a Redis-backed BotConnectQueue and marks status queued. A cron hitting GET /api/agent/gateway starts persistent providers within a 10-minute window and polls the queue every 30 seconds for new requests.