Skip to main content

Secretary Bot - basic working logic

In this guide we will tell you in detail how to create a BASIC LOGIC of your own Secretary Bot using the @MenuBuilderBot constructor.

NOTE: The Secretary Bots (formerly Business Bots) feature was added to the constructor almost immediately after its release in Telegram. At that time, we weren't sure how much interest this feature would have. Therefore, we implemented it in the simplest possible way - using the constructor's abilities itself. If you show your interest in Secretary Bots, we will continue to develop this functionality branch.

Peculiarities of work

Secretary bots created using the @MenuBuilderBot constructor - in their basic form - are implemented by creating simple and intuitive Lower Menu functionality. You create the Lower Menu buttons and messages, and the user, without seeing them, interacts with them indirectly - through instructions that you provide in messages, such as commands or keywords.

At the same time, interaction with Lower Menu in the Secretary Bot mode has its own features and limitations:
● Buttons in «Admin Only» mode are available to users only by commands.
● «Invisible» buttons are available to users by name.
● It is recommended to write the names of the menu buttons in LOWER case (see explanation below).
● Commands in private chat messages are NOT displayed - it is advisable to make them copyable within the message.
● Error message (Unknown command) - is not shown.
● Forwarded messages (Forward) - are not shown (technical limitation if Telegram itself).
● No functionality except messages works.
● Inline buttons and the lower menu are not shown.
● Forms (questions) do not work.
● Buttons closed by a Condition and buttons with functionality (Actions, Bonuses, etc.) are ignored.
In «Maintenance» mode, the bot does NOT respond in private messages and the Maintenance message itself is not shown.
● In the «Fast Click» mode, the bot ignores multiple messages and the warning message itself is not shown.

IMPORTANT: All messages sent by the user are forced to lowercase. Therefore, the names of the Secretary Bot menu buttons must also be written in lowercase. This way, it won't matter how the user spells a word - the bot will be able to process it correctly.

Creating secretary bot logic

Connect your bot to the MenuBuilderBot bot constructor

In order to create Secretary Bot logic using @MenuBuilderBot constructor, your bot must be added as a Menu-bot.

For information on how to prepare the bot for work (create a new bot, activate Secretary Mode, connect it to your Telegram account, and add it to constructor), see the previous guide: «Secretary Bot - General Information».

Creating Bot Responses

In the @MenuBuilderBot constructor, creating a BASIC LOGIC of Secretary Bot is similar to creating a Menu-bot. The only difference is that the Secretary Bot operates indirectly through private chats, without displaying the lower menu. However, essentially, the same commands and menu buttons are accessed as in a regular Menu-bot. Therefore, if you've mastered the basic mechanics of working with a Menu-bot, you won't have any difficulty creating a Secretary Bot.

As we write this guide, we assume that you already have an idea on how to ​​create a Menu-bot. 
If this is not the case, then first familiarize yourself with the basic features:
Creating buttons
Adding messages
Commands
Formatting text in Telegram

Approach 1

The Secretary Bot responds to the user only by commands and words that he "knows".

This is the simplest option, both in the aspect of creating a bot and in its capabilities. It is most suitable for beginners (in working with the constructor), for creating bots with simpler logic, and also if you are more likely to expect information from the user, rather than assume that the bot will lead the user through a rigid scenario.

To create such a bot, add several buttons to it, the names of which can serve as keywords to the information they contain. Add the corresponding messages to the buttons.

For example:
 The «schedule» button may contain a message with your working schedule (the name in in lowercase).

Thus, if the user sends the word "Schedule" in the personal chat, the bot will respond with the message specified in this button.

REMINDER: In Secretary mode, all user messages being formatted in LOWERCASE. This means that the names of the lower menu buttons should be written in LOWERCASE - this way, your keywords won't depend on how the user actually wrote them in the message. 

In BUSINESS BOTS (if you using Telegram-Premium), you can use a «Welcome Message» to initially inform the user of their available Keyword(s) or Command(s). To set a welcome message:
1. Go to your account Settings
2. Tap «Telegram for Business»
3. Select «Welcome Message»
4. Create the message itself, including the desired keyword(s).
When creating a Welcome Message, you can also specify how often it will be displayed.

Approach 2

The Secretary Bot, using Keywords or Commands, guides the user through a given scenario, responding with a default message to ANY unknown message from the user.

Use this approach if you want to STEP-BY-STEP guide your user, through the information you need, at the same time it is not implied that the user will write something by himself - because the bot will always respond with a default message, to any unknown user's messages.

Creating bot responses is done in a similar way - as described above - using buttons and messages. We will not dwell on this separately.

In order to set a "default" message that will be shown to the user in response to any unknown command (and return him to the beginning of the script), you need to replace the standard error message with your own, which will be called by the command from the button you've created.

INFO: The constructor includes a system message that displayed to the user if he sent to a bot an unknown message (that is not described in its logic) or a command (for which the reaction is not defined). This is done so that the user understands that the bot is working and responding, and not simply remaining silent. The mechanics for creating a "default" message for the Secretary Bot allow you to utilize this feature by replacing the system message with your own.

To do this, you need to activate the extension for customizing messages and, in particular, «Unknown command» (Error Message).

« 33. Custom Messages»
To connect, go to your bot:
☞ 🔐Admin | 🧩Extensions | 📂Customization

Then set up the error message command:
☞ 🔐Admin | 🎚Bot Customization | 🚯 Wrong Command Message

1. Set your error message (without it, adding a command option is not available) 
 2. OPTIONAL - click «Do not show message» to enable this option (enabling it will prevent the bot from showing the standard error message if the command is set).
3. Set the command itself (for example /default).

IMPORTANT: System commands like /start and /home do not work in the Business Bot.

Now if the user sends the bot an unknown command or a message to which the bot has no answer, the bot will call the command specified here.

In order for the command to work, you need to create a button with this command (/default) and add a message to it that will be the beginning of your script and contain the Key Words or Commands necessary for the user to start communicating with the bot.

For information on how to add a button command, see the «Guide on Commands».

To create a consistent scenario, each subsequent message must contain Key Words or Commands that will allow the user to choose the further direction of the dialogue with the bot.

❖ Additional information

If desired, the menu buttons can be hidden in two ways.

1. Switch them to the «Admin Only» mode, in which case the button message will be available only by command if it is set for this button. 
 2. «Invisible Button» mode - in this case the button message will be available both by its name and by command if it is added.

The Invisible Buttons functionality is available in Extensions and is added separately.
«36. Invisible Buttons and Messages»
To connect, go to your bot:
☞ 🔐Admin | 🧩Extensions | 📂Buttons

Design of Keyword and Commands

Since commands in private chats are not displayed as commands and cannot be clicked, for the convenience of the user it is advisable to highlight the desired Keyword and Commands as copied text.

For information on formatting text in Telegram, see «the markdown guide».