Telegram Bot
Connect your Telegram bot to Fainflow to automate messaging, media, chats, and user interactions.
Step 1 — Create a bot in BotFather
- Open @BotFather in Telegram and start a chat.
- Send
/newbot. - Enter a display name for the bot (e.g.
My Support Bot). Users see this name. - Enter a username for the bot — it must:
- end with
bot(case-insensitive) - be 5–32 characters long
- contain only Latin letters, digits, and underscores
- be globally unique on Telegram
- end with
- BotFather replies with your bot token, e.g.
123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11.
⚠️ Keep the token secret. Anyone with the token can control your bot. Never commit it, never share it. If it leaks, send
/revoketo BotFather to invalidate it and generate a new one.
Step 2 — Configure the bot (optional but recommended)
While still in BotFather, send /mybots → select your bot to access:
| Setting | What it does |
|---|---|
Edit Bot → Edit About | About text on the bot's profile |
Edit Bot → Edit Description | Description shown before /start |
Edit Bot → Edit Botpic | Avatar image |
Bot Settings → Group Privacy | Disable if your bot must read all group messages (not just commands) |
Bot Settings → Allow Groups? | Whether the bot can be added to groups |
Edit Commands | Bot menu commands (e.g. /start - begin, /help - get help) |
Group Privacy is the most common gotcha — by default, bots in groups receive only commands and replies. If your flow needs every message, switch privacy to Disable.
Step 3 — Connect in Fainflow
- In Fainflow, open Connections → click + New Connection → choose Telegram Bot.
- Fill the form:
| Field | Description |
|---|---|
| Bot Token | Token from BotFather (Step 1.5) |
| Name | Any name you want to see in Fainflow (e.g. Support Bot) |
| Description | Short purpose, e.g. Customer support automation |
⚠️ The real bot is determined by the token, not the Name.
Nameis just a label inside Fainflow. If you paste the token of@bot_Aand call the connectionMy Trading Bot, the connection still talks to@bot_A— messages sent to@trading_botwill never reach this flow. After saving, the connection card shows the actual@usernameFainflow detected viagetMe— make sure that matches the bot you intend to chat with.
- Click Connect.
Fainflow validates the token by calling Telegram's getMe and saves your bot's username, first_name, and capabilities. On success you see Bot connected! with the bot's @username.
New Connection

Step 4 — Verify the connection
After saving, open the connection card in Connections. You'll see:
- Bot username — clickable, opens the bot in Telegram
- Bot token — masked (only first 8 characters visible)
- Capabilities —
can_join_groups,can_read_all_group_messages,supports_inline_queries
Use the Test connection button to verify the bot is alive and the webhook is registered. If the webhook is missing or broken, click Re-register webhook.
Step 5 — Rotate the token / edit the connection
You can change the bot token without deleting the connection — all attached flows keep working.
- Open Connections → click the connection card.
- Next to the masked Bot Token click Edit.
- Fill any combination:
- New Bot Token — leave empty to keep current. Paste a new one to rotate.
- Name — display name in Fainflow.
- Description — short purpose.
- Click Save.
If you provided a new token, Fainflow re-validates it through getMe and refreshes the bot's bot_id, username, first_name, and capabilities. Saving fails if Telegram rejects the token, so a bad paste can't break the connection.
💡 When to rotate? If you ran
/revokein BotFather (because the old token leaked), generate a new token, paste it here, and Save. No need to recreate the connection or rebuild flows.
Event: Bot Update
Triggers when your bot receives any update — messages, callbacks, media, join requests, etc.
Outputs
| Output | Type | Description |
|---|---|---|
updateType | string | message, callback_query, edited_message, etc. |
chatId | string | Telegram chat ID |
chatType | string | private, group, supergroup, channel |
fromId | string | Sender's Telegram user ID |
fromUsername | string | Sender's @username |
firstName | string | Sender's first name |
lastName | string | Sender's last name |
messageId | string | Telegram message ID |
text | string | Message text content |
messageKind | string | What kind of update it is — see below |
caption | string | Caption of a media message (photo/video/document) |
hasMedia | string | "true" if the message has a downloadable file |
fileId | string | file_id of the attachment — pass to Download File |
memberStatus | string | For join/leave: the new membership status |
targetUserId | string | For join/leave: the affected user's ID |
date | string | Unix timestamp |
raw | json | Full raw Telegram update object |
Reacting to more than text — messageKind
The single Bot Update event fires for every update. To handle a specific
kind — a photo, a voice note, or being added to a channel — branch on
messageKind with an If (or Continue If) function right after the event.
messageKind is one of:
text, photo, video, animation, voice, audio, document,
sticker, location, contact, poll, dice, callback, inline,
join, leave, member_update, join_request, edited, unknown.
Recipes:
- Handle a photo —
If messageKind == "photo"→ usefileIdwith the Download File function (andcaptionfor any text). - Handle a voice message —
If messageKind == "voice"→fileIdis the audio file. - Bot added to a channel/group —
If messageKind == "join"→chatIdis the chat you were added to,memberStatusis your new role. - Any media at all —
If hasMedia == "true".
Specific event triggers (simpler flows)
If a flow only cares about one kind of update, pick a specific trigger instead of Bot Update + a filter — the flow then fires only for that kind:
Text Message · Photo Received · Video Received · Voice Message · Audio Received · Document Received · Sticker Received · Location Received · Contact Received · Poll Received · Added to Chat/Channel
They carry the same outputs as Bot Update (including fileId/caption), so
e.g. Photo Received → Send Photo (with fileId) needs no If at all. You can
run several flows on the same bot — one per trigger. Use Bot Update when you
want one flow to see everything.
Example: Echo Bot
A simple bot that replies with the same text it receives.
Event: Bot Update
↓
Action: Send Message
chatId ← chatId (from event)
text ← text (from event)
Echo Bot
Bot repeats the message it receives

