A Telegram bot your customers message.
Install
Terminal
npx shadcn@latest add @tendkit/channel-telegramIt lands in lib/support/channels/. Import telegramChannel from there.
Set up
Create the bot
With @BotFather (
/newbot). Copy the token.Register the webhook
Once:
curl https://api.telegram.org/bot<token>/setWebhook -d url=<webhook URL> -d secret_token=<secretToken>withallowed_updatesset to messages.
Configure
lib/support/index.ts
telegramChannel({
id: "telegram",
botToken: process.env.TELEGRAM_BOT_TOKEN!,
secretToken: process.env.TELEGRAM_SECRET_TOKEN!,
botUsername: "acme_support_bot",
})Options
| Name | Type | Description |
|---|---|---|
id* | string | Stable channel id, stored on every ticket and used in the webhook URL. Never change it. |
botToken* | string | From @BotFather. It's part of file download URLs, so never log those. |
secretToken* | string | The secret_token passed to setWebhook: 1 to 256 of A-Z, a-z, 0-9, _ and -. |
botUsername* | string | Without the "@", for display. |
Behaviour
- Only private chats are handled. The bot can only write to people who messaged it first. Files up to 20 MB.