ClawdBot Message Hub

Complete backend infrastructure for multi-platform AI chatbots with webhook processing, session management, and conversation history on Convex.

Installation

npm install convex-clawdbot-hub

About ClawdBot Message Hub

**Backend infrastructure for multi-platform AI chatbots on Convex.**

Handles the full message lifecycle from webhook ingestion to conversation history, so you can focus on your bot's logic.

- Multi-gateway support: WhatsApp, Telegram, Discord, Slack
- Session management with configurable scoping (per-user, per-channel, per-peer)
- Automatic message deduplication & TTL-based pruning
- Paginated conversation history with threading
- Real-time subscriptions out of the box

Benefits

Use cases

how to build multi-platform chatbot backend with session management

ClawdBotHub provides complete backend infrastructure with session management across multiple platforms. It handles webhook processing from WhatsApp, Telegram, Discord, and Slack with configurable session scoping (per-user, per-channel, or per-peer).

webhook processing and message deduplication for chatbots

The processInbound method automatically handles webhook deduplication and stores messages with proper session resolution. It returns null for duplicates, so your bot logic only processes unique messages once.

conversation history and threading for AI chatbots

Use getMessages for paginated conversation history and getThread for threaded conversations. The component provides real-time subscriptions through getLatestMessages for live dashboard updates.

chatbot session management across multiple channels

Configure session scopes as 'user' (one session per user), 'channel' (one per channel), or 'peer' (one per user-channel pair). Sessions are automatically created and can be filtered by user, gateway, or activity status.

Frequently asked questions

What platforms does ClawdBotHub support for chatbot integration?

ClawdBotHub supports WhatsApp, Telegram, Discord, Slack, and custom gateways through its multi-gateway architecture. Each gateway is registered with a unique ID and can process inbound/outbound messages through the unified webhook processing system.

How does session scoping work in ClawdBotHub?

ClawdBotHub offers three session scopes: 'user' creates one session per user per gateway, 'channel' creates one session per channel per gateway, and 'peer' creates one session per user-channel combination. The 'peer' scope is most common for direct messages.

Does ClawdBotHub handle message deduplication automatically?

Yes, ClawdBotHub automatically deduplicates messages using gateway message IDs. The processInbound method returns null for duplicate messages and includes TTL-based pruning to clean up deduplication records after 24 hours.

How do I get real-time updates for chatbot conversations?

ClawdBotHub provides reactive queries through getLatestMessages that automatically update when new messages arrive. This enables real-time dashboards and live conversation monitoring without manual polling.

Can I use TypeScript generics with ClawdBotHub for type safety?

Yes, ClawdBotHub supports TypeScript generics for user and channel ID types. You can specify your app's ID types like ClawdBotHub<Id<'users'>, Id<'channels'>> or use string types for external platform IDs.

Links