Skip to content

Responsible Use

Telegram bots are an official, supported way to automate conversations, and Telegram actively limits and bans bots that spam. Following these rules keeps your bot online and your users happy. This project is not affiliated with Telegram.

  • Only message users who started your bot. A bot cannot start a conversation with someone who never wrote to it, and it should not try to work around that.
  • Honor opt-outs. Support a /stop command (or similar), remember who used it, and never message them again unless they come back.
  • Handle blocks. When sending fails with error 403, the user blocked the bot. Stop messaging them.
  • Respect the limits. Use a RateLimiter for broadcasts and do not work around HTTP 429 responses. The client already waits for the retry_after Telegram asks for.
  • Be clear about what the bot does. Describe it in @BotFather and in /start, and tell users when a human is or is not reading.
  • Keep the bot token in an environment variable or a secret manager. Revoke it with /revoke in @BotFather if it leaks.
  • Use a webhook secret so only Telegram can call your endpoint.
  • Escape untrusted text with Format::html() or Format::markdownV2() before using it in formatted messages.

Messages, user IDs, names, and files are personal data under laws such as the GDPR and Brazil’s LGPD. Keep sessions small, set TTLs on session stores, store only what you need, and give users a way to delete their data.

In groups, reply to commands addressed to your bot and avoid reacting to every message. Commands such as /start@other_bot are ignored automatically when the mention names a different bot.