octopusteam / waapi-laravel
WAAPI whatsapp api integration for Laravel
Fund package maintenance!
octopus-software-team
Installs: 36
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/octopusteam/waapi-laravel
Requires
- php: >=8.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
README
Simple and flexible WhatsApp API integration for Laravel, built by Octopus Team.
This package provides an easy way to send WhatsApp messages using WAAPI.
๐ ๏ธ Compatibility
This package supports the following Laravel and PHP versions:
Laravel Version | PHP Version(s) | Supported |
---|---|---|
12.x | 8.3, 8.4 | โ |
11.x | 8.2, 8.3 | โ |
10.x | 8.1, 8.2, 8.3 | โ |
9.x | 8.0, 8.1, 8.2 | โ |
8.x | 7.4, 8.0, 8.1 | โ ๏ธ (no longer officially supported by Laravel, but package works) |
โน๏ธ We recommend always using the latest Laravel LTS and PHP stable versions for security and performance.
๐ฆ Installation
Install via Composer:
composer require octopusteam/waapi-laravel
โ๏ธ Configuration
- Publish the config file:
php artisan vendor:publish --provider="OctopusTeam\Waapi\WaapiServiceProvider" --tag="config"
- A new config file will be created at:
config/waapi.php
- Update your
.env
with your WAAPI credentials with the following variables in config/waapi.php:
WAAPI_URL=https://waapi.octopusteam.net/api/create-message WAAPI_APP_KEY=your_app_key WAAPI_AUTH_KEY=your_auth_key # Webhook WAAPI_WEBHOOK_URL=/api/webhook/whatsapp WAAPI_WEBHOOK_ENABLED=true WAAPI_WEBHOOK_AUTO_REGISTER=true # Webhook.site WAAPI_WEBHOOK_SITE_TOKEN=your-webhook-site-token
๐ Get Your API Key
To use this package, you need to create an account and generate your WAAPI keys:
- Go to ๐ https://waapi.octopusteam.net
- Sign up for a free trial (7 days available ๐)
- Choose a subscription plan (affordable options for continued API access)
- After login, go to My Apps โ Integration
- Copy your
appkey
andauthkey
from the dashboard
๐ Usage
Using the Facade (Recommended)
Since v1.0.6, the package includes a Waapi
facade for easier static access:
use Waapi; Waapi::sendOtp('201234567890', '123456'); Waapi::sendMessage('201234567890', 'Hello from Octopus Team ๐');
Send WhatsApp Message
use Waapi; $phone = '201234567890'; $message = 'Hello from Octopus Team ๐'; $response = Waapi::sendMessage($phone, $message); if ($response->successful()) { echo "Message sent successfully!"; } else { echo "Failed to send message."; }
๐งช Testing
This package comes with a basic test example.
Run tests with:
php artisan test
๐ Example Test
See tests/Feature/WaapiTest.php
for a sample test:
$response = Waapi::sendMessage('201234567890', 'Hello from Waapi Test ๐'); $this->assertNotNull($response);
๐ค Contributing
Contributions are welcome!
Please open issues and submit pull requests to help improve this package.
๐ License
This package is open-sourced software licensed under the MIT license.