The best analogy for bots will be information concierge services via chat.
Knowing the name of the bot, users create a chat with it in their client program. A bot can provide the interest of quick access to frequently asked questions, redirect messages to the operator and initiate communication by making announcements.
The advantages of this approach include:
• No need to install additional applications, and business to develop and maintain them;
• Communication with users can be automated by a set of prepared responses, thus reducing the call center load;
• Users will be able to receive information to frequent requests in one click
• Business receives all user access statistics;
• Ability to process natural languages ​​(Natural Language Processing), allows you to automate the communication of users in a free form and predict their behavior.
The first time the idea of ​​automating concierge services appeared during Yandex Tolstoy Camp, then we tried to make an analogue of Magic (http://www.getmagicnow.com/) and Luka (https://luka.ai/). At that moment, it seemed that the messengers would move along a closed path and did not open their API to work with them and access the data, so we looked at the good old SMS messages. There were workarounds and unofficial libraries for the same WhatsApp and Telegram, but it was risky to build their solutions based on this approach. Then, unexpectedly, Messenger Facebook and, then, Telegram opened their API and, I think, these platforms will allow you to create many interesting applications.
What can a bot.
The bot consists of two parts: user and operator.
Users can set text commands, use quick access buttons to the information or ask free-form questions that are redirected to the operator.
The operator can update the messages hidden behind each button (mainly schedules), and make announcements for users.
This is a simple functional, in part, it even exists in the Telegram itself (broadcast list, for example), but the ability to work with a large number of users, save this information and provide the prepared answers makes the option with the bot more convenient.
What's next
In the concierge bot project, it is interesting to add functionality related to geolocation, since knowing the location of a resident of Innopolis, one can understand a lot about the context of the situation. Also, when the database of user requests is large enough, you can try connecting NLP engines (http://wit.ai/ or tech.yandex.ru/tomita ) to automate communication with the operator.
As part of the summer school at Innopolis University, we decided to work with telegram bots. For three weeks we made a prototype framework on Scala using Akka to create telegram bots and wrote several useful bots on the framework.
We managed to create an API that allows you to write bots in “10 lines” and work asynchronously using Akka, as well as the ability to run multiple bots in one process. We plan to add different strategies for parallelizing the work of bots, more complex functions that facilitate the work with the API and DSL to set the bot behavior based on consecutive questions and answers.
Framework repository: github.com/CrazyPit/botspot
A bot that is already working with might and main is a bot uniting groups that do not fit into the limit of 200 people. Although there is information that this limit will be expanded in the fall, we have solved this problem now. The bot listens to 2 or more group chats and forwards all messages from one to the other.
Of the complex and useful projects on this framework, which we have done - the brodcasting bot. Firstly, it allows you to bypass the restriction on 100 people in mailings, secondly, it allows you to create different groups of users for mailings through a convenient interface, and thirdly, it allows you to find all the important information for a person in one chat with the bot. This service can be used for information inside the university, city or any organization.
The idea was born from the need to get less spam in the Telegram chat. There is a group chat where people find a companion and leave requests to the driver. And this is not the most convenient solution, because from time to time the search for fellow travelers falls into a terrible flame. Therefore, the idea to simplify the process of finding companions and, at the same time, to reduce the number of spam.
The procedure for creating a bot is not complicated: the steps to create it are simple and have already been described more than once; the most correct way is to start from the official site: core.telegram.org/bots .
The Telegram API has two ways to interact with the backend of the bot: through the webhook and through polling. I chose the first option, as it is faster and easier. Then everything is simple: we write backend, we form a list of bot commands, we make handlers for messages, we create an interface and voila - everything works.
It is worth paying attention that webhooks works only under the https protocol and the self-signed certificate does not fit, the Telegram API will not allow the webhook address to be hung with the self-signed certificate. For this there is a temporary solution - use ngrok (link) to test your bot directly from a local computer.
As a result, the first version of the bot is now working. Already accumulated a list of the nearest features that will be added to the bot, such as notification of the appearance of the trip, taking into account the remaining empty seats in the car, adding a comment field to the trip.
I want to develop this idea to a full-fledged service to find companions not only in Innopolis, but also in Kazan. I also plan to teach the bot to understand free speech so that the trip can be created, for example, with the following sentence: “I am going to go to my grandmother after a week, there is a place for 3 fellow travelers, not to smoke in the car!”
Source: https://habr.com/ru/post/267723/
All Articles