Tendkit

Search documentation

Find a docs page

Get Started

Telegram

A Telegram bot your customers message.

Install

Terminal
npx shadcn@latest add @tendkit/channel-telegram

It lands in lib/support/channels/. Import telegramChannel from there.

Set up

  1. Create the bot

    With @BotFather (/newbot). Copy the token.

  2. Register the webhook

    Once: curl https://api.telegram.org/bot<token>/setWebhook -d url=<webhook URL> -d secret_token=<secretToken> with allowed_updates set 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

NameTypeDescription
id*stringStable channel id, stored on every ticket and used in the webhook URL. Never change it.
botToken*stringFrom @BotFather. It's part of file download URLs, so never log those.
secretToken*stringThe secret_token passed to setWebhook: 1 to 256 of A-Z, a-z, 0-9, _ and -.
botUsername*stringWithout 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.