Skip to main content
Back to messaging or digital channels Connect a Telegram bot to your agent so users reach it in private chats, groups, and supergroups. You create the bot in Telegram and give Artemis its username and token. Artemis then registers a protected webhook with Telegram for you. The setup requires:
  1. Create the Telegram bot with BotFather.
  2. Artemis channel configuration: enter the bot’s username and token, then create the connection.
  3. Verify the connection in a private chat, a group, and with buttons and media.
After you create the connection, Telegram posts each update to Artemis, and the agent replies in the same chat. Important considerations
  • The bot username selects the connection: Artemis builds the webhook path from it and routes each update by it. You can’t change it after creation.
  • Artemis registers the webhook for you: Don’t call setWebhook yourself. Telegram keeps one webhook per bot, so a manual call replaces the one Artemis registered and stops the connection.
  • One active connection per bot token: Artemis rejects a second active connection that uses the same token, so it can’t silently replace the first one’s webhook.
  • Treat BotFather messages as secrets: Anyone with the bot token can call the Bot API. Keep it out of tickets, screenshots, browser code, logs, and client-side configuration.

Prerequisites

Confirm these before you start.
  • A Telegram account to talk to BotFather.
  • An Artemis runtime reachable over public HTTPS, with outbound access to api.telegram.org.
  • Artemis project access with permission to open Deployments -> Channels, and a deployed agent in the environment you intend to bind.

How Artemis routes Telegram messages

Four pieces carry the integration. You supply the first two, and Artemis manages the rest.

Create the Telegram bot

Do this in Telegram before you open Artemis. Select Open BotFather or Open Bot API documentation in the setup guide to jump straight there.
1

Open BotFather

  1. Search Telegram for @BotFather, or open t.me/botfather.
  2. Confirm the blue verification badge beside the name. Fake BotFather accounts exist to harvest tokens.
  3. Select Start.
2

Create the bot with /newbot

  1. Send /newbot.
  2. Enter a display name. Users see it at the top of the chat, and you can change it later.
  3. Enter a username. It must be 5 to 32 Latin letters, numbers, or underscores, and end in bot.
Choose the username carefully. Telegram never lets you change it, and Artemis builds the webhook path from it. BotFather replies with the bot link and the token.
3

Copy the username and token

  1. Copy the username without the t.me/ prefix. Artemis strips a leading @, so either form works.
  2. Copy the full token, including the numeric bot ID and the colon before the secret part.
To retrieve either value later, send /mybots, select the bot, and select API Token.
4

Configure discovery (optional)

Use these BotFather commands to shape what users see. They don’t affect message delivery or replace the webhook.
5

Decide group behavior

Artemis processes a group or supergroup message only when it mentions the bot, replies to one of the bot’s messages, or uses /start or /help. Ordinary group chatter never reaches the agent, even if you turn off privacy mode in BotFather.
6

Use a separate bot for each environment

Create one bot for development and another for production, each with its own token and its own Artemis connection.

Artemis channel configuration

Create the connection with the bot’s values. Artemis registers the webhook as part of creation.
  1. Open Artemis and select the project.
  2. Go to Deployments -> Channels -> Telegram -> + New. The New Telegram Connection dialog opens, with the setup guide on the left and the connection fields on the right.
  3. Configure the fields:
  4. Select Create.
When you select Create, Artemis completes the Telegram side in one step:
  • Generates a high-entropy secret token and stores it encrypted.
  • Calls setWebhook with the connection-specific URL, which ends with the normalized bot username.
  • Subscribes to message and callback_query updates only. Telegram channel posts and other update types stay outside the connection.
  • Drops updates still pending from an earlier webhook, so stale events never reach the new connection.
If registration fails, Artemis rolls back the creation rather than leaving a connection that can’t receive anything.

Verify the connection

Each check exercises a different path. A bot that answers private messages can still fail in groups or on buttons.
  1. Open the bot by its exact username, select Start, and send a short, distinctive message. Confirm one session and one reply.
  2. Send /start, or open a deep link with a start payload. Artemis passes it to the agent as a welcome action, with the payload as its value.
  3. Add the bot to a group, then mention it with @BotUsername, reply to one of its messages, and send /start or /help. Confirm each reaches the agent and an unrelated message doesn’t.
  4. Select a button on an inline keyboard. Confirm the loading spinner clears and the action returns to the same chat session.
  5. Send each media type your agent accepts, including a caption at least once.
Artemis downloads the largest photo size or the attached file through getFile before the agent processes it.

Telegram limits

Artemis applies these limits before it calls the Bot API. Design agent responses to fit them.

Security and lifecycle

A Telegram connection depends on two secrets and one webhook registration.
  • Secret header: Telegram returns the generated secret in the X-Telegram-Bot-Api-Secret-Token header on every update. Artemis compares it with the stored value before processing, so any proxy in front of Artemis must preserve the header.
  • Bot token: It authorizes every Bot API call and appears in request URLs. Store it only in Artemis, and redact it from logs and diagnostics.
  • Token rotation: If BotFather revokes or regenerates the token, update it in the Credentials tab so Artemis can send messages and re-register the webhook.
  • Diagnosis: Use getWebhookInfo only through a secure operator tool to confirm the URL and last error. Never call setWebhook or delete the webhook outside Artemis.
  • Duplicates: Artemis deduplicates on Telegram’s update_id, so a Telegram retry never creates a second agent turn.

Manage the channel connection

Open a Telegram connection from Deployments -> Channels -> Telegram to manage it. The page has a header, three tabs, and a summary panel on the right. Header. Shows the connection name, its status, and when it last changed. The … overflow menu holds the connection-level actions. Summary panel. Stays visible on every tab.
Artemis encrypts the token after you save it. Leave the field blank to keep the current value, or enter a new token to replace it.Select Save Credentials to apply your changes.

Troubleshoot connection issues

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

Telegram reference

Use these pages when you need detail beyond what this article covers.
Related articles: