Skip to content

Find a component

Loading the directory…

↑ ↓ to select · Enter to open · Esc to closeBrowse all →
Contributor login

Clawdbot Hub

Message hub component for ClawdBot — webhook processing, session management, conversation history, and multi-gateway support for Bijection

Bijection source
git clone https://github.com/bijectionhq/clawdbot-hub.git
cd clawdbot-hub
git checkout b0d9c111a9fe982b121ec0a5bca8babd80914c86

Bijection repository access is required. Request access.

Description

Message hub component for ClawdBot — webhook processing, session management, conversation history, and multi-gateway support for Bijection

Explore the package README for API concepts, configuration, and examples. Check the Bijection source for adaptation-specific setup.

Available to evaluate

Review the source and its dependencies before adopting this package. Source availability does not establish npm publication or runtime qualification.

Getting started

  1. Get the source at the revision above and read its package documentation.
  2. Check the required Bijection SDK version, dependencies, and external service credentials.
  3. Follow the package setup instructions and the guide to using components.
  4. Exercise the component in your deployment according to your project’s verification rules.

Open source

Maintained source: bijectionhq/clawdbot-hub. Based on TimpiaAI/convex-clawdbot-hub. License: MIT. Consult the repository for license terms, notices, and contributor attribution.

From the upstream publisher

Message hub component for ClawdBot — webhook processing, session management, conversation history, and multi-gateway support for Convex

Explore the demo ↗

Upstream overview

From the upstream package documentation.

A Convex Component that provides message hub infrastructure for AI chatbots with webhook processing, session management, and conversation history. Handles message deduplication, configurable session scoping (per-user, per-channel, per-peer), and multi-gateway routing for WhatsApp, Telegram, Discord, Slack and custom integrations. Includes real-time subscriptions for web dashboards and TTL-based cleanup with TypeScript generics for type-safe user/channel IDs.

Use cases

From the upstream package documentation.

  • Building multi-platform chatbots that need to handle messages from WhatsApp, Telegram, Discord, and Slack through a unified backend with consistent session management
  • Creating AI agents with conversation memory that maintain context across interactions using configurable session scopes and paginated message history retrieval
  • Processing webhook-based messaging where you need automatic deduplication, reliable message storage, and real-time updates for dashboard interfaces
  • Managing chat sessions at scale with different scoping strategies (per-user for cross-channel bots, per-channel for group chats, per-peer for direct messages)
  • Building messaging analytics dashboards that require real-time subscriptions to conversation data with threading support and reply context

How it works

From the upstream package documentation.

The component centers around the ClawdBotHub class which processes inbound messages through processInbound() with automatic deduplication based on gateway message IDs. Sessions are created and managed using configurable scopes: "user" for single user across channels, "channel" for group chats, or "peer" for user-channel pairs.

Message processing flows through HTTP actions that receive webhook payloads, then store messages with session resolution and gateway routing. The sendOutbound() method handles bot responses while getMessages() provides paginated conversation history. Real-time updates work through reactive queries like getLatestMessages() that automatically update dashboard interfaces.

Setup involves registering the component in convex.config.ts, creating wrapper functions for webhooks and queries, then registering gateways with registerGateway(). The component includes built-in cron jobs for cleanup using pruneSessions() and pruneDedup() to manage TTL-based data retention.

Upstream package FAQ

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.

Use with agents and CLI

Give your coding agent the component’s source identity and setup guidance.

agent-prompt.md
Help me integrate Clawdbot Hub with Bijection.

Read: https://bijection.com/components/clawdbot-hub/SKILL.md

Check SDK compatibility and dependency availability.
Follow this project's execution and verification rules.

Upstream README.md

View repository ↗

Documentation from TimpiaAI/convex-clawdbot-hub, recorded October 23, 2026. APIs and setup may differ in the Bijection adaptation.

convex-clawdbot-hub

Message hub backend for ClawdBot

Webhook processing • Session management • Conversation history • Multi-gateway support

View Demo • Documentation • API Reference


Message hub backend for ClawdBot — webhook processing, session management, conversation history, and multi-gateway support. Built as a Convex Component.

Features

  • Webhook processing — receive and store inbound messages with automatic deduplication
  • Session management — configurable scoping (per-user, per-channel, per-peer)
  • Conversation history — paginated retrieval with threading and reply context
  • Multi-gateway support — route messages from WhatsApp, Telegram, Discord, Slack, and custom gateways
  • Real-time subscriptions — reactive queries for web dashboards
  • TTL-based pruning — cron-friendly cleanup for sessions and dedup records
  • TypeScript generics — type-safe user/channel IDs

