Skip to main content

🎬 Initilize SDK

Before you can start building a Bale Bot, you need to configure Bale Bot SDK with your Bot Token that was provided by BotFather. Once you do that, you'll get access to all the available Bot API Methods to make requests to the Bale Bot API.

Here is how you can quickly set up and initialize a single bot operation:

require __DIR__.'/vendor/autoload.php';

use EFive\Bale\Api;

$bale = new Api('YOUR BOT TOKEN');

// Example usage
$response = $bale->getMe();

🦾 Managing Multiple Bots

If you want to manage multiple bots, you can take advantage of the BotsManager like this:

use EFive\Bale\BotsManager;

$config = [
'bots' => [
'mybot' => [
'token' => '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11',
],
]
];

$bale = new BotsManager($config);

// Example usage
$response = $bale->bot('mybot')->getMe();
tip

FYI, $config can get large when handling multiple configurations. To avoid problems, create a dedicated file like config.php and require it in your code to return the array separately. You can use SDK's Laravel config file as a starting point.

info

The configuration guide provides further information on how to register multiple bots.