Telegram Notifications Plugin (discourse-telegram-notifications)

AI-generated summary

The Discourse Telegram Notifications Plugin, developed by david, enables individual Discourse users to receive their forum notifications via Telegram bot — not for group chat sync or topic creation from chat. It’s distinct from the discourse-chat-integration plugin, which sends topic notifications to Telegram groups/channels. Both can coexist but require separate bots. Setup requires HTTPS, internet accessibility (e.g., via ngrok in dev), and BotFather configuration. Users receive a Chat ID via bot message, which they paste into their Discourse preferences. A data explorer query helps track active users. The plugin is a work in progress; david notes future goals include streamlining the user setup flow. Some users reported compatibility or SSL errors (e.g., Siddhu_Dhangar, Surendra-Patil), which david addressed with updates. Flashio noted tag-change notifications appearing as replies — a behavior mitigated in later Discourse updates, though not fully configurable. danb35 resolved a non-working setup by correcting the Chat ID. david merged a contribution from barreeeiroo. nildarar asked about using {name} instead of {username} in translations — david confirmed this requires code changes. The plugin is unofficial despite david being a Discourse team member.

Discourse Telegram Notifications Plugin

This plugin allows users to receive their notifications via a Telegram bot, allowing them to turn off email notifications and still keep up-to-date. :success:

You can “like” posts, and respond to them via the bot.

Here’s a quick demo video:

Before Starting

  • Your forum must be using HTTPS, and have force_https turned on
  • Your forum must be accessible to the internet, not only an internal network (in development, give ngrok a try).

Getting the plugin setup

  1. Install the plugin using the instructions here: How to install a plugin
  2. Create a telegram bot by talking to the BotFather (instructions here)
  3. Paste the “token” into the site setting “telegram access token”
  4. Tick “telegram notifications enabled”

I strongly recommend you use the BotFather’s /setjoingroups command to disable the bot being used for group chats. It is not designed for it, and risks leaking information that users are not supposed to be able to access (e.g. you don’t want private messages being sent to a group chat).

You can set the name/picture/description of your bot using the instructions here

For users to receive notifications

  1. Send a message to the bot, you’ll receive a message back that looks like

To get notifications for Discourse, enter the ‘Chat ID’ 1234567 in your user preferences

  1. Visit your Discourse user preferences, and paste the number in the Telegram Notifications box
  2. You should now receive notifications by telegram message!

Find out who’s using telegram for notifications

Here’s a query for the data explorer plugin:

SELECT user_id, updated_at, value from user_custom_fields
WHERE name = 'telegram_chat_id'

This is still a work in progress. I think the next task would be to improve the setup flow for the user, so they don't have to copy/paste numbers between telegram and the forum.

Related discussions are: here, here, here and here

As always, suggestions and comments are very welcome :slight_smile:

71 лайк

Я нигде в документации не вижу указания на необходимость создания группы. Напротив, там рекомендуется не разрешать боту присоединяться к группам. Отправляйте сообщения напрямую боту, а не в группу, в которой он состоит.

Согласно исходному посту (это даже выделено в заштрихованном блоке вверху), они выполняют разные функции:

1 лайк

Из первого поста:

Я сам этого не делал, но, похоже, это отвечает на вопрос.

1 лайк

Здравствуйте. Эта функция сейчас работает?

При копировании этого запроса в новый запрос Data Explorer я получаю ошибку Internal Server Error.

Если же выполнить этот запрос напрямую в базе данных, всё работает.

Странно. Я попробовал несколько других стандартных запросов. Некоторые работают, но для других я получил ту же ошибку.

Discourse: 3.0.0 stable и 3.0.1 stable

Обе версии сломали уведомления Telegram, а также ответы на темы через Telegram. Пересоздание ключа API не помогает. Ответы не работают, и бот больше не подтверждает отправку ответа, как это было раньше.

Есть ли решение этой проблемы? Или поддержка этого плагина прекращена? :frowning:

Разве не логичнее переместить поле Уведомления Telegram из раздела «Профиль» в раздел «Уведомления»? Я не ожидал найти его в профиле (в моём случае под подписью пользователя), поэтому мне пришлось его искать. :wink:

1 лайк

Нет. Вот его назначение:

Возможно, вам стоит ознакомиться со следующим:

1 лайк