To work with Telegram bot in enKod go to Mailings → Telegram bots.
Make sure that the bot has been previously created in @botfather. For the desired bot, copy the token (read more about integration with Telegram in this article), you will need it to activate the bot in enKod.
Set a name (it will be displayed only in the enKod interface) and go to the bot editor. Two blocks are available for customization: start and message.
The chain of any bot should start from the start block. At the moment only start by /start command is available, but this list will be expanded in the future.
Place the “Message” block and connect the starting block to it by pulling a link. In the “Message” block you can set the text and customize the buttons. Buttons can be one of three types:
In total you can add up to 10 buttons to 1 “Message” block, buttons of different types can be used in parallel with each other, only the number of “return to the beginning” buttons is limited.
Each button in a block can and must be connected to subsequent “Message” blocks (with their own buttons). The button-text must be connected to the next block (even if it contains just some message, for example, “thank you”), otherwise the dialog of the bot with the user will not be finished, because it will not react to the click. It is acceptable to not connect the button-link to anything, because the transition itself can be a necessary action. The “return to the beginning” button does not require a connection, because it always performs one specific action.
Thus, by combining message blocks with different buttons inside the bot you can create an infinite number of different scenarios depending on the user's action - to transfer him to the site, to send certain notifications on click, etc.
When activating the bot, if all checks pass successfully, the system will ask you for the access token of the bot, which was obtained from @botfather. Paste the token into the popup window and launch the bot.
When launching the bot, we will receive and save contacts's username into the contact base. Such contacts, even if they do not have any other channels, are considered to be full-fledged and participate in the billing of the base. Usernames of contacts are available for viewing and editing in the contact card.
If a contact changes his/her username in Telegram, his/her username will also change in enKod. This will happen the next time the bot sends a message to the contact or the next time the contact interacts with the bot (i.e. not instantly).
Deleted contacts will not be restored when interacting with the bot to avoid accidentally exceeding the database size limit.
Please note that the bot cannot write first, even if there is a contact with a filled in username! The bot can be launched only by the user.
In the bot details, statistics are available to view, namely:
In addition to these metrics, you can view statistics on the blocks themselves in the “Preview” tab:
The active bot can be edited (name, content of blocks (buttons, texts), their order, add new blocks, delete blocks), but it is forbidden to change the token in the authorization window. When editing an active bot, it continues to work according to the script. Changing the bot token is available only for inactive status.
If during editing you:
1. Deleted a message block
If the user has already received this block, it will not be deleted. If deleted along with subsequent blocks - users will end this branch of the script. If the links between subsequent blocks are not broken, the user will move on with the edited script.
2. Deleted message block with buttons
Buttons in the received message of the deleted block will become unclickable. If the user has already clicked on the buttons of the deleted block and has moved on in the branch, and the blocks exist and the links are not broken, the user will move on in the edited branch. Otherwise, the user will terminate the bot script branch.
3. Edited text and/or button links in a message block
In already received messages with the old text, the buttons will be unclickable. Otherwise there are no changes.
4. Changed links with blocks by buttons.
Buttons will become unclickable in the message the user has already received. Otherwise, the user will go on with the edited script. If the branch is missing - the user will terminate the script.
5. Added a button to the message
The button will not be added to already received messages. Buttons that have not been modified will be clickable. Otherwise, the user will move on with the edited script.
6. Deleted one of the buttons from the message
In already received messages, the deleted button will become unclickable. Otherwise, the user will follow the edited scenario.
Display statistics when editing bot