Skip to content

Action: wait for answer

This action will wait for the user to send something before continuing with the rest of the actions.

You can apply validations to ensure that the user sends exactly what is expected. If the sent message does not meet a validation, the specified error message will be displayed, and then the user can try again.

You can also use cancellation texts. If the user sends any of these texts, the action will be stopped, and the specified cancel message will be displayed. Additionally, the specified button will be pressed upon cancellation.

What the user sends is accessible through the ID of this action and can be used in subsequent actions using #ActionID#.

Options of the action:

  • Validation: To validate what the user sends, you can validate text, numbers, emails, URLs, videos, photos, among others. You can also set more advanced validations using regular expressions, for example, the regular expression to validate that what the user sends is a valid TRX address would be ^T[A-Za-z1-9]{33}$.
  • Error message (optional): This is the error message that will be sent to the user if the validation is not met. The user can retry until the condition is met or until they send one of the cancellation texts. You can use expressions, variables, and IDs of previous actions to improve your messages.
  • Cancellation texts (optional): One or more texts that will cancel this action and all subsequent actions if sent by the user. It is a good practice to create a keyboard with these texts beforehand so that the user knows how to cancel. Additionally, by default, /start cancels any wait in the bot.
  • Show message on cancel (optional): This is the message that will be sent to the user when they send one of the cancellation texts, ideal for letting them know that the operation has been canceled. You can use expressions, variables, and IDs of previous actions to improve your messages.
  • Press button on cancel (optional): Specify that upon sending one of the cancellation texts, one of the main buttons or commands of the bot is automatically pressed to redirect the user somewhere, for example, to the main menu.

What does the action return through its ID?

  • text: If what the user sends is text, you can access it through #ActionID.text#.
  • file_type: If what the user sends is multimedia or a file, you can check what type it is.
  • file_id: If what the user sends is multimedia or a file, you can access its file_id through #ActionID.file_id#.
  • id: Telegram ID of the user who sent the message.
  • first_name: First name of the user.
  • last_name: Last name of the user.
  • username: Username without @.
  • language_code: Language code of the user, in ISO 639-1 format.
  • is_deleted: Returns True if the user is a deleted account on Telegram, or False if not.
  • is_bot: Returns True if the user is a bot, or False if not.
  • is_premium: Returns True if the user has an active Premium subscription from Telegram, or False if not.
  • is_verified: Returns True if the user is verified by Telegram, or False if not.
  • is_restricted: Returns True if the user has any restrictions imposed by Telegram, or False if not.
  • is_scam: Returns True if the user has the scam tag imposed by Telegram, or False if not.
  • is_fake: Returns True if the user is flagged as fake by Telegram, or False if real.
  • is_forward: Returns True if the message is a forwarded message, or False if not.
  • contact: Returns the user's contact, if shared.
  • location: Returns the user's location, if shared.

If is_forward is True, you can also access the following:

  • forward.id: Telegram ID of the chat from which the forwarded message comes.
  • forward.title: If the forwarded message comes from a channel or group, returns its name.
  • forward.first_name: If the forwarded message comes from a user, their first name is stored here.
  • forward.last_name: If the forwarded message comes from a user, their last name is stored here.
  • forward.username: Username without @ of the chat from which the forwarded message comes.
  • forward.is_deleted: Returns True if the chat from which the forwarded message comes is a deleted account on Telegram, or False if not.
  • forward.is_bot: Returns True if the forwarded message comes from a bot, or False if not.
  • forward.is_premium: Returns True if the user from which the forwarded message comes has an active Premium subscription from Telegram, or False if not.
  • forward.is_verified: Returns True if the chat from which the forwarded message comes is verified by Telegram, or False if not.
  • forward.is_restricted: Returns True if the user from which the forwarded message comes has any restrictions imposed by Telegram, or False if not.
  • forward.is_scam: Returns True if the chat from which the forwarded message comes has the scam tag imposed by Telegram, or False if not.
  • forward.is_fake: Returns True if the user from which the forwarded message comes is flagged as fake by Telegram, or False if real.
  • forward.post_views: If the forwarded message is a post from a channel, returns the number of views that post has, as a numeric value.
  • forward.post_times_forwarded: If the forwarded message is a post from a channel, returns the number of times the post has been forwarded, as a numeric value.