PHPackages                             hatem-elsheref/whatsapp-business - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. hatem-elsheref/whatsapp-business

ActiveLibrary

hatem-elsheref/whatsapp-business
================================

WhatsApp Business SaaS Platform for Laravel - Multi-tenant, OAuth, WhatsApp Cloud API integration

v1.0.1(1mo ago)00MITPHPPHP ^8.1

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/hatem-elsheref/whatsapp-business)[ Packagist](https://packagist.org/packages/hatem-elsheref/whatsapp-business)[ Docs](https://github.com/hatem-elsheref/whatsapp-business)[ RSS](/packages/hatem-elsheref-whatsapp-business/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

WhatsApp Business Package
=========================

[](#whatsapp-business-package)

A comprehensive WhatsApp Business SaaS package for Laravel with multi-tenant support, OAuth authentication, conversation management, and more.

Installation
------------

[](#installation)

1. Add the package to your Laravel project:

```
composer require hatem-elsheref/whatsapp-business
```

2. Run migrations (migrations run automatically):

```
php artisan migrate
```

3. Seed default admin user (optional):

```
php artisan db:seed --class=WhatsAppBusinessSeeder
```

Configuration
-------------

[](#configuration)

1. Publish the configuration:

```
php artisan vendor:publish --tag=whatsapp-config
```

2. Add these environment variables to your `.env` file:

```
# Meta/WhatsApp Cloud API
META_APP_ID=your_app_id
META_APP_SECRET=your_app_secret
META_API_VERSION=v18.0
META_OAUTH_REDIRECT_URI=https://yourapp.com/api/wa/oauth/callback

# Webhook
WA_WEBHOOK_VERIFY_TOKEN=your_random_verify_token

# Pusher (for real-time notifications)
PUSHER_APP_ID=your_app_id
PUSHER_APP_KEY=your_app_key
PUSHER_APP_SECRET=your_app_secret
PUSHER_CLUSTER=mt1
```

Features
--------

[](#features)

- **Multi-Tenant Architecture**: Each customer has their own isolated data
- **Facebook OAuth**: Customers connect via Facebook Login
- **Manual Setup**: Enter App ID, App Secret, and Access Token directly
- **Multi-Number Support**: Connect multiple WhatsApp numbers
- **Conversation Management**: Full inbox system with assignment
- **Template Messages**: Send WhatsApp-approved templates
- **Conversation Flows**: Build automated flows with triggers
- **Ticketing System**: Convert conversations to support tickets
- **Analytics Dashboard**: Track messages, conversations, agent performance
- **Real-time Updates**: Via Pusher/Laravel Echo
- **Agent Management**: Multi-agent support with roles

API Endpoints
-------------

[](#api-endpoints)

### Public Endpoints

[](#public-endpoints)

- `GET /api/wa/webhook` - Webhook verification
- `POST /api/wa/webhook` - Handle incoming messages
- `GET /api/wa/oauth/redirect` - Redirect to Facebook OAuth
- `GET /api/wa/oauth/callback` - OAuth callback
- `POST /api/wa/oauth/manual-setup` - Manual setup with access token

### Protected Endpoints (require Sanctum token)

[](#protected-endpoints-require-sanctum-token)

#### Auth

[](#auth)

- `POST /api/wa/auth/login` - Login
- `POST /api/wa/auth/logout` - Logout
- `GET /api/wa/auth/me` - Get current user

#### Conversations

[](#conversations)

- `GET /api/wa/conversations` - List conversations
- `GET /api/wa/conversations/{id}` - Get conversation
- `GET /api/wa/conversations/{id}/messages` - Get messages
- `POST /api/wa/conversations/{id}/messages` - Send message
- `POST /api/wa/conversations/{id}/assign` - Assign agent
- `POST /api/wa/conversations/{id}/archive` - Archive
- `POST /api/wa/conversations/{id}/block` - Block

#### Templates

[](#templates)

- `GET /api/wa/templates` - List templates
- `GET /api/wa/templates/sync` - Sync from Meta
- `GET /api/wa/templates/{id}` - Get template
- `POST /api/wa/templates/{id}/send` - Send template

#### Phone Numbers

[](#phone-numbers)

- `GET /api/wa/phone-numbers` - List numbers
- `GET /api/wa/phone-numbers/sync` - Sync from Meta
- `GET /api/wa/phone-numbers/{id}` - Get number
- `POST /api/wa/phone-numbers/{id}/webhook/test` - Test webhook
- `DELETE /api/wa/phone-numbers/{id}` - Remove number

#### Quick Replies

[](#quick-replies)

- `GET /api/wa/quick-replies` - List quick replies
- `POST /api/wa/quick-replies` - Create
- `PUT /api/wa/quick-replies/{id}` - Update
- `DELETE /api/wa/quick-replies/{id}` - Delete

#### Flows

[](#flows)

- `GET /api/wa/flows` - List flows
- `POST /api/wa/flows` - Create flow
- `GET /api/wa/flows/{id}` - Get flow
- `PUT /api/wa/flows/{id}` - Update flow
- `DELETE /api/wa/flows/{id}` - Delete flow
- `POST /api/wa/flows/{id}/toggle` - Enable/disable
- `POST /api/wa/flows/{id}/steps` - Update steps

#### Tickets

[](#tickets)

- `GET /api/wa/tickets` - List tickets
- `POST /api/wa/tickets` - Create ticket
- `GET /api/wa/tickets/{id}` - Get ticket
- `PUT /api/wa/tickets/{id}` - Update ticket
- `POST /api/wa/tickets/{id}/assign` - Assign agent
- `POST /api/wa/tickets/{id}/resolve` - Resolve ticket
- `POST /api/wa/tickets/{id}/close` - Close ticket

#### Agents

[](#agents)

- `GET /api/wa/agents` - List agents
- `POST /api/wa/agents` - Create agent
- `PUT /api/wa/agents/{id}` - Update agent
- `DELETE /api/wa/agents/{id}` - Delete agent

#### Notifications

[](#notifications)

- `GET /api/wa/notifications` - List notifications
- `PUT /api/wa/notifications/{id}/read` - Mark as read
- `PUT /api/wa/notifications/read-all` - Mark all as read

#### Analytics

[](#analytics)

- `GET /api/wa/analytics/overview` - Dashboard overview
- `GET /api/wa/analytics/messages` - Message stats
- `GET /api/wa/analytics/conversations` - Conversation stats
- `GET /api/wa/analytics/agents` - Agent performance

Usage
-----

[](#usage)

### Sending a Message

[](#sending-a-message)

```
use WhatsApp\Business\Services\ConversationService;

$service = app(ConversationService::class);

$message = $service->sendMessage(
    $conversation,
    'Hello, how can I help you?',
    $agentId
);
```

### Starting a Flow

[](#starting-a-flow)

```
use WhatsApp\Business\Services\FlowEngine;

$flowEngine = app(FlowEngine::class);
$flowEngine->startFlow($flow, $conversation);
```

### Manual Setup (Without OAuth)

[](#manual-setup-without-oauth)

```
use WhatsApp\Business\Services\OAuthService;

$service = app(OAuthService::class);

$result = $service->manualSetup($customerId, [
    'app_id' => 'your_app_id',
    'app_secret' => 'your_app_secret',
    'access_token' => 'your_permanent_access_token',
]);
```

Broadcasting (Real-time)
------------------------

[](#broadcasting-real-time)

The package includes Laravel Echo compatible broadcasting channels:

### Channel Structure

[](#channel-structure)

- `whatsapp.customer.{id}` - Customer-specific events
- `whatsapp.conversation.{id}` - Conversation updates
- `whatsapp.agent.{id}` - Agent notifications

### Frontend Integration

[](#frontend-integration)

```
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';

window.Echo = new Echo({
  broadcaster: 'pusher',
  key: import.meta.env.VITE_PUSHER_APP_KEY,
  cluster: import.meta.env.VITE_PUSHER_CLUSTER,
});

Echo.private(`whatsapp.agent.${agentId}`)
  .listen('message.new', (e) => {
    console.log('New message:', e.message);
  })
  .listen('notification.new', (e) => {
    console.log('New notification:', e.notification);
  });
```

Database Tables
---------------

[](#database-tables)

The package creates the following tables:

- `wa_customers` - Customer accounts
- `wa_agents` - Agent accounts
- `wa_phone_numbers` - WhatsApp phone numbers
- `wa_templates` - Message templates
- `wa_quick_replies` - Quick reply messages
- `wa_flows` - Automated conversation flows
- `wa_flow_steps` - Flow steps
- `wa_flow_user_data` - User flow progress
- `wa_conversations` - Customer conversations
- `wa_messages` - Messages
- `wa_tickets` - Support tickets
- `wa_ticket_messages` - Ticket messages
- `wa_notifications` - Notifications
- `wa_analytics_events` - Analytics events

Default Credentials
-------------------

[](#default-credentials)

After seeding:

- Admin: `admin@whatsapp.local` / `admin123`
- Agent: `agent@whatsapp.local` / `agent123`

Testing
-------

[](#testing)

```
composer test
```

Or with Orchestra Testbench:

```
vendor/bin/phpunit
```

Auto-Discovery
--------------

[](#auto-discovery)

Laravel 5.5+ auto-discovers the service providers. No manual registration needed.

License
-------

[](#license)

MIT License

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/001e07d0152dc489263f2dce20d77eb0cbe69294e4fe268eaed7ca1f52296e35?d=identicon)[shefoo](/maintainers/shefoo)

---

Top Contributors

[![hatem-elsheref](https://avatars.githubusercontent.com/u/73200031?v=4)](https://github.com/hatem-elsheref "hatem-elsheref (10 commits)")

---

Tags

laravelfacebookwhatsappmetasaasmulti-tenantwhatsapp-business

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hatem-elsheref-whatsapp-business/health.svg)

```
[![Health](https://phpackages.com/badges/hatem-elsheref-whatsapp-business/health.svg)](https://phpackages.com/packages/hatem-elsheref-whatsapp-business)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[krayin/laravel-crm

Krayin CRM

22.0k32.8k1](/packages/krayin-laravel-crm)[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[hyn/multi-tenant

Run multiple websites using the same laravel installation while keeping tenant specific data separated for fully independant multi-domain setups.

2.6k1.1M9](/packages/hyn-multi-tenant)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
