V
V
Vladimir2020-09-13 07:34:41
Database
Vladimir, 2020-09-13 07:34:41

How to make a proper message handler from a telegram bot?

Hello. Launched the first tg bot. According to the specified conditions, it sends notifications using the text method with various data. Everything is simple and clear here. I'm trying to figure out how to send messages from the cart to the server. Webhook/longpolling is understandable. Now the main and main question: let's say the webhook received a message and .. where to add it until the script that processes it wakes up, and if there are more than one such requests, hook the database and write to it?
(Assume a database with a limited number of elements: Create a simple database with the fields id (auto-increment), userid, action (from the received message), processed (boolean, false (the script will be inverted upon execution))
Now the questions are:
Where to store the last processed?
What ports other than the standard 443 should be open?
Should only the webhook be viewed externally or the entire server? (Question is a little silly)
Any options to make it easier?
Is it possible to limit the use of the bot within the same group? (Incoming messages from the server for sure, but what happens if someone else tries to send a message to the bot?)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question