Bot-Crossing: Connecting Bots Across Platforms with Matterbridge
What this article covers
- What “bot-crossing” is: bridging messages and AI bots across chat platforms.
- Matterbridge as the standard tool and which platforms it supports.
- Setup with Docker and example configuration.
- Use case: one AI backend, multiple chat frontends.
- Limitations and pitfalls of bridge solutions.
Introduction
Your community lives on Discord, your family uses Telegram, your club meets on Matrix, and you want your AI bot to respond everywhere? That’s bot-crossing: a bridge between platforms that synchronizes messages and makes your bot available across all of them.
The standard tool for this is Matterbridge, an open-source relay that connects over 20 platforms: IRC, Discord, Telegram, Matrix, Slack, Mattermost, Rocket.Chat, XMPP, WhatsApp, and more. It’s a Node.js application with a simple TOML configuration, no programming required.
Common use cases
- AI bot everywhere: One Ollama backend, users ask on Discord, Telegram, or Matrix, the bridge routes all requests.
- Community fusion: A Discord community and Telegram group share a single channel.
- Migration: Move an old IRC community to Matrix without losing the IRC regulars.
- Redundant alerts: Critical notifications go to two platforms simultaneously.
- Message sync: Mirror messages from the “old” chat into the new one.
How Matterbridge works
Discord ──┐
│
Telegram ─┼── Matterbridge (Relay) ──► other side
│
Matrix ───┘
Matterbridge connects “gateways”: you define which channels on which platforms are linked together. A message in channel A gets mirrored to connected channels on other platforms, with bot names and source attribution.
Installation: Docker
services:
matterbridge:
image: 42wim/matterbridge:latest
volumes:
- ./matterbridge.toml:/etc/matterbridge/matterbridge.toml
- ./data:/data
restart: always
matterbridge.toml: Example with Telegram ↔ Discord ↔ IRC:
[discord.mybot]
Token = "your-discord-bot-token"
Server = "YOUR_DISCORD_SERVER_ID"
AutoWebhooks = true
[telegram.mybot]
Token = "your-telegram-bot-token"
[irc.mybot]
Server = "irc.libera.chat:6697"
Nick = "crossbot"
UseTLS = true
SkipTLSVerify = false
[[gateway]]
name = "my-gateway"
enable = true
[[gateway.inout]]
account = "discord.mybot"
channel = "general"
[[gateway.inout]]
account = "telegram.mybot"
channel = "-1001234567890"
[[gateway.inout]]
account = "irc.mybot"
channel = "#my-channel"
Run docker compose up -d: messages now flow across all three channels.
The AI-crossing use case: one Ollama backend
The real power move: your bot runs on one platform and answers, then the bridge distributes the response everywhere.
User on Telegram: "!ai what is Ollama?"
│
▼
Matterbridge mirrors to Discord
│
▼
Discord bot (with Ollama) sees "!ai ..." → responds
│
▼
Response gets mirrored back to Telegram
Alternatively: embed AI logic directly in the bridge loop. Matterbridge can be used as a library, or you can write your own relay service that intercepts messages, sends them to Ollama, and posts the response across all connected platforms:
# Concept: message from any platform → Ollama → response everywhere
def on_message(platform, user, text):
if text.startswith("!ai"):
answer = ollama.chat(prompt=text[3:])
broadcast_to_all_platforms(answer) # via Matterbridge API or custom clients
Key configuration tips
- Bot names: Configure
RemoteNickFormatso messages from other platforms are recognizable (e.g.,[TG] Max: Hello). - Nick mapping: Use
PreserveMessageIdsandIgnoreUsersfor bots to prevent loops. - Webhooks vs. bots: Discord supports webhooks for prettier bridges (
AutoWebhooks=true). - Selective channels: Use
[[gateway.in]]vs[[gateway.out]]for one-way bridges (alerts out only, not in).
Limitations and pitfalls
- Feature loss: Threads, reactions, edits, and attachments don’t translate perfectly between platforms. Plain text is reliable, everything else is “best effort.”
- Loop risk: Two bridges mirroring each other creates an endless loop. Set
IgnoreNicks/IgnoreUsersfor bot accounts. - Rate limits: Telegram and Discord have API limits. Heavy cross-traffic can get throttled.
- Moderation: Spam on one platform spreads to all. You need moderation everywhere.
- Ambiguity: Users don’t always know which platform the other person is using. Name prefixes help clarify.
Alternatives and complements
- Mautrix bridges: Specialized for Matrix ↔ WhatsApp/Telegram/Signal (puppets, E2EE), see Matrix bots.
- n8n: For workflow crossing (event-based, not live chat), see n8n.
- Custom backend: Often better for AI bots. Build a central backend with platform adapters instead of a generic bridge.
Further reading
- IRC-Coding.de: Programming tutorials on bot architectures and multi-platform design.
- Telegram bots: One side of the bridge.
- Discord bot: The other side.
- Matrix bots: Matrix-side.
- IRC bots: The classic.
- Platform comparison: Available platforms.
Key takeaways:
- Bot-crossing bridges messages between chat platforms: Matterbridge is the standard tool.
- TOML config, no programming needed, supports ~20 platforms.
- AI use case: one Ollama backend, all chat frontends reachable via bridge.
- Feature loss with threads/attachments, loop risks, rate limits to watch.
- For serious AI bots, a custom multi-adapter backend is cleaner than a generic bridge.
FAQ
What is bot-crossing?
Which platforms does Matterbridge support?
AI bot across multiple platforms?
What’s the loop risk?
Do features get lost?
Matterbridge or custom backend?
Sources and further reading
- Matterbridge: GitHub.
- Matterbridge Wiki: Configuration.
- IRC-Coding.de: Programming tutorials.


