Action: delete messageΒΆ
This action allows you to delete messages previously sent using the send message
or wait for answer
actions. You can specify one or multiple messages to delete them in a single step.
What can you do with this action?ΒΆ
- Delete individual or multiple messages.
How to create and configure the action?ΒΆ
1. Create the actionΒΆ
- Go to your bot and tap
π 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
ββ Delete message
. - Click
Configure π
to set up this action.
2. Configure the messages to deleteΒΆ
Click π Set message to delete π
and specify the messages to delete, separated by commas, using the following methods:
#ActionID#
: ID of the action of anotherSend message
orWait for answer
action within the same button or command.message_id
: The ID of a message generated by Telegram, previously stored in a variable or entered directly.
Some examples
-
Using
#ActionID#
and#ActionID.message_id#
:#ActionID#, #ActionID2.message_id#
-
Using
message_id
entered directly:12345, 67890
-
Using
message_id
stored in a numeric variable calledmessage_id
:{message_id}
-
To delete multiple messages, separate them with commas:
#ActionID#, #ActionID2.message_id#, 56789
3. Activate the actionΒΆ
Click β
Activate
to enable the action.
What does the action return through its ID?ΒΆ
This action does not return any value.
Practical example: How to delete a messageΒΆ
In this example, the bot will send an initial message, ask the user to type something, and then delete both the initial message and the user's response.
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
and selectβοΈ Send message
. -
Click
Configure π
βπ¬ Set message π¬
and set an initial message. Example:Hello {first_name}, type a message:
-
Return to the actions menu and click
β Activate
to enable this action.
b) Action 2: Wait for answerΒΆ
- Click
π― New action
and selectβ³ Wait for answer
. - No configuration required, click
β Activate
to enable this action.
c) Action 3: Delete messageΒΆ
- Copy the ID of the action from both previously created actions (
Send message
andWait for answer
). - Click
π― New action
and selectβ Delete message
. - Click
Configure π
. -
Click
π Set messages to delete π
and enter the IDs of both actions, separated by a comma. Example:#701ka#, #SNxTR#
-
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 the user's input.
- Delete message: Both messages (the initial and the user's response) are deleted.