@opentag/telegram
Telegram message normalization and callback helpers for OpenTag.
Use this package to normalize Telegram bot messages into OpenTagEvent objects
and to encode or parse Telegram callback thread keys.
Install
pnpm add @opentag/telegram
Exports
normalizeTelegramMessage: converts a Telegram message into an OpenTagEvent.
encodeTelegramThreadKey: encodes bot, chat, and message coordinates for callback routing.
parseTelegramThreadKey: decodes a Telegram callback thread key.
renderTelegramAcknowledgement: renders the Telegram acknowledgement body.
renderTelegramFinalResult: renders the Telegram final result body.
createTelegramSendMessagePayload: creates a Telegram Bot API sendMessage payload.
Example
import { normalizeTelegramMessage } from "@opentag/telegram";
const event = normalizeTelegramMessage({
botId: "bot_123",
botUsername: "opentag_bot",
chatId: "456",
chatType: "private",
userId: "789",
username: "alice",
text: "investigate this deploy failure",
messageId: 101,
updateId: 202,
binding: {
botId: "bot_123",
chatId: "456",
repoProvider: "github",
owner: "acme",
repo: "demo"
}
});
if (event) {
}
Stability
Telegram thread key format is public because callback sinks depend on it.
Change it only with a migration path.