如何从 BOT Telegram 发送的消息中获取 Message_id?

How to Get Message_id from sent message By BOT Telegram?

我编写了 bot 电报。

当我向群组发送消息时,我想通过机器人获取 message_id

我的代码是 PHP.

$token = "MY_BOT's_TOKEN";

$data = [
    'text' => 'my message here',
    'chat_id' => 'the_chat_id_here'
];

file_get_contents("https://api.telegram.org/bot$token/sendMessage?" . http_build_query($data) );

怎么做?

此致。

您的 file_get_contents 调用 returns 一个包含状态代码和 messageId 的结果。

$result = file_get_contents("https://api.telegram.org/bot$token/sendMessage?" . http_build_query($data) );