Skip to main content
Connic

Telegram

By Connic

Connic handles the Telegram Bot API for you. User messages trigger an agent that replies in-thread; outbound runs push reports and alerts to any chat or channel. No bot framework to host.

InboundOutbound

Overview

You create the bot once with @BotFather; Connic does the rest. When you create an inbound Telegram connector with your bot token, Connic registers a webhook with Telegram, so messages, edited messages, and callback queries arrive as HTTP POSTs, get verified, and trigger your linked agents with a structured payload: the text, the chat_id, sender details, and the raw update. An outbound connector closes the loop, sending agent output back into any chat via sendMessage.

That removes the bot process you would otherwise babysit: no long-polling service, no bot framework to host, no webhook plumbing. The bot's brain is a Connic agent, which means its conversations show up as runs you can inspect and its behavior updates when you redeploy the agent, not the bot.

How it works

1

Create a bot with @BotFather

Message @BotFather on Telegram, send /newbot, follow the prompts, and copy the bot token.

2

Create the connector

Paste the bot token into a new Telegram connector. In inbound mode, Connic validates the token and registers the webhook with Telegram automatically; you can optionally restrict access to a list of allowed Telegram user IDs.

3

Link an agent

Every message to the bot now triggers the linked agent with the message payload as input. To reply in the chat, add an outbound connector and have the agent return the chat_id with its response text.

What you can build

Patterns teams ship in production. No queues, workers, or schedulers to run.

Trigger

User sends message

message
Agent Action

Agent reads the question, searches your help docs, and replies in the same chat in seconds — keeping the thread, the tone, and the typing indicator natural.

Authentication and access control

The connector uses Telegram's built-in secret_token mechanism: a random token generated at creation is registered with Telegram via setWebhook, and every incoming request must carry it in the X-Telegram-Bot-Api-Secret-Token header. Requests are rate limited, the bot token is stored encrypted, and an optional allowlist of Telegram user IDs keeps a bot private even though anyone can find it. Deleting the connector unregisters the webhook.

Every message becomes a normal agent run, with full traces, token and cost tracking, and the same guardrails and approval rules as any other trigger, so a chat interface doesn't mean giving up oversight.

Replying and message formats

Inbound, the agent gets the most useful fields at the top level: text, chat_id, and a message object with sender details, plus the raw Telegram Update for anything else. Outbound, the agent returns JSON with a text field and optionally a chat_id; a bare string works too and goes to the connector's default chat ID. The chat_id from the agent's output wins over the connector default, which is how a reply reaches the user who wrote in. Messages are sent with parse_mode: HTML, so the agent can format its answers. See the full payload and output formats in the Telegram docs.

Information

Publisher
By Connic
Category
Connectors
Modes
Inbound, Outbound
Documentation
Telegram docs

Frequently Asked Questions

How do I connect an AI agent to a Telegram bot?

Create a bot with @BotFather and copy its token, create a Telegram connector in Connic with that token, and link an agent. Connic registers the webhook with Telegram automatically, so every message to the bot triggers an agent run. There is no bot server to host and no polling loop to run. Telegram is one of several chat and event sources; see what else you can connect.

Can the bot reply to the person who messaged it?

Yes. The inbound payload includes the sender's chat_id. Link the same agent to an outbound Telegram connector and have it return JSON with that chat_id and a text field; the connector sends the reply into the same chat via sendMessage. For fixed destinations like an alerts channel, set a default chat ID on the connector instead.

Can I restrict who can talk to the bot?

Yes. Add a list of allowed Telegram user IDs to the connector and messages from anyone else are ignored. Leave it blank and the bot accepts messages from anyone who can reach it. To find a user ID, send the bot a message and read message.from_id from the run payload.
Need Telegram in a production agent flow?

Bring the event source, payload shape, result destination, and any private-network or approval requirements. We will map Telegram to the right Connic connector mode, deployment path, and observability setup.

Talk to Sales