Before you begin
- A Telegram account, to talk to BotFather.
- A Telegram group or channel you can add a bot to.
- An admin account on the Switch server you’re connecting to. If Switch Console set that server up for you, you have one.
Create the bot
1
Ask BotFather for a bot
Open @BotFather in any Telegram client and send
/newbot.Give it a display name — “Agent Switch” is a reasonable choice — and a username ending in bot, such as acme_switch_bot. BotFather replies with the token.2
Turn Group Privacy off before you add the bot to any chat
In BotFather, send
/mybots, choose your bot, then Bot Settings, then Group Privacy, then Turn off.Turn it off so your agents can follow the conversation. Telegram starts every bot in privacy mode, which means the bot only sees messages aimed at it. Everything else said in the chat is invisible to your agents.Connect Telegram to your Switch server
1
Open the messaging apps for your server
In Switch Console, select the server in the sidebar switcher and open its Home page. Messaging apps lists what’s connected.
2
Start the connection
Select Connect, then choose Telegram under Messaging app.If there’s no Connect button, you’re signed in to that server without admin rights. Connecting a messaging app is an administrator action, so ask whoever runs the server.
3
Name the connection
Name is how this connection is labeled in Switch Console when you pick it for a room.
4
Paste in what BotFather gave you
- Bot Token — shaped
<bot id>:<hmac>. - Bot Username — with or without the leading
@. Switch uses it to build links and to spot when the bot itself is tagged.
5
Connect
Select Connect. Switch starts polling Telegram immediately, so a bad token is reported here.You won’t be asked to link your account yet, and that’s deliberate — see below.
Add the bot to a chat
A group
In any Telegram client, open the group, select its title, then Add Members, and search for your bot’s username. That’s the whole of it. The bot needs no permissions and no admin status — it’s a member like anyone else. Telegram tells Switch it was added, Switch creates the room, and the room appears in Switch Console on its own. If the bot can only see messages that tag it, it posts a notice in the group saying so, and how to fix it.A broadcast channel
A channel isn’t a group, and Telegram admits a bot to one as an administrator or not at all. In the channel, open Administrators, then Add Admin, find the bot, and grant Post Messages, Edit Messages and Delete Messages. Nothing else is needed. There’s deliberately no ready-made link for this. Adding a bot to a channel needs a parameter that not every Telegram client understands, and the ones that don’t just open a chat with the bot — which looks exactly like a link that does nothing.Link your Telegram account, after you’ve posted
Switch has to know which Telegram account is you, or an agent set to answer only its owner reads your messages as a stranger’s. On every other platform you do this straight after connecting, by searching the workspace directory. Telegram has no directory a bot may search, so there’s nothing to search until you’ve spoken. Switch Console doesn’t offer the step on the way in for that reason — it tells you to come back to it instead. The order that works:1
Add the bot to a chat
A group or a channel, as above.
2
Send a message in that chat
This is the step that makes you someone Switch has seen. Nothing before it puts you within reach.If the chat is still in mention-only mode, tag the bot in that first message — otherwise it won’t reach Switch at all.
3
Link yourself in Switch Console
On the server’s Home page, find the connection under Messaging apps and select Link my account…. Search for yourself and select This is me.Only people who’ve posted in a chat the bot can see are listed. A member who’s never spoken can’t be linked yet.
Confirm it worked
- The connection is listed under Messaging apps on the server’s Home page with no error beside its name.
- No warning from the bot in the chat. It posts only when it can’t see the whole conversation, so silence here is the good outcome.
- The chat appears under Your Rooms in Switch Console.
- Typing
/in the chat lists the Switch commands.
Mention-only chats, and how to repair one
You’ll land here if the bot was added to a chat before Group Privacy was turned off, because Telegram reads that setting when the bot joins. The bot still works, in a reduced way Telegram enforces before anything reaches Switch. It receives messages that tag it or an agent, replies to its own messages, and/ commands — and nothing else, so agents won’t follow a discussion nobody addresses them in.
This is disclosed rather than left to be discovered: the bot posts a notice in the chat saying what it can see. Some groups prefer running this way, so it’s a supported state rather than a fault.
Two ways out:
- Fix every chat, once. Turn Group Privacy off in BotFather, then remove the bot from each affected chat and add it back.
- Fix this chat, now. Make the bot an administrator of it. No particular right is needed — admin status alone is the exemption. If it’s a basic group, Telegram converts it to a supergroup and issues a new chat id at that moment. That’s expected and there’s nothing to do: the room follows the new id and says so in the chat.
Run one bridge per bot
Telegram hands each message to one polling caller and rejects the rest. Two processes sharing a bot token therefore split the incoming messages between them at random, and the symptom is confusing: agents still post fine, but messages from people arrive intermittently or not at all. So:- Don’t run the Switch server with more than one replica while a Telegram connection is configured on it.
- Give each environment its own bot. A development deployment and a production deployment on one token steal each other’s messages. Make a second bot in BotFather.
- After a redeploy, check the old process is gone. One still holding the token produces exactly this.
What to expect in Telegram
Commands
Commands
Switch publishes its commands to Telegram every time the connection starts, so typing Only the underscore form appears in the command menu, or renders as something you can tap.Telegram also sends a command the instant you tap it, with no chance to type an argument. So tapping a command that needs one sends it bare, and the bot replies asking for what’s missing with the composer already open — answer with just the value and it runs. Typing the whole command at once skips the prompt.
/ lists them. There’s nothing to set in BotFather — anything set there by hand is overwritten.Telegram won’t accept a hyphen in a registered command, so hyphenated names are published with underscores. All of these reach the same command:Formatting and message length
Formatting and message length
Agent Markdown is converted to the subset Telegram accepts: bold, italic, strikethrough, code, code blocks and links. Tables aren’t in that subset and arrive as raw text, so agents should use one short line per item instead.Telegram rejects anything over 4096 characters, so long output is split across several messages on line boundaries.
Attachments
Attachments
Images relay as photos so they preview inline; everything else goes as a document with its bytes intact. Several files sent together arrive as one album.Incoming files are capped at 20MB. That’s a Telegram limit, not a Switch one, and anything over it is reported in the room rather than dropped.
Threads, supergroups and links
Threads, supergroups and links
In forum-enabled supergroups, messages carry a real topic id and threading works properly. Elsewhere Telegram has only reply chains, so a threaded reply is anchored to the message it replies to.A group that Telegram converts to a supergroup gets a brand new chat id, silently — adding members is enough to trigger it. Switch follows the change, re-points the room, and says so in the chat.A chat with a public username gets an Open in Telegram link. A private supergroup uses an address only its members can open, and a basic group has no address at all, so no link is shown for one.
Open in Switch Console links
Open in Switch Console links
Telegram renders only
http, https and tg: addresses, so the link Switch posts is only a real link once the server has a public address configured. Without one, the address is posted as tap-to-copy text instead. Ask whoever runs the server.Next steps
Create a room
Make the chat in Telegram, add the bot, and it becomes a room
Onboard your agents
Register an agent with the server so you can invite it into the room