Bale Bot PHP SDK lets you develop Bale Bots in PHP easily! Supports Laravel out of the box.
Bale Bot API is an HTTP-based interface created for developers keen on building bots for Bale.
To learn more about the Bale Bot API, please consult the Introduction to Bots and Bot FAQ on official Bale site.
To get started writing your bots using this SDK, Please refer the documentation.
Documentation for the SDK can be found on the website.
composer require erfanvahabpour/bale-bot-sdk
A simple method for testing your bot's auth token.
Returns basic information about the bot in form of a User object.
$Bale = new Api($token);
$response = $Bale->getMe(); // return User object
Send text messages.
$Bale = new Api($token);
$response = $Bale->sendMessage([
'chat_id' => '2100855301',
'text' => 'This is a text.'
]); // return Message object
Send text messages.
use EFive\Balle\Laravel\Facades\Bale;
$response = Bale::sendMessage([
'chat_id' => '2100855301',
'text' => 'This is a text.'
]); // return Message object
Show the first name of a chat(private chats only)
$Bale = new Api($token);
$response = $Bale->getChat([
'chat_id' => '2100855301'
]); // return User object
echo $response->getFirstName();
For setting multiple bots in a single application
use EFive\Bale\BotsManager;
$config = [
'bots' => [
'firstBot' => [
'token' => $firstBotToken,
],
'secondBot' => [
'token' => $secondBotToken,
],
]
];
$bale = new BotsManager($config);
// getMe Method
$response = $bale->bot('firstBot')->getMe(); // return User object
This project and its author are neither associated nor affiliated with Bale in any way. Please see the License for more details.
This project is released under the BSD 4-Clause License.