Installation

npm install convex-clawdbot-hub

Setup

1. Register the component

// convex/convex.config.ts
import { defineApp } from "convex/server";
import clawdbotHub from "convex-clawdbot-hub/convex.config";

const app = defineApp();
app.use(clawdbotHub);

export default app;

2. Create your backend functions

// convex/hub.ts
import { ClawdBotHub } from "convex-clawdbot-hub";
import { components } from "./_generated/api.js";
import { httpAction, mutation, query } from "./_generated/server.js";
import { v } from "convex/values";

const hub = new ClawdBotHub(components.clawdbotHub);

// Process inbound webhook from any ClawdBot gateway
export const webhook = httpAction(async (ctx, request) => {
  const body = await request.json();

  const result = await hub.processInbound(ctx, {
    gateway: body.gateway,
    gatewayMessageId: body.messageId,
    channelId: body.channelId,
    userId: body.userId,
    content: body.content,
    sessionScope: "peer",
  });

  if (!result) {
    return new Response("duplicate", { status: 200 });
  }

  return new Response(JSON.stringify(result), {
    status: 200,
    headers: { "Content-Type": "application/json" },
  });
});

// Send bot response
export const sendReply = mutation({
  args: {
    sessionId: v.string(),
    gateway: v.string(),
    channelId: v.string(),
    userId: v.string(),
    content: v.string(),
  },
  handler: async (ctx, args) => {
    return await hub.sendOutbound(ctx, args);
  },
});

// Get conversation history
export const getHistory = query({
  args: { sessionId: v.string(), limit: v.optional(v.number()) },
  handler: async (ctx, args) => {
    return await hub.getMessages(ctx, args);
  },
});

// Real-time latest messages (subscribe for live updates)
export const liveMessages = query({
  args: { sessionId: v.string() },
  handler: async (ctx, args) => {
    return await hub.getLatestMessages(ctx, { sessionId: args.sessionId, limit: 20 });
  },
});

3. Register your gateways

export const setupGateway = mutation({
  args: { gatewayId: v.string(), name: v.string(), type: v.string() },
  handler: async (ctx, args) => {
    return await hub.registerGateway(ctx, args);
  },
});

API Reference

Webhook Processing

MethodDescription
processInbound(ctx, args)Process inbound message with dedup and session resolution
sendOutbound(ctx, args)Store an outbound bot/agent response

Session Management

MethodDescription
getOrCreateSession(ctx, { gateway, userId, channelId, scope? })Find or create session by scope
getSession(ctx, { sessionId })Get session details
listSessions(ctx, { userId?, gateway?, activeOnly?, limit? })List sessions with filters
endSession(ctx, { sessionId })Mark session as inactive

Session Scopes

ScopeKeyUse Case
"user"One session per user per gatewaySingle user across channels
"channel"One session per channel per gatewayGroup chat / shared channel
"peer"One session per user+channel pairDefault — most common for DMs

Conversation History

MethodDescription
getMessages(ctx, { sessionId, limit?, before?, after? })Paginated history
getThread(ctx, { threadId, limit? })Get all messages in a thread
getLatestMessages(ctx, { sessionId, limit? })Most recent N messages (reactive)

Gateway Management

MethodDescription
registerGateway(ctx, { gatewayId, name, type, config? })Register a gateway (idempotent)
removeGateway(ctx, { gatewayId })Deactivate a gateway
listGateways(ctx, { activeOnly? })List all gateways

Cleanup

// convex/crons.ts
import { cronJobs } from "convex/server";
const crons = cronJobs();

// Prune inactive sessions older than 7 days
crons.daily("prune sessions", { hourUTC: 3, minuteUTC: 0 },
  internal.hub.pruneSessions);

// Clean up dedup records older than 24 hours
crons.hourly("prune dedup", { minuteUTC: 30 },
  internal.hub.pruneDedup);

export default crons;

TypeScript Generics

import { Id } from "./_generated/dataModel.js";

// Type-safe with your app's ID types:
const hub = new ClawdBotHub<Id<"users">, Id<"channels">>(
  components.clawdbotHub
);

// Or with string IDs:
const hub = new ClawdBotHub<string, string>(components.clawdbotHub);

🚀 Live Demo

View the live demo → Click here to see ClawdBot Hub in action

License

MIT


Keywords