Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erfanvahabpour/bale-bot-sdk
🤖 Bale Bot API PHP SDK. Lets you build Bale Bots easily! Supports Laravel out of the box.
https://github.com/erfanvahabpour/bale-bot-sdk
bale bale-bot-api bale-bot-sdk bale-not bot laravel laravel-bale php php-sdk
Last synced: 10 days ago
JSON representation
🤖 Bale Bot API PHP SDK. Lets you build Bale Bots easily! Supports Laravel out of the box.
- Host: GitHub
- URL: https://github.com/erfanvahabpour/bale-bot-sdk
- Owner: ErfanVahabpour
- License: bsd-4-clause
- Created: 2024-11-06T05:50:18.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T06:07:40.000Z (about 1 month ago)
- Last Synced: 2024-12-30T06:13:58.331Z (10 days ago)
- Topics: bale, bale-bot-api, bale-bot-sdk, bale-not, bot, laravel, laravel-bale, php, php-sdk
- Language: PHP
- Homepage: https://bale-bot-sdk.efive.net
- Size: 90.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
Bale Bot API - PHP SDK
==========================> Bale Bot PHP SDK lets you develop Bale Bots in PHP easily! Supports Laravel out of the box.
>
> [Bale Bot API](https://dev.bale.ai/) 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](https://dev.bale.ai/) and [Bot FAQ](https://docs.bale.ai/) on official Bale site.
>
> To get started writing your bots using this SDK, Please refer the [documentation](https://bale-bot-sdk.efive.net/).## Documentation
Documentation for the SDK can be found on the [website](https://bale-bot-sdk.efive.net/).
## Installation
```shell
composer require erfanvahabpour/bale-bot-sdk
```## Examples
### getMe Method
A simple method for testing your bot's auth token.
Returns basic information about the bot in form of a User object.```php
$Bale = new Api($token);$response = $Bale->getMe(); // return User object
```### sendMessage Method
Send text messages.
```php
$Bale = new Api($token);$response = $Bale->sendMessage([
'chat_id' => '2100855301',
'text' => 'This is a text.'
]); // return Message object
```### sendMessage Method in Laravel
Send text messages.
```php
use EFive\Balle\Laravel\Facades\Bale;$response = Bale::sendMessage([
'chat_id' => '2100855301',
'text' => 'This is a text.'
]); // return Message object
```### Get first name of a chat
Show the first name of a chat(private chats only)
```php
$Bale = new Api($token);$response = $Bale->getChat([
'chat_id' => '2100855301'
]); // return User objectecho $response->getFirstName();
```### Setting multiple bots
For setting multiple bots in a single application
```php
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
```## Disclaimer
This project and its author are neither associated nor affiliated with [Bale](https://bale.ai/) in any way.
Please see the [License](https://github.com/ErfanVahabpour/Bale-Bot-SDK/blob/main/LICENSE.md) for more details.## License
This project is released under the [BSD 4-Clause](https://github.com/ErfanVahabpour/Bale-Bot-SDK/blob/main/LICENSE.md) License.