Answer the question
In order to leave comments, you need to log in
Is it possible to create such a Telegram bot?
Hello!
I want to create a telegram bot to interact with clients. Due to inexperience, I don’t know whether it is possible to implement such an algorithm or not, tell me.
The client writes to the bot a list of details that interest him, the manager on the other side sees his message, processes the list and sends an offer to the messenger. There are several managers, even more clients, so all managers should see messages from clients to the bot, and they will agree among themselves who processes and responds to which message.
I'm learning Python, I think I'll figure it out. Now it’s not clear to me where to dig and what tools to use and whether it’s even possible to implement this. Now the company works according to the same scheme, only on regular e-mail. Clients send requests to the mail, all managers have this mailbox connected and they respond to these letters. I would like to implement this in the messenger.
At the moment I have created a new bot. I try to send him a message from another phone, messages do not appear in it. While I read the Internet on this topic.
Thanks for the hints.
Answer the question
In order to leave comments, you need to log in
Yes, you can do it, but the most elegant way would be to do everything in Telegram without unnecessary integrations, web interfaces, etc. as stated in other answers, and it will be easier for you to create.
Applications can come to a group where the managers themselves are already located, and everyone will already distribute applications.
But before development, you first need to understand how Telegram bots work under the hood. All of them are built and managed by API, but they have made a convenient shell for you in the form of libraries / frameworks that are easy to manage. Therefore, if you create a bot and simply send him a text, he, of course, will not answer you anything, because you need to somehow process this request.
Total:
1 step - get acquainted with the pyTelegramBotAPI library
This is a very simple library, there is a lot of information on this topic in Google (if you need 1-2 projects, you can stop at it, but if you are considering further development of bots or expect maximum performance, it is better to study aiogram right away)
Step 2 - get to know the base You can make data
in 2 ways:
2.1 Telegram itself can act as a database, for example, an application will be sent to a group, and from there you can already extract this text, nothing complicated and superfluous will need to be connected (except for figuring out how to number applications)
2.2 Connect a real database data
Yes, it will be a little more complicated, you can start with sqlite3. Just get familiar with CRUD operations, that should be enough.
To make it easier - use the SQLiteStudio program.
For the future, consider full fledged mysql/postgresql or nosql databases as sqlite has its drawbacks.
Step 3 - get your server
To run bots - there are 2 options: polling, and webhooks. Option 2 is more reliable and more difficult, but 1 will be a great start. Plus 1 option will give you the convenience of developing and running the script with just 1 bot.polling() command.
Step 4 - take care of the smooth operation of the script on the server
If you run on linux, you will need to write a systemd file (for example, bot.service) that will raise your script if there is some error in the code.
That's all)
PS But since I already have enough experience in development, I would build using the following technologies:
aiogram + FastAPI + uvicorn + mysql.
Good luck with development!
Yes, you can.
Here, most of the work will be in the distribution of calls from clients to managers and back, so that it is convenient - most likely this will have to be done through some additional web interface, or through another messenger (I did this in rocketchat).
So this is a standard chatbot. There are millions of them, respectively!
It should be understood that it is necessary to study the sqlite3 database!
Come back with specific questions about individual implementations of your script when you get smarter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question