D
D
Dmitry2020-01-22 12:51:48
Bots
Dmitry, 2020-01-22 12:51:48

How can I implement a response to a user on a message forwarded from a bot to a group chat?

Hello!
On one of the telegram bots, I saw the following functionality: the user writes a message to the bot, this message is redirected to the group chat where the admins are sitting, the admin can answer the user in this chat, and the user receives this answer directly in the chat with the bot.
Do I need to create two webhooks for this (one for the bot, the other for the group chat) or is there some standard interface that allows you to forward these messages back to the chat with the bot?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-01-22
@i__dmitry

The problem was solved quite simply.
When someone writes a response to a message forwarded from a bot to a certain group chat in which the bot is included, a normal call to the bot's webhook is generated, where, among other things, information is transmitted about which user the message was redirected from:

[forward_from] => Array
                        (
                            [id] => XXXXXXXXX
                            [is_bot] => 
                            [first_name] => YYYYYY
                            [last_name] => ZZZZZZ
                            [username] => JJJJJJ
                            [language_code] => ru
                        )

Well, then, specifically in my case, by the user ID, we get the necessary chat_id from the database (the user's conversation with the bot) and send the desired message.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question