feat: add Telegram connector package for mesh-to-chat bridging

Introduces @claudemesh/connector-telegram — a standalone bridge process
that joins a mesh as peerType: "connector" and relays messages
bidirectionally between a Telegram chat and mesh peers via long polling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-04-07 23:52:00 +01:00
parent 08e289a5e3
commit fe9285351b
8 changed files with 717 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
export interface TelegramConnectorConfig {
// Telegram
telegramBotToken: string; // from @BotFather
telegramChatId: string; // group chat or user chat ID
// Mesh
brokerUrl: string;
meshId: string;
memberId: string;
pubkey: string;
secretKey: string;
displayName: string; // e.g. "Telegram-DevChat"
}
export function loadConfigFromEnv(): TelegramConnectorConfig {
const required = (key: string): string => {
const val = process.env[key];
if (!val) throw new Error(`Missing required env var: ${key}`);
return val;
};
return {
telegramBotToken: required("TELEGRAM_BOT_TOKEN"),
telegramChatId: required("TELEGRAM_CHAT_ID"),
brokerUrl: required("BROKER_URL"),
meshId: required("MESH_ID"),
memberId: required("MEMBER_ID"),
pubkey: required("PUBKEY"),
secretKey: required("SECRET_KEY"),
displayName: process.env.DISPLAY_NAME || "Telegram",
};
}