fix(heartbeat): pass accountId for Telegram delivery
Heartbeat Telegram delivery was failing when the bot token was configured only via telegram.botToken in config (without TELEGRAM_BOT_TOKEN environment variable). Root cause: deliverOutboundPayloads was called without accountId parameter, so sendMessageTelegram couldn't determine which account to use and couldn't find the token from config. Fix: Resolve default Telegram accountId when provider is "telegram" and pass it to deliverOutboundPayloads. This follows the same pattern used elsewhere in the codebase (e.g., cron uses resolveTelegramToken). Changes: - Added import for resolveDefaultTelegramAccountId - Added accountId resolution for telegram provider - Updated deliverOutboundPayloads call to include accountId Fixes #318 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import { createSubsystemLogger } from "../logging.js";
|
||||
import { getQueueSize } from "../process/command-queue.js";
|
||||
import { webAuthExists } from "../providers/web/index.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { resolveDefaultTelegramAccountId } from "../telegram/accounts.js";
|
||||
import { getActiveWebListener } from "../web/active-listener.js";
|
||||
import { emitHeartbeatEvent } from "./heartbeat-events.js";
|
||||
import {
|
||||
@@ -315,10 +316,17 @@ export async function runHeartbeatOnce(opts: {
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve accountId for providers that support multiple accounts
|
||||
const accountId =
|
||||
delivery.provider === "telegram"
|
||||
? resolveDefaultTelegramAccountId(cfg)
|
||||
: undefined;
|
||||
|
||||
await deliverOutboundPayloads({
|
||||
cfg,
|
||||
provider: delivery.provider,
|
||||
to: delivery.to,
|
||||
accountId,
|
||||
payloads: [
|
||||
{
|
||||
text: normalized.text,
|
||||
|
||||
Reference in New Issue
Block a user