# Routing

you will begin by defining routes in your app/routes/bot.php file

<?php
use botfire\botfire\Route;

Route::call('alert','botController->alert');
Route::call('message','botController->message');
Route::text('/start','botController->mainMessage');

Route::notFound('botController->mainMessage');

# text method

You must use the text method when performing an operation based on the text sent to the robot

Route::text('/start','botController->mainMessage');
Route::text('menu','botController->sendMenu');
Route::text('create project','botController->newProject');

# call method

If you use the inline button, create routes using the call method

Route::call('show-product','botController->sendProductList');
Route::call('product/{id}','botController->showProductInfo');

TIP

In the inline button you can easily send values

To get May values, we use the get method in the bot class

// send a message whith inline button and value
$k = bot::keyboard()->btn('show product','product/12')->row();
bot::this()->message('product code : 12')->keyboard($k)->send();

When the user clicks on the show product button, we can receive the sent values ​​using bot::get('id')

TIP

Several different values ​​can be sent

Send a message whith inline button and two values

$k = bot::keyboard()->btn('Add Card','add-to-card/12/5')->row();
bot::this()->message('.....')->keyboard($k)->send();

route

Route::call('add-to-card/{product_id}/{user_id}','botController->addToCard');

Get a value when the user clicks on the button

<?php
namespace app\controllers;
use botfire\botfire\bot;

class botController
{
  public function addToCard(){
    $product_id  = bot::get('product_id');
    $user_id     = bot::get('user_id');

    // code ...
  }

}