🤖 Ele envia mensagens de texto e arquivos para um contato no seu whatsapp.
To use the bot, use the classes:
BotMessageText and BotMessageFile64.
use Bots\BotMessageText;
use Bots\BotMessageFile64;
use Bots\FileMimeTypes;
// Instance of BotMessageText
$botMessageText = new BotMessageText('YOUR_SESSION_NAME', 'PHONE_NUMBER');
$botMessageText->send(['message' => 'YOUR_MESSAGE']);
// Instance of BotMessageFile64
$botMessageFile64 = new BotMessageFile64('YOUR_SESSION_NAME', 'PHONE_NUMBER', FileMimeTypes::PDF);
$botMessageFile64->send([
'fileName' => 'YOUR_FILE_NAME',
'caption' => 'YOUR_CAPTION',
'path' => 'YOUR_FILE_PATH',
]);
Clone this repository:
git clone https://github.com/igorsilva3/bot-whatsapp
For execute the project, you need to have installed in your machine:
- PHP 8
- Composer
And you need to get your api token in: Documentation
Edit your configurations in the file config/config.php:
define('API_KEY', 'YOUR_API_KEY');
define('SESSION_KEY', 'YOUR_API_KEY');
define('SESSION_NAME', 'YOUR_SESSION_NAME');
define('PHONE_NUMBER', 'YOUR_CONTACT_TO_MESSAGE');
Observation: API_KEY and SESSION_KEY are equals.
Start a session in: Start session
cd bot-whatsapp/
Installing dependencies of the project:
composer install
To run the tests, type:
composer pest
For more informations about the tests, acess: Pest
- PHP 8 - Programming Language
- SDK PHP - APIGratis by APIBRASIL - SDK PHP
- @igorsilva3 - Idea & Initial work