Skip to content

Give your agent its own Telegram bot. You start in the dashboard, then create the bot in a Telegram chat with Photon's bot manager. Message the bot, and the message reaches your project.

Prerequisites

You need:

  • A project from Set up your project.
  • A Telegram account.
  • The owner, admin, or member role in the project's organization.
1

Open the bot manager

Open Telegram in your project and select Connect a bot. Telegram opens in a new tab, in a chat with Photon's bot manager. If Telegram shows Start, select it.

You don't need a bot token from BotFather. The bot manager connects the bot for you.

To start the connection from code instead, call connectTelegramBot and open the setup link it returns.

2

Create your bot

The bot manager offers Create bot and Connect existing bot. Select Create bot.

Telegram opens its own dialog for a new bot. It suggests a name and a username. Change either one if you want, then create the bot.

If you kept the suggested username, the bot manager connects the bot on its own. If you changed it, the bot manager shows the new bot. Select Select this bot, then Confirm connection.

The bot manager sends a new message when the bot is connected. In the dashboard, the bot appears under Bots as Connected.

3

Message your bot

Under Bots, open your bot. In the Bot link row, select Open in Telegram. If Telegram shows Start, select it. Then send any message, such as hi.

4

Check that it arrived

Your message appears under Recent messages on the bot's page. Select Inbox to open the conversation. From now on, every message to the bot reaches your project.

How a Telegram bot works

  • People message the bot first. A Telegram bot can't start a chat. Your agent can reply after someone sends the bot a message.
  • Every message sent to the bot reaches your project. To invite someone, share the bot's link from Bot link.
  • Your agent sends only in private chats. A group chat with the bot stays readable in Inbox, but your agent can't reply there.
  • Connecting a bot is free. Photon doesn't charge per message for Telegram.

If your message doesn't arrive

What you seeWhat to check
No Connect a bot buttonYour role. Owners, admins, and members of the organization can connect a bot.
Telegram doesn't openYour browser blocked the new tab. Allow pop-ups for the dashboard, then select Try again.
Pick up where you left off?A setup is already in progress, and a project runs one at a time. Select Continue in Telegram to finish it, or start over.
The bot manager says the bot could not be connectedNothing was connected. Select Connect a bot to start a new setup.
The bot shows Needs attentionOpen the bot and read Connection issue. Then Disconnect the bot and connect it again.
The bot is Connected, but your message doesn't appearYou messaged a different bot. Compare the bot's Username with the chat in Telegram.

Next: receive messages

Receive messages

Get each message to your bot as an event in your code.