hamed hossani
hamed hossani

Reputation: 1002

How to Get Message_id from sent message By BOT Telegram?

I program the bot telegram.

I want Get message_id By Bot ,when I sent a message to Group.

My Code is 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) );

How Do it?

best regard.

Upvotes: 8

Views: 9427

Answers (1)

tashakori
tashakori

Reputation: 2441

Your file_get_contents call returns a result containing status code and messageId.

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

Upvotes: 8

Related Questions