Action: Edit message¶
This action allows you to modify the content or the inline keyboard of a previously sent message using the Send message
action. It is ideal for updating information or changing inline keyboards without needing to send a new message.
What can you do with this action?¶
- Edit a message that was sent using the
Send message
action, either changing the text or the multimedia content. - Edit inline keyboards without modifying the original text.
How to create and configure the action?¶
1. Create the action¶
- Go to your bot and click
🛠 Edit
to enter edit mode. - Select the button or command where you want to add the action, or create a new one.
- Click
Actions 🌟
→🎯 New action
→✏️ Edit message
. - Click
Configure 🛠
to set up this action.
2. Configure the options¶
➡️ Set message ID to edit
¶
Specify the message you want to edit using the #ActionID#
from a previous action or a message_id
stored in a variable.
#ActionID#
: Action ID of anotherSend message
action in the same button or command.message_id
: ID of the message generated by Telegram, previously stored in a variable or entered directly.
➡️ Set new message
(optional)¶
Define the new content of the message. If this field is left empty, only the inline keyboard will be updated. Example:
Your order is now being processed.
➡️ Delete message
(optional)¶
Deletes the previously stored message.
➡️ Deploy inline keyboard
(optional)¶
Updates or adds an inline keyboard to the message. If left empty, only the message content will be updated.
➡️ Web preview
(yes
| no
) (optional)¶
If the new message includes a link, enable or disable the web page preview.
Note
3. Activate the action¶
Click ✅ Activate
to enable this action so the message can be edited when the action flow is executed.
What does this action return through its ID?¶
This action does not return any value directly. If you need to edit the message again later, you can use the message_id from the original Send message
action.
Practical example: How to edit a message¶
In this example, the bot will send an initial message, ask the user to type something, and then replace the bot's message with what the user wrote.
1. Create a new button¶
- Enter edit mode by clicking
🛠 Edit
in your bot. - Click
✳️ New button | command
. - Enter the button name.
- Click
Actions 🌟
to configure the actions for this button.
2. Add the necessary actions¶
a) Action 1: Send message¶
- Click
🎯 New action
→✉️ Send message
. -
Click
Configure 🛠
→💬 Set message 💬
and set an initial message. Example:This is the original message.
-
Return to the actions menu and click
✅ Activate
to enable this action.
b) Action 2: Wait for answer¶
- Click
🎯 New action
→⏳ Wait for answer
. - No additional configuration is needed. Click
✅ Activate
to enable this action.
c) Action 3: Edit message¶
- Click
🎯 New action
→✏️ Edit message
. -
Click
Configure 🛠
and make the following adjustments:🆔 Set message ID to edit 🆔
: Paste the Action ID ofSend message
action (action 1).-
💬 Set new message 💬
: Enter the message that will replace the original message once the action is executed:- To replace it with the text entered by the user, enter:
{#ActionIDWaitForAnswer.text#}
Replace
ActionIDWaitForAnswer
with the Action ID ofWait for answer
(action 2). - To replace it with the text entered by the user, enter:
-
Return to the actions menu and click
✅ Activate
to enable this action.
Final result¶
Your action flow should look like this:
- Send message: The bot sends the initial message.
- Wait for answer: The bot waits for user input.
- Edit message: Replaces the initial message with the text entered by the user.
This action is useful for keeping a conversation clean and avoiding unnecessary message accumulation.