["response_text" => "🔹 Comprehensive"], "3p" => ["response_text" => "🔹 Third-Party Only"], "go_back" => ["response_text" => "◀️ Go Back"], ]; public function run() { $this->show4WOptions(); } protected function show4WOptions() { $buttons = []; foreach ($this->buttonsData as $key => $data) { $buttons[] = Button::create($data['response_text'])->value($key); } // $this->bot->userStorage()->save([ // 'path' => [] // ]); $question = Question::create("Please choose an option:")->addButtons($buttons); $temp = $this->buttonsData; $this->bot->ask($question, function ($answer) use( $temp ){ $user_reponse = $answer->getValue(); if (isset($temp[$user_reponse])) { $message = "You've chosen " . $temp[$user_reponse]['response_text']; // $this->bot->say($message,,WebDriver::class); $this->bot->reply($message); } if (!$answer->isInteractiveMessageReply()) { $user_reponse = null; } $path = $this->bot->userStorage()->get('path'); array_push($path, $answer->getValue() ); $this->bot->userStorage()->save([ 'path' => $path ]); $path = $this->bot->userStorage()->get('path'); // $this->say(json_encode($path)); switch ($user_reponse) { case "3p": // $cityName = $response->getText(); $this->bot->startConversation(new commonPolicyOptionConversations()); break; case "comp": $this->bot->startConversation(new commonPolicyOptionConversations()); break; case "go_back": $this->bot->startConversation(new MainMenuConversation()); break; default: $this->say("Invalid selection. Please choose an option."); $this->showHospitalMenu(); break; } }); } }