I
I
Ivan2016-10-04 09:14:18
PHP
Ivan, 2016-10-04 09:14:18

How to get MESSAGE ID of Inlinekeyboard when creating it?

Actually, a question.
1. An INLINE Menu is created: Text and 2 buttons (Next, Back).
0Va1B05zQRE.jpg
2. By clicking on the "Next" or "Back" button, I can catch the MESSAGE_ID

$data = $callback_query['data'];
$message_id = $callback_query['message']['message_id'];

BUT, I need to know the MESSAGE ID already at the first point in order to write it to the database. How to get it?
Here is my function to create it.
$message = returnPhrasesPage ($type, 1);
  
        $inline_back = array("text"=>"Назад","callback_data"=>'back');
  $inline_next = array("text"=>"Далее","callback_data"=>'next');
  $inline_keyboard = array(array($inline_back,$inline_next));
  $keyboard=array("inline_keyboard"=>$inline_keyboard);
        $reply = json_encode($keyboard); 
  $url = $GLOBALS[website]."/sendmessage?chat_id=".$chatId."&text=".urlencode($message)."&reply_markup=".$reply;
  file_get_contents($url);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question