1. Go to this page and download the library: Download booster-api/driver-whatsapp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
booster-api / driver-whatsapp example snippets
return [
/*
|--------------------------------------------------------------------------
| Whatsapp Token
|--------------------------------------------------------------------------
|
| Your Whatsapp bot token you received after creating
| the chatbot through Whatsapp.
|
*/
'secret' => env('WHATSAPP_SECRET'),
'url' => env('WHATSAPP_URL'),
'api_key' => env('WHATSAPP_API_KEY'),
];
use BotMan\BotMan\BotMan;
use BotMan\BotMan\BotManFactory;
use BotMan\BotMan\Drivers\DriverManager;
$config = [
'secret' => 'WHATSAPP_SECRET',
'url' => 'WHATSAPP_URL',
'api_key' => 'WHATSAPP_API_KEY',
];
DriverManager::loadDriver(BoosterAPI\Whatsapp\Driver\WhatsappWebDriver::class);
$botman = BotManFactory::create($config);
$botman->hears('oi', function (BotMan $bot) {
$bot->reply('Olá! Como posso ajudar?');
});
$botman->listen();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.