Answer the question
In order to leave comments, you need to log in
How to set up a Telegram bot to forward messages?
I need to do something like this. A person writes a message to the bot, the bot sends this message to my site. At the same time, I should get the user ID and his message, which I store in my database. I answer the user from the site by sending a message to the bot, and he already forwards this message to the user. How to organize this?
PS I have already created a bot through ManyBot
Answer the question
In order to leave comments, you need to log in
You, in fact, described the logic yourself and you just have to choose the tools and implement it. A ready-made solution will not be given to you here. And I'm not sure that the ready-made bot from ManyBot will do.
You write, let's say in PHP, a bot - it can receive data from Telegram (webhook) and send data back. When a user accesses your bot, you always get data about the user ( the User object , id will be exact, but the first name, last name and username can be empty). You will have a chat id and lots of other data. Here, the Message object will be returned.
Write all the necessary data to the database and then do whatever you want.
First things first - get familiar with the Telegram Bot API .
upd. See comments for more details.
The difficulties you will face is if several people write to you. How to respond to several at once through one form. Or how several people will write to several operators.
I can show this as an example: https://github.com/Surzhikov/TelegramSiteHelper
What do I think about your idea?
You need to make a chat for each user separately.
Suppose a client writes to a bot -> the bot creates a topic\dialog with its client ID -> correspondence takes place in a specially designated topic -> When sending a message, the bot checks which dialogue you are in and substitutes the ID for the recipient.
Something like this. On your side, I would make a separate page \ domain or add it as a module to your engine (I don’t know what you have there).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question