M
M
Matthew Stafford2019-12-08 13:22:20
PHP
Matthew Stafford, 2019-12-08 13:22:20

Telegram API, how to get the ID of a sent message?

I use Webhook, I need to get the ID of the message sent by the bot so that I can write it to the database in the future
. But I can’t quite figure out how to get the answer that should be after sending the message and how it looks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Neverov, 2019-12-08
@matthewstafford

See the documentation for the sendMessage method .
Read the line there:
Use this method to send text messages. On success, the sent Message is returned.
Translate it in the translator, understand what it means and go to the Message object, where there is a field:

message_id Integer Unique message identifier inside this chat

K
k1ichi, 2022-02-23
@k1ichi

i = bot.send_message(message.chat.id, 'text')
print(i)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question