Documentation Getting Started

Introduction

Everything you need to know to start integrating WhatsApp.

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:

  1. Meta Business Account - Create account
  2. WhatsApp App - Create in Meta for Developers
  3. Phone Number - Verified number for WhatsApp Business
  4. Access Token - API credentials

Support and Community

Getting Help

Contributing

Contributions are welcome. Please:

  1. Fork the repository
  2. Create a branch for your feature
  3. Commit your changes
  4. Submit a pull request

License

This project is licensed under the MIT License.

Next Steps

Ready to get started? Continue with:


Have questions? Open an issue on GitHub and we'll be happy to help.

Share this page