DaoDesk has the ability to process requests from Telegram bots. Bots are special Telegram accounts created to automatically process and send messages. Users can interact with bots using messages sent through regular or group chats.
1) Create a new bot.
Contact the user @BotFather on Telegram and follow his instructions:
Type the /newbot command to create a new bot. BotFather will ask you for the name of the bot and prompt you to come up with a name and username. The name will be displayed in contacts and chats.
Username - a short Latin name used for mentions of the bot and in links to the profile in t.me/
Username must consist of Latin letters, underscores and numbers and be between 5 and 32 characters long. Also, the username must necessarily end with “bot”, e.g.: “test_dao_bot”.
Further you can customize your bot at will: set a picture, description, etc. A full list of possible commands is available at /help.
Step 2: connecting the bot to the system.
After creating a bot, you will receive an authorization key, which is necessary to connect to your system. The key (token) is provided by BotFather, here:
Once you have created a bot and received your authorization key (token), you can connect the created bot to DaoDesk. To do this, go to the “Channel settings” section from the Management and click on the “Add channel” button. Then select “Telegram” and the department to which the channel will be connected.
In the “Bot key” field, enter the API token (which was provided by @Bot_father) and click on the “Synchronize and save” button. If the settings are correct, the status will show “Connection successfully established”:
In order for the bot to work with both regular private messages and group chats, you need to specify in the bot settings:
- /setjoingroups - determines whether your bot can be added to groups:
By default, this parameter is enabled (Enabled). If necessary, it can be disabled (Disable):
- /setprivacy - toggles group privacy mode (whether your bot sees all posts in groups).
'Enable' - your bot will only receive messages that start with the '/' character
'Disable' - your bot will receive all messages that people send to groups.
If a bot is assigned as an admin in a group, it will read all messages from the group, no matter what /setprivacy mode is set!
Thus, the user (client), without going directly into the system, can contact your support team using the usual way of communication via Telegram, and you, in turn, will be able to process requests received from social networks and messengers directly in DaoDesk.
Additional information
1) When editing and deleting messages in a request from Telegram in DaoDesk, these messages will be edited/deleted on the client side as well.
2) The functions of mentioning a user and quoting answers in a request are available for Telegram. It works the same way as in the messenger itself: you select a user in the request, click the mention/respond to comment button under his post and write a message:
3) A group in Telegram can be connected to channels, which will allow members of the group to leave comments under posts in the channel. DaoDesk is able to collect all these comments - for each post a separate request with the name of the message is created, where all the messages left by users are “pulled”.
Comments under posts on the DaoDesk side will always be displayed with a quote to understand whether this message is just a general comment on the post, or whether the user is replying (repaying) another user:
4) DaoDesk is able to detect the language of a user from Telegram who has contacted the system for the first time.
At the moment of creating a contact card, the system considers the language of the client from his Telegram settings and if there is, for example, English, then the same language will be specified in his contact card in DaoDesk. For the functionality to work correctly, the corresponding language must be enabled in the “Language” menu.
5) If a user puts a reaction to a message in Telegram some time after it was sent, the messenger will resend this message to the application as a response, because it is considered an edited message, and they come to DaoDesk in the form of separate responses.
It is also worth considering this feature of Telegram integration in closed requests: a user's reaction to a post in an already closed request will trigger the creation of a new request with a response to which a reaction has been set.
6) In the bot's settings you can prohibit its addition to third-party group chats to avoid spam and other problems.
Once you have connected your bot to DaoDesk, go to settings in chat with @BotFather and disallow further adding the bot to groups. You can do this by using the Allow Groups - Turn groups off command:
Once this ban is enabled, the bot will automatically log out of the channels it is added to.
Possible errors
Sometimes, when working with the channel, you may encounter some errors (the message was not delivered, connection failure, etc.). Since the integration is two-sided, there can be both certain restrictions on sending and interruptions in general on the Telegram side. In the logs of the channel, you can see what this or that problem was associated with, as well as view its error code. Besides, the information about the fact that the message was not delivered, as well as the reason for it, is displayed near the message itself.
Below is a list of some of the most popular problems and their causes:
- 413 Request Entity Too Large - means that the attachment sent from the system exceeds the maximum allowed size (50MB);
- Error 500 indicates that there is some kind of malfunction on the Telegram server side. Try again after some time;
- 403 FORBIDDEN - privacy violation. For example, an attempt to write a message to the person who blocked your bot.
- Telegram has a method getWebhookInfo to get the current state of the bot (its status), which does not require parameters. If successful, it returns a WebhookInfo object. If the bot uses getUpdates, it returns an object with an empty url field.
For example: https://api.telegram.org/bot123456:ABC-DEF1234/getWebhookInfo
Where 123456:ABC-DEF1234 is the token of your bot.
- The ?start= command allows you to pass information in the link when accessing the bot. Example: https://t.me/yourbotname?start=Hello-World