Skip to content

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ΒΆ

  1. Go to your bot and tap πŸ›  Edit to enter edit mode.
  2. Select the button or command where you want to add the action, or create a new one.
  3. Click Actions 🌟 β†’ 🎯 New action β†’ ❌ Delete message.
  4. 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 another Send message or Wait 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 called message_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ΒΆ

  1. Enter edit mode by clicking πŸ›  Edit in your bot.
  2. Click ✳️ New button | command.
  3. Enter the button name.
  4. Click Actions 🌟 to configure the actions for this button.

2. Add the necessary actionsΒΆ

a) Action 1: Send messageΒΆ
  1. Click 🎯 New action and select βœ‰οΈ Send message.
  2. Click Configure πŸ›  β†’ πŸ’¬ Set message πŸ’¬ and set an initial message. Example:

    Hello {first_name}, type a message:
    
  3. Return to the actions menu and click βœ… Activate to enable this action.

b) Action 2: Wait for answerΒΆ
  1. Click 🎯 New action and select ⏳ Wait for answer.
  2. No configuration required, click βœ… Activate to enable this action.
c) Action 3: Delete messageΒΆ
  1. Copy the ID of the action from both previously created actions (Send message and Wait for answer).
  2. Click 🎯 New action and select ❌ Delete message.
  3. Click Configure πŸ› .
  4. Click πŸ“ Set messages to delete πŸ“ and enter the IDs of both actions, separated by a comma. Example:

    #701ka#, #SNxTR#
    
  5. Return to the actions menu and click βœ… Activate to enable this action.


Final resultΒΆ

Your action flow should look like this:

  1. Send message: The bot sends the initial message.
  2. Wait for answer: The bot waits for the user's input.
  3. Delete message: Both messages (the initial and the user's response) are deleted.

Editing messages VisualMaker