Introduction
WhatsApp API Manager is a comprehensive Laravel package that allows you to easily integrate the WhatsApp Business Cloud API into your application.
What is WhatsApp API Manager?
It's an all-in-one solution that simplifies WhatsApp Business API integration in Laravel applications, providing:
- π¨ Complete message management - Send and receive all types of messages
- π Template system - Work with WhatsApp-approved templates
- π‘ Real-time events - Integration with Laravel Echo and WebSockets
- ποΈ Database included - Ready-to-use Eloquent models and migrations
- π¨ Fully customizable - Extend and customize to your needs
Key Features
π¬ Supported Message Types
- Text - Simple text messages with formatting
- Media - Images, videos, audio, documents, and stickers
- Location - Share geographic locations
- Contacts - Send contact information
- Interactive - Buttons, lists, and quick reply messages
- Templates - Pre-approved messages with variables
π§ Functionality
Sending Messages
// Simple text message
use ScriptDevelop\WhatsappManager\Facades\Whatsapp;
use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount;
$account = WhatsappBusinessAccount::first(); // Get WhatsApp Business account
$phone = $account->phoneNumbers->first(); // Get WhatsApp number
$message = Whatsapp::message()->sendTextMessage(
$phone->phone_number_id, // Phone number ID
'57', // Country code
'3237121901', // Phone number
'Hello, this is a test message.' // Message content
);
Receiving Messages
use ScriptDevelop\WhatsappManager\Events\TextMessageReceived;
Event::listen(TextMessageReceived::class, function ($event) {
logger()->info("New message: {$event->message->body}");
});
Template Management
Create template
// Create template with variable
use ScriptDevelop\WhatsappManager\Facades\Whatsapp;
use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount;
// Get business account
$account = WhatsappBusinessAccount::first();
// Create a transactional template
$template = Whatsapp::template()
->createUtilityTemplate($account)
->setName('order_confirmation')
->setLanguage('en_US')
->addHeader('TEXT', 'Order Confirmation')
->addBody('Your order {{1}} has been confirmed.', ['12345'])
->addFooter('Thank you for shopping with us!')
->addButton('QUICK_REPLY', 'Track Order')
->addButton('QUICK_REPLY', 'Contact Support')
->save();
Send template
// Send template with variable
use ScriptDevelop\WhatsappManager\Facades\Whatsapp;
use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount;
$account = WhatsappBusinessAccount::first(); // Get WhatsApp Business account
$phone = $account->phoneNumbers->first(); // Get WhatsApp number
// Send template 1: template without buttons or without needing to provide button parameters
$message = Whatsapp::template()
->sendTemplateMessage($phone)
->to('57', '3137555908')
->usingTemplate('order_confirmation')
->addBody(['12345'])
->send();
Architecture
The package follows Laravel best practices and uses:
- Service Pattern - For business logic
- Repository Pattern - For data access
- Event-Driven - For webhook handling
- Facades - For simple and elegant API
- Eloquent ORM - For data models
Use Cases
E-commerce
- Order notifications
- Payment confirmations
- Shipping updates
- Customer support
CRM
- Lead tracking
- Appointment reminders
- Marketing campaigns
- Personalized attention
Services
- Appointment reminders
- Booking confirmations
- Status notifications
- Alerts and notices
Education
- Student notifications
- Class reminders
- Content distribution
- Parent communication
System Requirements
- PHP: 8.2 or higher
- Laravel: 12 or higher
- PHP Extensions:
- OpenSSL
- PDO
- Mbstring
- cURL
WhatsApp Business API
This package uses Meta's official WhatsApp Business Cloud API. You'll need:
- Meta Business Account - Create account
- WhatsApp App - Create in Meta for Developers
- Phone Number - Verified number for WhatsApp Business
- Access Token - API credentials
Support and Community
Getting Help
- π Complete documentation
- π Report issues
- π¬ Discussions
Contributing
Contributions are welcome. Please:
- Fork the repository
- Create a branch for your feature
- Commit your changes
- Submit a pull request
License
This project is licensed under the MIT License.
Next Steps
Ready to get started? Continue with:
- Installation - Install and configure the package
- API Configuration - Configure your credentials
- Quick Start - Your first message in 5 minutes
Have questions? Open an issue on GitHub and we'll be happy to help.