Telegram Bot
Bot Update

Telegram Bot
Send Message
Example: AI Chat Bot
A bot that responds using OpenAI GPT.
AI Chat Bot
Bot responds using OpenAI GPT

Telegram Bot
Bot Update

OpenAI
Send Prompt

Telegram Bot
Send Message
Available Actions
| Action | Description |
|---|---|
| Send Message | Send text to a chat |
| Send Reply | Reply to a specific message |
| Edit Message | Edit existing message text |
| Delete Message | Delete a message |
| Send Photo / Video / Document / Audio / Voice | Send media |
| Send Media Group | Send multiple media items at once |
| Send Inline Keyboard | Message with inline buttons |
| Send Menu | Message with reply keyboard |
| Send Chat Action | Show "typing..." indicator |
| Answer Callback | Respond to inline button press |
| Set Commands | Set bot command list |
| Get Chat / Get Chat Member | Read chat or member info |
| Ban Member / Unban Member | Moderate users |
| Approve Join / Decline Join | Handle join requests |
See Telegram Bot Actions for detailed input/output reference.
Tips
- Use Continue If to handle only specific message types (text, commands, photos).
- Use If/Else with
textcontains/startto greet new users. - Store the bot token in Vault if you also need to call Telegram API directly from a function — reference it as
{{vault.BOT_TOKEN}}. - Keep Group Privacy enabled unless your flow really needs all messages — Telegram throttles bots that pull more data than they need.
Troubleshooting
| Symptom | Cause / Fix |
|---|---|
| Flow never fires, but everything looks set up correctly | The token in the connection belongs to a different bot than the one you're writing to. Open the connection card and check the Bot Username — that's the bot Fainflow is listening to (detected via getMe). If it's wrong, click Edit and paste the token of the bot you actually want. The Name field is a label, only the token matters. |
Invalid bot token — Telegram rejected it | Token wrong, copied with extra spaces, or revoked. Get a fresh one from BotFather. |
| Bot doesn't react to messages in a group | Group Privacy is enabled. In BotFather: /mybots → Bot Settings → Group Privacy → Disable. |
| Bot worked, then stopped | Webhook may have been overwritten by another service or revoked. Open the connection and click Re-register webhook. |
409 — bot already connected | This bot is already linked to another connection in your account. Either remove the old one or use a different bot. |
Bot sees /start but not regular messages | Same as Group Privacy issue — disable it in BotFather. |
Conflict: terminated by other getUpdates request in your flow logs | Another process is polling the same bot. This usually means the same bot token is connected elsewhere (another Fainflow account, a self-hosted instance, or a different integration). Disconnect the bot from the other place so only one consumer polls it. |