Official Telegram API explains how to send messages from Telegram Bot via API to:
- real users
- channels
- groups
But it is unclear how to read messages from the bot and reply to them programmaticaly.
Use case
There is a bot that shows weather in the city you ask.
You want to make "HTTP gateway" to that bot:
- user sends HTTP request to /weather?city=London
- backend send message to Telegram bot
- Telegram bot answers "rainy"
- backend reads message from the Telegram bot
- backend returns "rainy" to user
Possible solution
There are projects that emulate Telegram clients using MTProto protocol:
- php - https://github.com/danog/MadelineProto
- nodejs - https://github.com/alik0211/mtproto-core
- golang - https://github.com/gotd/td
But they warn that this may violate Telegram rules and you may be banned.
Is there any nicer solution?