# 42 · Telegram: your bot in the inbox, with AI, workflows and broadcasts

**Purpose:** connect your own Telegram bot so messages to it arrive in the same inbox as WhatsApp, let the AI agent and workflows answer there, share start links, and send broadcasts to everyone who started the bot.

## Before you start

- A plan that includes **Telegram**. If you do not see **Telegram** under **Channels** in the sidebar, your plan does not include it yet.
- You are an owner or admin of the workspace. Members can look at the Telegram page, but only owners and admins can connect a bot, change links or send broadcasts.
- The Telegram app on your phone or computer. Wsapme uses Telegram's official **Bot API**: customers write to your **bot**, never to your personal Telegram account.
- Private chats only for now. Telegram groups and channels are not supported yet.

> No Telegram bot was connected while this guide was written, so the steps after **Connect** are described **from the documentation, not captured**.

## Part 1 · Create a bot and connect it

1. In Telegram, open **@BotFather** (the official bot with a blue tick) and send `/newbot`.
2. Give the bot a name (for example *Kedai Aina*) and a username that ends in `bot` (for example `kedaiaina_bot`).
3. @BotFather answers with a **token** such as `123456789:AAH…`. Copy it. Treat it like a password: anyone with it can control your bot.
4. In Wsapme, in the sidebar under **Channels**, click **Telegram**, then **Connect a bot**.
5. Paste the token and click **Connect**. *(from the documentation, not captured)* Wsapme checks it with Telegram, stores it encrypted and never shows it again; the page only shows the bot's number with dots, such as `123456789:••••••••`.
6. The bot is listed as **@kedaiaina_bot** with the status **Connected**. Click **Open** to see it in Telegram.

Good to know:

- A bot can be connected to one Wsapme workspace only. Otherwise you see "This bot is already connected to another Wsapme workspace. Disconnect it there first."
- Telegram bots do not use your WhatsApp number slots. If your plan limits them, the page shows a line such as "1 of 2 bots used on your plan."
- If the token ever leaks, send `/revoke` to @BotFather, then click **Paste new token** (or **Connect a bot**) and paste the new one. The bot keeps its chats.

## Part 2 · Telegram chats in your inbox

1. Open your bot in Telegram from another account and press **Start**, then write a message.
2. The chat appears in **Inbox** with a **Telegram** badge. The contact gets the person's Telegram name (and @username, if they have one). Telegram does not share phone numbers, so the contact has none.
3. Reply as usual: text, pictures, files, videos and voice notes all work. Pictures, files, videos and voice notes that customers send are saved, like on WhatsApp.

Good to know:

- Telegram has no 24-hour window: you can reply at any time, as long as the person has not blocked the bot.
- A bot can only write to people who opened it and pressed **Start**. You cannot start a chat with someone by their phone number.
- In the inbox's number filter, choose **Telegram** to see only Telegram chats.

## Part 3 · Let the AI agent answer

1. Go to **AI → Set up** (or the agent's settings) and find **Instagram, Messenger & Telegram**.
2. Tick your bot and save. The agent now answers new messages to the bot, with the same rules as WhatsApp (reply delay, handing over to your team, business hours).
3. When the agent offers a few choices (for example two packages), Telegram shows them as **buttons** under its message. Tapping a button sends that choice back as the customer's answer.

## Part 4 · Start links (t.me links with a code)

A start link looks like `https://t.me/kedaiaina_bot?start=fbad`. When someone opens your bot through it, Wsapme can add tags to them and start a workflow.

1. On the **Telegram** page, under **Start links**, click **New link**.
2. Give it a name (for example *Facebook ad — November*). Leave **Code** empty to get one made for you, or type your own (letters, numbers, `_` and `-`).
3. Tick the tags to add and, if you want, choose a workflow to start. The workflow must be switched on.
4. Click **Save**, then **Copy** to copy the link for your ad, bio or QR code.

Each link shows how many times it was opened and how many people started the bot for the first time through it.

## Part 5 · Workflows on Telegram

In **Workflows**, open a workflow and choose one of these under **Starts when**:

- **Telegram message received**: any message to the bot, or only messages with one of your keywords.
- **Telegram bot started (/start link)**: someone pressed **Start**, or opened a start link with one of the codes you list. The placeholder `{{start_code}}` holds the code.

Tick the bots it listens to (none ticked = every bot). A chat runs one flow at a time: while a flow waits for an answer, the next message goes to that flow. A start link with its own workflow goes first.

## Part 6 · Telegram broadcasts

1. On the **Telegram** page, under **Broadcasts**, click **New broadcast**.
2. Give it a name, write the message and, if you want, add a picture or file. A text of up to 1,024 characters goes as the picture's caption; a longer text follows it.
3. Optionally tick tags: then only people with any of those tags get it.
4. Click **Send now**. It goes to everyone who started the bot and has not blocked it, at Telegram's pace (about 25 messages a second). The list shows how many were sent, how many people blocked the bot and how many failed. Click **Stop** to stop it.

Broadcast messages appear in each chat, but they do not move the chats to the top of the inbox.

## Part 7 · API and AI assistants

- The API sends on Telegram with `POST /v1/messages`, `"channel": "telegram"` and `to` = the contact's id, their Telegram user id or @username. `GET /v1/telegram/bots` lists your bots. See [07 · API, webhooks and AI assistants](https://v3.wsapme.com/guides/api-webhooks-mcp.md).
- The MCP connector's **send_message** takes `channel: telegram`, and **list_telegram_bots** lists your bots.

## Common problems

| Problem | What to do |
|---|---|
| **Telegram** is not in the sidebar | Your plan does not include it. See [09 · Account, team and billing](https://v3.wsapme.com/guides/account-team-billing.md). |
| "This does not look like a bot token." | Copy the whole token from @BotFather, with the numbers, the colon and the letters after it. |
| "Telegram did not accept this token." | The token was revoked or mistyped. Send `/token` (or `/revoke`) to @BotFather and paste the new token. |
| The status is **Reconnect needed** | The token was revoked in @BotFather. Click **Paste new token** and paste the current token. |
| Messages to the bot do not arrive | Click **Check connection**. If another service also uses this bot (another tool that set a webhook), disconnect it there: a bot can send its messages to one place only. |
| "This person blocked the bot or stopped it." | They need to open the bot and press **Start** again. Until then nothing can be sent to them, and broadcasts skip them. |
| "Nobody has started this bot yet." when sending a broadcast | Share the bot's link (or a start link) first: only people who pressed **Start** can get broadcasts. |
| "Telegram asked to slow down." | Wait a few seconds and send again. Broadcasts wait by themselves. |
| A start link added no tag or started no workflow | Check that the link's bot is the one the person opened, the workflow is switched on, and the person is not already in another flow. |
| Messages from a Telegram group do not arrive | Groups and channels are not supported yet; only private chats with the bot are. |

## Related

- [02 · Team inbox](https://v3.wsapme.com/guides/team-inbox.md)
- [04 · Chatbot and workflows](https://v3.wsapme.com/guides/chatbot-workflows.md)
- [05 · AI agent and knowledge](https://v3.wsapme.com/guides/ai-agent-and-knowledge.md)
- [18 · Instagram, Messenger and comment replies](https://v3.wsapme.com/guides/instagram-messenger-and-comment-replies.md)
