mesh-api icon indicating copy to clipboard operation
mesh-api copied to clipboard

messhcore to meshtastic to telegram

Open lameritos opened this issue 6 months ago • 13 comments

Hello, I need some clarification. I have a meshtastic node and a meshcore node. My goal is to integrate meshcore with meshtastic and Telegram. Meshcore and Meshtastic are integrated via chats. Meshtastic is also integrated with Telegram, and everything works whether I'm messaging from meshtastic or Telegram. But if I'm messaging from meshcore, the message arrives in meshtastic but doesn't go to Telegram. Is there a way to configure this?

I'm also having trouble using an AI bot, for example, from Telegram or meshcore. Messages arrive but aren't sent to Openrouter.

lameritos avatar May 13 '26 22:05 lameritos

Greetings - Meshcore support is in it's infancy - I plan on refactoring in a next release to better support it - right now it's exists as a kind of "half bridge" implementation - but that is going to change rather soon.

A lot of features remain untested in this alpha so I will definitely need to see some logs from your terminal or web ui... please replicate the problem and send me any relevant sections of logs that report errors

Again - Meshcore support is super early stages - I'll try to spend some time on updating Mesh-API at some point this week.

mr-tbot avatar May 25 '26 21:05 mr-tbot

In the process of pushing and updating to v0.7.0 BETA which should provide full Meshcore support across the entire ecosystem - let me know if this version fixes your issues!

mr-tbot avatar Jun 09 '26 23:06 mr-tbot

hi thanks wor working i tested meshcore + meshtastic +TG

send meshcore received meshtastic + TG

send meshcore received meshcore + TG

send TG received only on meshtastic not in meshcore it normal?

/ai working from meshcore and meshtastic Should /ai work from Telegram?

lameritos avatar Jun 12 '26 21:06 lameritos

In order to prevent AI echos it won't typically respond to telegram messages.

A future update may figure a way around this.

I'll look into your issue on the next bug fix release regarding sending from TG.

mr-tbot avatar Jun 13 '26 14:06 mr-tbot

thanks just in case log from sending TG 2026-06-13 17:09:13 UTC - [Info] Sending broadcast on channel 1 → '[TG:lameritos] Ттттт' 2026-06-13 17:09:23 UTC - [Info] Successfully sent chunk 1/1 on ch=1. 2026-06-13 17:09:23 UTC - [ext:Telegram] Polled TG message: [TG:lameritos] Ттттт

received only on meshtastic

like TG extension not known for meshcore.

lameritos avatar Jun 13 '26 17:06 lameritos

v0.7.3.7 will be released shortly and should address this issue - thank you for reporting! It should fix a few other extensions as wel!

mr-tbot avatar Jun 13 '26 18:06 mr-tbot

Circling back on this one, @lameritos — thanks for the clear repro and logs. 🙏

Telegram → MeshCore (the original bug): the core fix landed in v0.7.3.7 (all extension outbound now flows through the network-agnostic web_send path). On top of that, I found and fixed a remaining gap: the shared send_to_mesh() helper was hardcoding the target network to "auto", which ignored your configured default_send_network. It now respects that setting (and still fans out to every connected radio when left on auto). So a [TG:...] message should reach both Meshtastic and MeshCore. Your earlier log where it only hit Meshtastic is exactly the case this addresses — could you re-test on the next build and confirm?

"Should /ai work from Telegram?" Today, no — and it's intentional: inbound Telegram text is relayed to the mesh but the AI deliberately does not reply to it, to avoid a Telegram↔mesh↔AI echo loop (as noted above). A slash command like /ai typed in Telegram is currently just relayed as literal text; it isn't routed through the command handler.

Proposal (want your feedback before building): add an opt-in config flag (e.g. telegram.allow_commands) that routes explicit slash-commands only from Telegram through the command pipeline and sends the reply back to Telegram — while still suppressing automatic AI replies to ordinary chat, so the echo-loop protection stays intact. That would make /ai, /whereami, etc. usable from Telegram without opening the floodgates.

Leaving this open for your input:

  1. Does the default_send_network fix resolve the "only on Meshtastic" symptom for you?
  2. Is the opt-in "commands from Telegram" behavior what you're after?

mr-tbot avatar Jul 08 '26 17:07 mr-tbot

@mr-tbot Good evening.

  1. I think I’ll check it right after the fix is ​​released, specifically regarding issue #60.
  2. I think this feature makes sense within the overall functionality. But as the developer, you’re in a better position to judge :)

lameritos avatar Jul 11 '26 19:07 lameritos

Fix is in the works! Standby!

mr-tbot avatar Jul 11 '26 20:07 mr-tbot

