Add accountId and config support to Telegram webhook

The Telegram webhook and monitor now accept and pass through accountId and config parameters, enabling routing and configuration per Telegram account. Tests have been updated to verify correct bot instantiation and DM routing based on accountId bindings.
This commit is contained in:
Gustavo Madeira Santana authored and Peter Steinberger committed 2026-01-13 03:34:32 +00:00
1 parent ab993904d7
commit ecb91bbb1a
4 files changed
+69 -4

No files matched your search

+5
View File
@@ -1,6 +1,7 @@
import { createServer } from "node:http";
import { webhookCallback } from "grammy";
import type { ClawdbotConfig } from "../config/config.js";
import { formatErrorMessage } from "../infra/errors.js";
import type { RuntimeEnv } from "../runtime.js";
import { defaultRuntime } from "../runtime.js";
@@ -8,6 +9,8 @@ import { createTelegramBot } from "./bot.js";
export async function startTelegramWebhook(opts: {
token: string;
accountId?: string;
config?: ClawdbotConfig;
path?: string;
port?: number;
host?: string;
@@ -27,6 +30,8 @@ export async function startTelegramWebhook(opts: {
token: opts.token,
runtime,
proxyFetch: opts.fetch,
config: opts.config,
accountId: opts.accountId,
});
const handler = webhookCallback(bot, "http", {
secretToken: opts.secret,