Discourse Chat Bridge (Telegram)

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

[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
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 :confused:

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?

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

[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:

/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'
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 :thinking: I wonder why I need to adjust.