Skip to main content
Back to messaging channels Connect a Telegram bot to your agent so users reach it in private chats, groups, and supergroups. Artemis registers the Telegram webhook for you and protects it with a generated secret, so you never call setWebhook yourself. You create the bot in Telegram, then hand Artemis two values from it. Everything after that happens automatically when you create the connection.

How Artemis routes Telegram messages

Four pieces carry the integration, and each one does a different job. Confusing them causes most setup failures. Because the username sits in the URL path, you can’t change it after creation. Create a new connection if you need to point at a different bot.

Create the Telegram bot

Do this work in Telegram before you open Artemis. BotFather is a bot itself, so you create your bot by holding a chat with it rather than by filling in a web form. See Telegram’s introduction for developers if you’ve never built a bot before.
1

Open BotFather

Search Telegram for @BotFather, or open t.me/botfather from any device signed in to your account. Several accounts imitate BotFather, so confirm the blue verification badge beside the name before you send anything. A fake BotFather exists to harvest tokens.Select Start if you’ve never used it. BotFather replies with its command list.
2

Create the bot with /newbot

Send /newbot. BotFather asks two questions in turn.First it asks for a name, which is the title users see at the top of the chat. Spaces and most characters work here, and you can change it later.Then it asks for a username, which is permanent and must be unique across Telegram. Usernames run 5 to 32 characters, accept Latin letters, numbers, and underscores, ignore case, and must end in bot. BotFather rejects a taken username and asks again, so have a second choice ready.Choose carefully. Telegram never lets you change a bot username, and Artemis builds the webhook path from it, so a rename means a new bot and a new connection in both systems.BotFather confirms with a message containing the bot link and the token. The token is the long string after the numeric bot ID and a colon.
3

Copy the username and token correctly

Copy the username from the confirmation message without the t.me/ prefix that surrounds it in the link. Artemis strips a leading @ and stores the normalized value, so either form works. Nothing else routes: a display name, a numeric bot user ID, a chat ID, a token fragment, or a full URL all fail.Copy the token separately. Telegram formats it as a tappable code block, so tapping or clicking it copies the whole value.To retrieve either value later, send /mybots, select the bot, and select API Token. BotFather shows the username and token again without creating anything new.
4

Set up discovery, if your users need it

Return to BotFather and use these commands to control what users see before and during a chat. Each one prompts you to pick the bot first.These shape discovery only. They don’t affect message delivery, and they don’t replace the webhook Artemis registers. Changes can take a few minutes to appear. Telegram documents the full command list under BotFather, and offers the same settings through the BotFather Mini App if you prefer a visual interface to chat commands.
5

Understand how the bot behaves in groups

Artemis processes a group or supergroup message only when the message mentions the bot, replies to one of its messages, or uses /start or /help. Ordinary group chatter never reaches your agent.This holds whatever you set in BotFather. Telegram’s own privacy mode, which you toggle with /setprivacy, widens what Telegram sends when you disable it, and a bot added to a group as an admin receives everything regardless. Artemis still applies the mention and reply rule on top, so neither change alters what your agent sees, and the bot stays quiet in busy groups by design.One Telegram behavior does matter here: a privacy mode change takes effect only after you remove the bot from the group and add it back.
6

Use separate bots for each environment

Create one bot for development and another for production, each with its own token and its own Artemis connection. Telegram allows a single webhook per bot, so sharing one bot across environments means the two registrations overwrite each other.
The bot token authorizes every Bot API call for that bot, and it travels in the request URL. Treat it like a password: keep it out of tickets, screenshots, logs, browser code, and client-side configuration. If it leaks, send /token to BotFather to generate a replacement, then update the credential in Artemis. The old token stops working as soon as the new one issues.

Connect the bot in Artemis

The connection stores your bot identity, binds the agent version that answers, and registers the webhook. Go to Deployments -> Channels -> Telegram -> + New and complete the following.

What happens when you select Create

Artemis completes the Telegram-side registration in one step, so you don’t touch the Bot API yourself. Artemis generates a high-entropy secret token, calls setWebhook with the URL built from your bot username, and subscribes to message and callback_query updates only. It also drops any updates left pending from an earlier webhook on that bot, so stale traffic can’t enter the new connection. Messages users sent before you created the connection won’t appear, by design. If registration fails, Artemis rolls the whole creation back rather than leaving a connection that can’t receive anything. A conflict at this point means the token already belongs to another active Telegram connection in the project. Telegram permits one webhook per bot, so Artemis refuses the second connection instead of silently replacing the first one’s webhook.

Verify the connection

Run these checks before you hand the bot to users. Each one exercises a different path, and a bot that answers private messages can still fail in groups or on buttons.
1

Send a private message

Open the bot by its exact username, select Start, and send a short message you can search for later. Confirm you get one reply and that Artemis opens a single session.
2

Test the start command and any deep link

Send /start, then open a deep link carrying a start payload if your agent uses one. Artemis treats the command as a welcome action and passes the payload through as its value, so your agent can branch on where the user came from. Telegram documents the link format under deep linking.
3

Test group behavior

Add the bot to a group or supergroup, then address it by username, reply to one of its messages, and send /start or /help. Each should reach the agent. Send an unrelated message too, and confirm the bot ignores it.
4

Press an inline button

Trigger a response that carries an inline keyboard and select a button. Confirm the loading spinner clears and the resulting action lands in the same chat session.
5

Send each media type you support

Send a photo, document, audio file, video, and voice note, depending on what your agent accepts. Artemis downloads the largest photo size or the attached file before the agent processes it. Include a caption in at least one test, since captions travel separately from the file.

Manage the connection

Opening a connection shows four tabs. The delete control sits beside the connection name.
Connection Summary reports the connection’s state and identity.Setup Instructions shows the Webhook URL Artemis registered with Telegram and the normalized Bot Username, each with a copy control. The URL follows the form https://{host}/api/v1/channels/telegram/webhook/{bot-username} and ends with the username minus any leading @.Use the Webhook URL to confirm what Telegram should be calling. If getWebhookInfo reports a different URL, something outside Artemis re-registered the bot.

Telegram limits

Telegram enforces these boundaries, and Artemis applies them before it calls the Bot API. Design your agent’s responses to fit them.

Operate the connection safely

A Telegram connection depends on two secrets and one webhook registration. Protect all three. The secret token is separate from the bot token. Telegram returns it in the X-Telegram-Bot-Api-Secret-Token header on every update, and Artemis compares it with the encrypted stored value using a constant-time check before processing anything. A proxy that strips unrecognized headers breaks this check, so preserve the header end to end. Never call setWebhook yourself for a connected bot. Telegram keeps one webhook per bot, so registering another URL or deleting the webhook outside Artemis stops the connection until you re-save or recreate it. Use getWebhookInfo for diagnosis only, run it through a secure operator tool, and keep the real token out of any transcript you share. Artemis deduplicates on Telegram’s update_id, so a Telegram retry doesn’t produce a duplicate agent turn.

Troubleshooting

Match the symptom to the check. Most failures trace to the token, the webhook registration, or the group mention rule.