How to get message after command in Telegram bot sdk Laravel?

  bots, laravel, sdk, telegram

I have some issue with Telegram SDK! As you see in photo below, I ask to enter Some title after user enters /addnotification commmand, here user should enter some title of notification, but I can’t get it, because update gives me last message , which was command /addnotification! Please, help if someone knows the answer!

public function handle()
{

    $telegram = new Api(Telegram::getAccessToken());
    $update = Telegram::getWebhookUpdates();
    $chat_id = $update->getMessage()->getChat()->getId();
    $text= $update->getMessage()->getText();

    
    $response = $telegram->sendMessage([
        'chat_id' => $chat_id,
        'text' => 'Пожалуйста введите событие или дело который вы хотели бы добавить.'
    ]);

    // $messageId = $response->getMessageId();


           $this->replyWithMessage(['text' => 'Поздравляем! Вы успешно добавили событие!!!']);
    $this->replyWithMessage(['text' => 'Название - ' . $text]);
   $this->replyWithMessage(['text' => 'Chat Id - ' . $chat_id]);



  //  $this->replyWithMessage(['text' => $messageId]);
    


}

}

enter image description here

Here after entering command user should enter some title and I want to get this title(message) , but update gives message which was command!

Source: Laravel

Leave a Reply