Update: v0.7.5.0 Beta is released (https://github.com/mr-tbot/mesh-api/releases/tag/v0.7.5.0-beta).

Two things for you, @lameritos:

  1. The Telegram->MeshCore fanout gap is closed — extension outbound now respects default_send_network and reaches every connected radio, so a [TG:...] message should hit both Meshtastic and MeshCore.
  2. The commands-from-Telegram feature we discussed shipped as an opt-in: set allow_commands: true in the Telegram extension config, and then /ai <question>, /whereami, etc. work from Telegram and reply back to Telegram. Ordinary chat is still not auto-answered by the AI, so the echo-loop protection stays intact.

The #60 config-save crash you were waiting on is also fixed in this release. Please give it a try and let me know how both behave.

mr-tbot avatar Jul 19 '26 00:07 mr-tbot

Update, @lameritos: this is in v0.7.5.2 Beta — https://github.com/mr-tbot/mesh-api/releases/tag/v0.7.5.2-beta (v0.7.5.0/v0.7.5.1 were pulled due to a dashboard bug, so please use v0.7.5.2).

Two things for you:

  1. The Telegram → MeshCore fanout gap is closed — extension outbound now honors default_send_network and reaches every connected radio.
  2. The opt-in commands from Telegram feature we discussed shipped: set allow_commands: true in the Telegram extension config, then /ai <question>, /whereami, etc. work from Telegram and reply back to Telegram (ordinary chat is still not auto-answered, so echo-loop protection stays intact).

Grab v0.7.5.2 (or docker pull mrtbot/mesh-api:latest) and let me know how both behave.

mr-tbot avatar Jul 19 '26 04:07 mr-tbot

hi :) TG notification no longer working for me :))

send MC 2026-07-26 12:38:59 UTC - [MeshCore] [ch1] l114: mc to tg 2026-07-26 12:38:59 UTC - [Info] Sending broadcast on channel 1 → '[MC] l114: mc to tg'

send TG 2026-07-26 12:40:26 UTC - [ext:Telegram] Polled TG message: [TG:lameritos] Tg to mesh

send MC

TG config { "allow_commands": true, "bot_token": "", "chat_id": "-", "enabled": true, "poll_interval_seconds": 5, "receive_enabled": true, "send_ai": true, "send_all": true, "send_emergency": false, "forward_to_mesh": true }

MC config "meshcore": { "_comment_bridge": "When both radios are present, mirror traffic between networks. Maps are channel index -> channel index.", "_comment_chunking": "Outbound message chunking for MeshCore.", "_comment_connection": "Connection to the MeshCore companion node. connection_type: 'serial', 'tcp', or 'ble'.", "_comment_reconnect": "Bounded connect + exponential-backoff reconnect with a health-checked link watchdog.", "advert_interval_sec": 86400, "auto_reconnect": true, "ble_address": "", "ble_pin": "", "bridge_direct_messages": false, "bridge_enabled": true, "bridge_meshcore_channel_to_meshtastic_channel": { "1": 1 }, "bridge_meshtastic_channel_to_meshcore_channel": { "1": 1 }, "chunk_delay_sec": 2, "connect_timeout_sec": 20, "connection_type": "tcp", "enabled": true, "max_chunks": 5, "max_message_length": 200, "max_reconnect_attempts": 0, "max_reconnect_interval_sec": 120, "meshcore_to_meshtastic_tag": "[MC]", "meshtastic_to_meshcore_tag": "[MT]", "reconnect_interval_sec": 15, "send_adverts": true, "serial_baud": 115200, "serial_port": "/dev/ttyUSB1", "tcp_host": "192.168.88.82", "tcp_port": 5000 },

version MESH-API v0.7.5.2 Beta by: MR_TBOT (https://mr-tbot.com)

extensions 2026-07-26 12:31:11 UTC - [ext:Telegram] Telegram enabled. bot_token=set, chat_id=-************* 2026-07-26 12:31:11 UTC - [ext:Telegram] Telegram polling thread started. 2026-07-26 12:31:11 UTC - [ExtensionLoader] ✅ Extension loaded: Telegram v1.0.0

lameritos avatar Jul 26 '26 12:07 lameritos

Update, @lameritos: v0.7.5.3 Beta is live — https://github.com/mr-tbot/mesh-api/releases/tag/v0.7.5.3-beta — and it closes the exact gap from your last report. 🎯

Why your Telegram notifications went silent: every Telegram hook was gated on inbound_channel_index being set — but the shipped default is null (and the WebUI config editor strips nulls on save, which is why the key vanished from your config). With the key absent, send_all: true silently forwarded nothing, and Telegram→mesh relay was silently dropped too. Your config was fine — the code and the docs were wrong.

Fixed in this release (and the same fix applied to Discord, Slack, Matrix, Signal, Mattermost, MQTT, ntfy, and every other bridge extension):

  • inbound_channel_index: null (or missing) now means no filter — every mesh channel forwards to Telegram, and Telegram→mesh relays on channel 0. Set an index to pin both directions to one channel, exactly as before.
  • Extensions no longer re-forward their own [TG:...] relay tag, so bridge/MQTT echoes can't bounce back into Telegram.
  • EXTENSIONS.md config tables now list the real keys (forward_to_mesh never existed — sorry about that).

Please update (docker pull mrtbot/mesh-api:latest or grab the release) and re-test your MC + MT + TG triangle — both directions should flow with your existing config, no inbound_channel_index needed. 🙏

mr-tbot avatar Jul 28 '26 18:07 mr-tbot