I’m new to development of Telegram bots and can’t figure out how I can implement communication between the server side and the bot.
I understand how to send messages to the server, I just send a POST-request to the server and get some kind of Response. The question is about sending request from server to the bot. I want to make a bot that when receiving a message from a user in Telegram-chat will forward this message to the server, where message will be processed, and in the response will come the result of processing, which will be sent to the user. Bot will receive in the response Json-file { ‘chatid’: 1234567,
‘result’ : “Some text message”}.
At the same time, the server will have a web interface with a button, which will be pressed to send to the bot a request with data. The data can be different. For example, I clicked button in the web-interface and the bot received a chatid and some text, after which the bot sent it to the person whose chatid was received. But just using sendMessage from the server side is not suitable for me because there may be another case when the bot will receive a request for example to remove a user from a group or publish a post in a certain channel, etc.
I can not understand how to implement the mechanism of receiving a request from the server.
I found that you can use Flask server, which will work in parallel with the bot, which will receive requests from the server, and from there you can try to somehow transfer data to the bot, but it seems to me as overkill. Bot and server with web-interface will work on the same hardware and something tells me that the transfer of requests can be implemented in another way.