# Discourse Chat Bridge (Telegram)

**URL:** https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691
**Category:** Plugin
**Created:** [7 november 2023 om 11:04 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691 "2023-11-07T11:04:15Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [20 november 2023 om 01:37 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/22 "2023-11-20T01:37:59Z")

</div>

> [@Lhc\_fl](#):
>
> I noticed this problem a few days ago, I just never got around to fixing it, really. My todo list is piled up right now.

Ok, I fixed this.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [22 december 2023 om 07:11 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/24 "2023-12-22T07:11:49Z")

</div>

The bridge plugin has is now compatible with the latest discourse test-passed version.

---

<div class="post-metadata">

### Author: ![Monikas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/monikas/32/375316_2.png) [@Monikas](https://meta.discourse.org/u/Monikas)
#### Post date: [26 maart 2024 om 00:46 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/25 "2024-03-26T00:46:44Z")

</div>

I’m looking forward to it supporting QQ afterwards

---

<div class="post-metadata">

### Author: ![Altair](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/altair/32/472938_2.png) [@Altair](https://meta.discourse.org/u/Altair)
#### Post date: [13 december 2024 om 09:29 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/26 "2024-12-13T09:29:24Z")

</div>

As I understand from the latest messages in the topic: the plugin is functioning. Please tell me if I am right in this assumption.

May I ask if this plugin works with telegram themes (chat sections)?

Thank you very much for your work

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [13 december 2024 om 09:35 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/27 "2024-12-13T09:35:47Z")

</div>

Welcome to Meta 👋

The latest posts were written before the latest edit to the first post, where the #broken tag was added, happened.

 ![Screenshot_20241213_103318_Firefox](https://global.discourse-cdn.com/meta/original/4X/9/9/f/99f9c33526ab3cca8d4f05e1418eb8d6bb50a889.jpeg)

So, I would expect that it’s still broken.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [20 januari 2025 om 14:21 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/28 "2025-01-20T14:21:14Z")

</div>

I’m glad to announce that this plugin is now compatible agian with the latest version of Discourse 🚀

---

<div class="post-metadata">

### Author: ![kOS](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kos/32/441826_2.png) [@kOS](https://meta.discourse.org/u/kOS)
#### Post date: [25 januari 2025 om 15:35 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/29 "2025-01-25T15:35:14Z")

</div>

love this. I dont use Telegram, but I love the opportunity that this project will allow us to integrate with Matrix finally \<3

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [25 januari 2025 om 20:22 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/30 "2025-01-25T20:22:49Z")

</div>

Is there a way to obtain logs of the plugin? @Lhc_fl  
I’m trying to figure out why it only works one way (Discourse → Telegram). Bot of course has permission to access group messages. There are no apparent logs in the console 🤔

Edit: was trying to troubleshoot this, and seemingly it is basically impossible to get proper logs in production.

> [@Alter log level in Production?](https://meta.discourse.org/t/alter-log-level-in-production/238375/5):
>
> If I understand things correctly it’s suppressing info and debug in production mode by design. [Blaming logster/lib/logster/rails/railtie.rb at main · discourse/logster · GitHub](https://github.com/discourse/logster/blame/main/lib/logster/rails/railtie.rb#L16) store.level = Logger::Severity::WARN if Rails.env.production? From [a blog post](https://samsaffron.com/archive/2018/12/27/logster-and-our-logging-strategy-at-discourse) In production mode it aggregates similar errors by fingerprinting backtraces listening for warnings/errors and fatal messages. The intention is to display a list of open application problems that can somehow be resolved. In development mo…

Not even errors or warnings related to the plugin are logged in production.log / production\_error.log.

I’m suspecting some webhook related issue, and from the looks the plugin doesn’t get deactivated on errors?

> <https://github.com/Lhcfl/discourse-chat-bridge/blob/main/lib/chat_bridge_module/provider/telegram/services/setup_webhook.rb#L25>

As it works one way the credentials provided are definitely correct. If someone has an idea how to obtain the logs written by the plugin, please let me know.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [26 januari 2025 om 10:31 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/31 "2025-01-26T10:31:10Z")

</div>

> [@dr460nf1r3](#):
>
> was trying to troubleshoot this, and seemingly it is basically impossible to get proper logs in production.

It’s just supressing INFO and DEBUG, I’m pretty confident that `Rails.logger.error` will leave error logs in production 🤔 Other logs are by design not supposed to appear in production.

I wrote this plugin a long time ago, maybe I should probably check its webhook logic.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [26 januari 2025 om 10:43 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/32 "2025-01-26T10:43:37Z")

</div>

Try accessing this URL in your browser and see what the output is?

```plaintext
https://api.telegram.org/bot{token}/setWebhook?url=https://your.discourse.site/chat-bridge/telegram/hook/123456

```

Replace `{token}` with your bot token.

If the webhook is set up correctly, it should receive a ok message.

 ![A JSON response indicates that a webhook was successfully set with a URL for communication through the Telegram API. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/b/8/2/b82749ed9bea0cca815f61528b54e25718b7a3a2.png)

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [26 januari 2025 om 10:45 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/33 "2025-01-26T10:45:20Z")

</div>

> [@Lhc\_fl](#):
>
> `https://api.telegram.org/bot{token}/setWebhook?url=https://your.discourse.site/chat-bridge/telegram/hook/123456`

Yep, I can confirm that this works:

```plaintext
{"ok":true,"result":true,"description":"Webhook was set"}
```

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [26 januari 2025 om 10:52 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/34 "2025-01-26T10:52:30Z")

</div>

That’s strange. And if the creation of the message fails, the error log will be printed here, you should be able to see it in `https://your.discourse.site/logs`

> <https://github.com/Lhcfl/discourse-chat-bridge/blob/main/lib/chat_bridge_module/provider/telegram/bridge.rb#L16>

Could it really be a permissions issue? If reply directly to the bridged message created by the telegram bot, will it succeed?

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [26 januari 2025 om 11:55 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/35 "2025-01-26T11:55:15Z")

</div>

I’m in fact seeing now a few logs related to the module in /logs:

```plaintext
[Discourse -> Telegram] Failed in chat_message_created: 
Inspecting ChatBridgeModule::Provider::Telegram::Services::HandleDiscourseMessage result object:

[1/8] [params] default (0.0555 ms) ✅
[2/8] [model] bot (0.0178 ms) ✅
[3/8] [step] ensure_bot_valid ❌

(5 more steps not shown as the execution flow was stopped before reaching them)

Why it failed:

INVALID_BOT

```

```plaintext
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `block in warn'

activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `block in dispatch'

activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `each'

activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `dispatch'

activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `warn'

/var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/bridge.rb:51:in `block (3 levels) in <main>'

/var/www/discourse/lib/scheduler/defer.rb:125:in `block in do_work'

rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'

rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'

/var/www/discourse/lib/scheduler/defer.rb:119:in `do_work'

/var/www/discourse/lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'

```

But thats from yesterday and didn’t repeat afterwards, so I’m assuming it had to do with adding the bot and not meeting all requirements yet. After that, nore more bridge plugin logs. Unless, of course, that caused it to never work after that 😕

> [@Lhc\_fl](#):
>
> If reply directly to the bridged message created by the telegram bot, will it succeed?

No, that does not work.

I wonder whether its possible to look into the secret created by the plugin, as this would allow manual creation?

> <https://github.com/Lhcfl/discourse-chat-bridge/blob/440bf0f3056fcf195fbfeb35fd81d6b91f521f0e/config/settings.yml#L9C3-L9C35>

I just noticed one thing while looking through Nginx logs (as the webhook call must occur here)

```plaintext
[26/Jan/2025:12:05:39 +0000] "forum.xyz.org" 91.108.5.109 "POST /chat-bridge/telegram/hook/123456 HTTP/1.1" "-" "chat_bridge_module/telegram_webhook/hook" 403 5865 "-" 0.009 0.010 "-" "-" "-" "-" "-" "-" "-"

```

That’s the webhook I manually created earlier right?

… and we are one step further. I manually set the secret path via rails console and adapted the webhook manually. POST request to Discouse now succeeds. And now there is an actual error:

```plaintext
/var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/services/handle_tg_message.rb:110:in `message_creation_succeed'

/var/www/discourse/lib/service/base.rb:156:in `instance_exec'

/var/www/discourse/lib/service/base.rb:156:in `run_step'

/var/www/discourse/lib/service/base.rb:199:in `run_step'

/var/www/discourse/lib/service/base.rb:139:in `block in call'

/var/www/discourse/lib/service/base.rb:165:in `with_runtime'

/var/www/discourse/lib/service/base.rb:139:in `call'

/var/www/discourse/lib/service/base.rb:457:in `block in run!'

/var/www/discourse/lib/service/base.rb:457:in `each'

/var/www/discourse/lib/service/base.rb:457:in `run!'

/var/www/discourse/lib/service/base.rb:450:in `run'

<internal:kernel>:90:in `tap'

/var/www/discourse/lib/service/base.rb:302:in `call'

/var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/bridge.rb:9:in `block (3 levels) in <main>'

/var/www/discourse/lib/scheduler/defer.rb:125:in `block in do_work'

rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'

rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'

/var/www/discourse/lib/scheduler/defer.rb:119:in `do_work'

/var/www/discourse/lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'

```

```plaintext
Job exception: In params.message creation: Inspecting Chat::CreateMessage result object:

[1/28] [options] default (0.0168 ms) ✅
[2/28] [policy] no_silenced_user (0.0148 ms) ✅
[3/28] [policy] accept_blocks (0.0051 ms) ✅
[4/28] [params] default (0.0742 ms) ✅
[5/28] [model] channel (0.7018 ms) ✅
[6/28] [step] enforce_membership (0.013 ms) ✅
[7/28] [model] membership ❌

(21 more steps not shown as the execution flow was stopped before reaching them)

Why it failed:

/var/www/discourse/lib/service/base.rb:184:in `run_step': Model not found (ArgumentError)

          raise ArgumentError, "Model not found"
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	from /var/www/discourse/lib/service/base.rb:139:in `block in call'
	from /var/www/discourse/lib/service/base.rb:165:in `with_runtime'
	from /var/www/discourse/lib/service/base.rb:139:in `call'
	from /var/www/discourse/lib/service/base.rb:457:in `block in run!'
	from /var/www/discourse/lib/service/base.rb:457:in `each'
	from /var/www/discourse/lib/service/base.rb:457:in `run!'
	from /var/www/discourse/lib/service/base.rb:450:in `run'
	from <internal:kernel>:90:in `tap'
	from /var/www/discourse/lib/service/base.rb:302:in `call'
	from /var/www/discourse/plugins/discourse-chat-bridge/lib/chat_bridge_module/provider/telegram/services/handle_tg_message.rb:91:in `fetch_message_creation'
	from /var/www/discourse/lib/service/base.rb:156:in `instance_exec'
	from /var/www/discourse/lib/service/base.rb:156:in `run_step'
	from /var/www/discourse/lib/service/base.rb:182:in `run_step'
	from /var/www/discourse/lib/service/base.rb:139:in `block in call'
	from /var/www/discourse/lib/service/base.rb:165:in `with_runtime'
	from /var/www/discourse/lib/service/base.rb:139:in `call'
	from /var/www/discourse/lib/service/base.rb:457:in `block in run!'
	from /var/www/discourse/lib/service/base.rb:457:in `each'
	from /var/www/discourse/lib/service/base.rb:457:in `run!'
	from /var/www/discourse/lib/service/base.rb:450:in `run'
	from <interna...

```

But this looks more like a configuration issue 🤔 I wonder why I need to adjust.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [26 januari 2025 om 12:17 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/36 "2025-01-26T12:17:55Z")

</div>

> [@dr460nf1r3](#):
>
> ```plaintext
> [6/28] [step] enforce_membership (0.013 ms) ✅
> [7/28] [model] membership ❌
> 
> ```

Oh, this is not expected, I guess I made a mistake here when adapting to the new version of Discourse. Will take a look at it

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [26 januari 2025 om 12:18 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/37 "2025-01-26T12:18:48Z")

</div>

Thank you! Let me know if there is anything I can do to help.

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [3 juni 2025 om 16:43 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/38 "2025-06-03T16:43:40Z")

</div>

Hey @Lhc_fl I wanted to kindly ask whether there are still plans of fixing this 🙂

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [14 juli 2026 om 15:45 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/39 "2026-07-14T15:45:32Z")

</div>

> **[GitHub - dr460nf1r3/discourse-chat-bridge](https://github.com/dr460nf1r3/discourse-chat-bridge)**
>
> Contribute to dr460nf1r3/discourse-chat-bridge development by creating an account on GitHub.

I’ve forked and fixed the plugin. It is now working as expected. I hope it was the right way to do it!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [14 juli 2026 om 17:28 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/40 "2026-07-14T17:28:54Z")

</div>

> [@dr460nf1r3](#):
>
> I hope it was the right way to do it!

You can now consider PR-ing to the main repo and you may find out during a review 😉

---

<div class="post-metadata">

### Author: ![dr460nf1r3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dr460nf1r3/32/484691_2.png) [@dr460nf1r3](https://meta.discourse.org/u/dr460nf1r3)
#### Post date: [14 juli 2026 om 18:26 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/41 "2026-07-14T18:26:35Z")

</div>

Just did this. Repo and extension looked very dead so didn’t bother before that.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [14 juli 2026 om 18:36 UTC](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691/42 "2026-07-14T18:36:09Z")

</div>

Yeah, fair, that can be an issue. The OP was once very active though …

[Vorige pagina](https://meta.discourse.org/t/discourse-chat-bridge-telegram/284691.md?page=1)
