This question has already been answered:

Good day. Faced the following problem:

I have a web application Flask and telegram-bot. The bottom line is this:

  1. The user makes an order through the form. presses to send.
  2. Order is saved in redis
  3. The telegram bot must send me ( I emphasize, only I will interact with the bot) order information.

Question : What is the best way to configure the interaction so that the telegram bot notifies me about the order right away? I fight all day and can not find a simple solution

Thank!

Reported as a duplicate member of Spirit Community Oct 27 '17 at 8:50 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • What is your difficulty? You do not know how to send a message? Or how to build an algorithmic sequence of actions? Not quite clear from the question - ss_beer
  • I do not know how to configure the interaction between the bot and the web application. I do not know how to call the sending method of a bot that is running in a different process in the right chat to the desired user. in fact, I need to arrange the interaction between the bot and the web application to solve my question - Prvz

1 answer 1

Alternatively, a telegram can receive data from redis once a minute in a running process. Most likely the bot in this case works through long pooling. It is much more convenient to work through web hooks. I have my own bot, made it for notifications. Everything works through django. I create a signal with the data, the listener receives and sends a message.

  • Listen, but can you describe in more detail and more specifically? - Prvz
  • Created a site on django. A pair of tables to store messages. Project records (name, domain or ip, description), you can add records (logs) to each project. The log consists of a name, a field for traceback (text), a type (info, warning, error, debug), a date and a binding to the project. The client adds an entry via rest api. Receives a token before adding. In django itself, when adding a new record, I create a signal. The function that listens to this signal causes my class and sending method. The bot works through the web hook, for this it was necessary to put an ssl certificate on the domain. - wedoca
  • What specifically interests? So in several sentences it is difficult to describe even a part of the functional. - wedoca