Three Telegram steps act on a message that is already in a chat: Edit a message — Changes a message your bot sent — Delete a message — Removes a message from a chat — and Pin a message — Pins a message in a chat. Each needs the chat and the message's id, which the step that sent the message gives.
Who can do this
Workspace Admins and Editors, on every plan. Viewers see the step's settings but cannot change them.
Before you start
- A Telegram connection in this workspace — see Connect Telegram.
- The message's id. A Telegram send step earlier in the workflow gives it as
id, and the chat aschatId.
Steps
- Select + after the step that sent the message. In the step picker, open Apps, select Telegram, then Edit a message, Delete a message or Pin a message.
- In Connection, choose your Telegram connection.
- In Chat, select Use a value and drag in the sending step's
chatId— for example{{ steps.send_a_message.chatId }}. Or choose the chat from the list. - In Message id, drag in the sending step's
id— for example{{ steps.send_a_message.id }}. For Edit a message: From the step that sent it. - For Edit a message only: in Text, the new text. Choose its Format — As the message was sent — Telegram does not keep it. — and under Buttons, the buttons it should keep: Telegram removes any not given again.
- Select Run this step to try it.
Output
Edit a message gives the message as it now is:
| Field | What it is |
|---|---|
id |
The message's id. |
chatId |
The chat's id. |
chat |
The chat's title, or the person's username or first name. |
text |
The new text. |
date |
When the message was first sent, in UTC. |
Delete a message and Pin a message give:
| Field | What it is |
|---|---|
chatId |
The chat, as you set it. |
messageId |
The message's id. |
deleted or pinned |
true |
Good to know
- Edit a message changes only text messages the bot sent. Give the Format and Buttons again as the message had them: Telegram keeps neither, so text sent as Markdown shows its symbols if edited as Plain, and buttons left out are removed.
- Delete a message: the bot can delete its own messages for 48 hours after it sent them. In a group or channel where it is an administrator allowed to delete messages, it can delete other people's messages too.
- Pin a message: in a group or channel, the bot must be an administrator allowed to pin messages. In a chat with one person it can pin without that. Pinning notifies the chat's members.
- Runs once per item.
If something goes wrong
| What you see | Why | What to do |
|---|---|---|
| Message id is not a number — use the id the step that sent it gave. | Message id holds something other than a number. | Drag in the sending step's id. |
| Message id is empty when the step ran — an earlier step may not have given the value it names. | The value came out empty. | Check the step it reads from ran for this item. |
| Telegram refused: Bad Request: message to edit not found / Telegram refused: Bad Request: message to delete not found | The id is not in that chat, or the message is gone. | Check Chat and Message id come from the same step. |
| Telegram refused: Bad Request: message is not modified: … | The new text is the same as the old. | Nothing to do — or check the text changes. |
| Telegram refused: Bad Request: message can't be edited | The bot did not send it, or it is not a text message. | Edit only the bot's own text messages. |
| Telegram refused: Bad Request: message can't be deleted | Over 48 hours old, or someone else's message and the bot is not an administrator. | Delete it in Telegram, or make the bot an administrator. |
| Telegram refused: Bad Request: not enough rights to manage pinned messages in the chat | The bot is not allowed to pin there. | Make it an administrator allowed to pin messages. |