["response_text" => "🏍️ 2 Wheeler"], "4_wheeler" => ["response_text" => "🚗 4 Wheeler"], "mediclaim" => ["response_text" => "🩺 Medical Claim"], "go_back" => ["response_text" => "◀️ Go Back"], ]; public function run() { $this->showNewPolicy(); } protected function showNewPolicy() { $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; } log_message('error', ('user_reponse : ' . $answer->getValue())); $path = $this->bot->userStorage()->get('path'); array_push($path, $answer->getValue() ); $this->bot->userStorage()->save([ 'path' => $path ]); switch ($user_reponse) { case "2_wheeler": // $cityName = $response->getText(); $this->bot->startConversation(new twoWheelerOptionsConversations()); break; case "4_wheeler": $this->bot->startConversation(new fourWheelerOptionsConversations()); break; case "mediclaim": $this->bot->startConversation(new medicalClaimOptionConversations()); break; case "go_back": $this->bot->startConversation(new MainMenuConversation()); break; default: $this->say("Invalid selection. Please choose an option."); $this->showHospitalMenu(); break; } }); } }