Packages · Chat
@notifkit/provider-telegram
The Telegram transport. Delivers notifications via the Telegram Bot API to individual chat IDs or channels, with HTML/Markdown formatting, link preview controls, and automatic contact deactivation when blocked.
npm install @notifkit/provider-telegram
import { NotifkitServer } from "notifkit";
import { TelegramTransport } from "@notifkit/provider-telegram";
const server = new NotifkitServer({
services: ["all"],
providers: [
new TelegramTransport({
botToken: process.env.TELEGRAM_BOT_TOKEN!,
}),
],
});
Options
| Option | Required | Notes |
|---|---|---|
botToken | yes | Bot API token obtained from Telegram's @BotFather. |
logger | no | A notifkit logger instance. |
limits | no | Provider sliding-window rate limit. Defaults to { limit: 1000, windowSeconds: 10 }. |
Recipient targeting
A recipient must interact with your bot (e.g. sending /start) before the bot can message them. Store their Telegram Chat ID as their contact target:
await notifkit.addContact("usr_123", {
channel: "telegram",
target: "5910738042",
});
Template keys & formatting
| Template key | Lands as |
|---|---|
text or body | Message text. |
parseMode | Formatting mode: "HTML", "MarkdownV2", or "Markdown". |
disableWebPagePreview | Boolean. When true, suppresses URL preview thumbnails. |
disableNotification | Boolean. When true, sends the message silently with no notification sound. |
deactivation on block
If a user blocks the bot or deletes the chat, Telegram returns bot was blocked by the user or chat not found. notifkit marks the contact target invalid and halts retries.