PHPackages                             vishwaraj/whatsapp-cloud-api - 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. [API Development](/categories/api)
4. /
5. vishwaraj/whatsapp-cloud-api

ActiveLibrary[API Development](/categories/api)

vishwaraj/whatsapp-cloud-api
============================

Laravel package for the WhatsApp Cloud API — fluent builders, full template support, media management, and interactive messages.

v1.0.0(1w ago)00MITPHPPHP ^8.2CI passing

Since May 29Pushed 1w agoCompare

[ Source](https://github.com/Vishwaraj123/vishwaraj-whatsapp-cloud-api)[ Packagist](https://packagist.org/packages/vishwaraj/whatsapp-cloud-api)[ Docs](https://github.com/Vishwaraj123/vishwaraj-whatsapp-cloud-api)[ RSS](/packages/vishwaraj-whatsapp-cloud-api/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (3)Used By (0)

WhatsApp Cloud API — Laravel Package
====================================

[](#whatsapp-cloud-api--laravel-package)

[![Tests](https://github.com/Vishwaraj123/vishwaraj-whatsapp-cloud-api/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/Vishwaraj123/vishwaraj-whatsapp-cloud-api/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/24aff0db14d8c8e712a153417e08da63d8ee6efb2391b7c661af086b8ae8d68c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76697368776172616a2f77686174736170702d636c6f75642d6170692e7376673f6c6162656c3d7061636b6167697374)](https://packagist.org/packages/vishwaraj/whatsapp-cloud-api)[![Total Downloads](https://camo.githubusercontent.com/e098a66df2076bf1e6dc9e7787d76931c25b262067c39db0ace75848e28f272a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76697368776172616a2f77686174736170702d636c6f75642d6170692e737667)](https://packagist.org/packages/vishwaraj/whatsapp-cloud-api)[![PHP](https://camo.githubusercontent.com/d939ed2787af03e76ef8d8b6cd0ffa17e5da11b7772994ae6ac95f50cb146d5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c75653f6c6f676f3d706870)](https://www.php.net)[![Laravel](https://camo.githubusercontent.com/991cdcf4533d048685419728d1b6afff5acefe22b6247acab436dfad40f2e5f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253243253230313125324325323031322d7265643f6c6f676f3d6c61726176656c)](https://laravel.com)[![License](https://camo.githubusercontent.com/045c07b8686ce3c67395b9656eb0cea2973b626eaf81cbb443758be2dd91d50b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f76697368776172616a2f77686174736170702d636c6f75642d617069)](LICENSE)[![Stars](https://camo.githubusercontent.com/fa2c9fe0f1bd8d44ac5f7a0355861bc0a22dd50c6cc3bf9f1d8459652a9fbd1e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f56697368776172616a3132332f76697368776172616a2d77686174736170702d636c6f75642d6170693f7374796c653d736f6369616c)](https://github.com/Vishwaraj123/vishwaraj-whatsapp-cloud-api/stargazers)

A Laravel-native WhatsApp Cloud API package with fluent message builders, full template management, media handling, and every interactive message type supported by the Meta Cloud API.

---

Requirements
------------

[](#requirements)

DependencyVersionPHP^8.2Laravel10, 11, 12---

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

[](#installation)

```
composer require vishwaraj/whatsapp-cloud-api
```

Publish config:

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

---

Environment
-----------

[](#environment)

```
WHATSAPP_ACCESS_TOKEN=your_access_token
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
WHATSAPP_WABA_ID=your_waba_id
WHATSAPP_BUSINESS_ID=your_business_id
WHATSAPP_API_VERSION=v22.0
```

---

Usage
-----

[](#usage)

### Text Message

[](#text-message)

```
use Vishwaraj\WhatsAppCloud\Facades\WhatsAppCloud;

$response = WhatsAppCloud::text()
    ->to('919999999999')
    ->body('Hello from WhatsApp Cloud API!')
    ->send();

echo $response->messageId(); // wamid.xxx
```

### Reply to a Message

[](#reply-to-a-message)

```
WhatsAppCloud::text()
    ->to('919999999999')
    ->body('This is a reply')
    ->replyTo('wamid.previous_message_id')
    ->send();
```

### Text with URL Preview

[](#text-with-url-preview)

```
WhatsAppCloud::text()
    ->to('919999999999')
    ->body('Visit https://example.com')
    ->previewUrl()
    ->send();
```

---

### Image

[](#image)

```
// From URL
WhatsAppCloud::image()
    ->to('919999999999')
    ->fromUrl('https://example.com/photo.jpg')
    ->caption('A beautiful photo')
    ->send();

// From uploaded media ID
WhatsAppCloud::image()
    ->to('919999999999')
    ->fromMediaId('media-object-id')
    ->send();

// Auto-upload from local path
WhatsAppCloud::image()
    ->to('919999999999')
    ->fromPath('/path/to/image.jpg')
    ->caption('Uploaded photo')
    ->send();
```

### Video

[](#video)

```
WhatsAppCloud::video()
    ->to('919999999999')
    ->fromUrl('https://example.com/video.mp4')
    ->caption('Watch this')
    ->send();
```

### Audio

[](#audio)

```
WhatsAppCloud::audio()
    ->to('919999999999')
    ->fromUrl('https://example.com/audio.ogg')
    ->send();
```

### Document

[](#document)

```
WhatsAppCloud::document()
    ->to('919999999999')
    ->fromUrl('https://example.com/invoice.pdf')
    ->filename('invoice.pdf')
    ->caption('Your invoice')
    ->send();
```

### Sticker

[](#sticker)

```
WhatsAppCloud::sticker()
    ->to('919999999999')
    ->fromUrl('https://example.com/sticker.webp')
    ->send();
```

### Location

[](#location)

```
WhatsAppCloud::location()
    ->to('919999999999')
    ->latitude(18.5204)
    ->longitude(73.8567)
    ->name('Pune Office')
    ->address('123 MG Road, Pune')
    ->send();
```

### Contact

[](#contact)

```
use Vishwaraj\WhatsAppCloud\DTO\Messages\ContactData;

WhatsAppCloud::contact()
    ->to('919999999999')
    ->addContact(new ContactData(
        formattedName: 'John Smith',
        firstName:     'John',
        lastName:      'Smith',
        phones:        [['phone' => '+1 650 555 1234', 'type' => 'WORK']],
        emails:        [['email' => 'john@example.com', 'type' => 'WORK']],
    ))
    ->send();
```

### Reaction

[](#reaction)

```
// Add reaction
WhatsAppCloud::reaction()
    ->to('919999999999')
    ->messageId('wamid.xxx')
    ->emoji('👍')
    ->send();

// Remove reaction
WhatsAppCloud::reaction()
    ->to('919999999999')
    ->messageId('wamid.xxx')
    ->remove()
    ->send();
```

---

Interactive Messages
--------------------

[](#interactive-messages)

### Reply Buttons

[](#reply-buttons)

```
WhatsAppCloud::interactive()
    ->replyButtons()
    ->to('919999999999')
    ->body('Choose an option:')
    ->footer('Powered by WhatsApp')
    ->addButton('btn_yes', 'Yes')
    ->addButton('btn_no', 'No')
    ->addButton('btn_later', 'Later')
    ->send();
```

### List Message

[](#list-message)

```
WhatsAppCloud::interactive()
    ->list()
    ->to('919999999999')
    ->headerText('Select a product')
    ->body('Browse our catalog')
    ->footer('Tap to select')
    ->buttonLabel('View Options')
    ->section('Fruits', [
        ['id' => 'apple',  'title' => 'Apple',  'description' => 'Fresh red apple'],
        ['id' => 'mango',  'title' => 'Mango',  'description' => 'Alphonso mango'],
    ])
    ->section('Vegetables', [
        ['id' => 'carrot', 'title' => 'Carrot', 'description' => 'Fresh carrots'],
    ])
    ->send();
```

### Single Product

[](#single-product)

```
WhatsAppCloud::interactive()
    ->product()
    ->to('919999999999')
    ->body('Check out this product')
    ->catalogId('your-catalog-id')
    ->productId('product-sku-123')
    ->send();
```

### Multi-Product

[](#multi-product)

```
WhatsAppCloud::interactive()
    ->productList()
    ->to('919999999999')
    ->headerText('Our Top Picks')
    ->body('Browse and order directly')
    ->catalogId('your-catalog-id')
    ->section('Electronics', ['sku-laptop', 'sku-phone', 'sku-tablet'])
    ->section('Accessories', ['sku-case', 'sku-charger'])
    ->send();
```

### Flow Message

[](#flow-message)

```
// Published flow
WhatsAppCloud::interactive()
    ->flow()
    ->to('919999999999')
    ->body('Complete your registration')
    ->footer('Tap to open')
    ->flowId('550000000000001')
    ->flowToken('unique-token-per-user')
    ->cta('Register Now')
    ->screen('WELCOME_SCREEN')
    ->screenData(['prefill_name' => 'John'])
    ->send();

// Draft flow (for testing)
WhatsAppCloud::interactive()
    ->flow()
    ->to('919999999999')
    ->flowId('550000000000001')
    ->flowToken('test-token')
    ->draft()
    ->send();
```

### CTA URL Button

[](#cta-url-button)

```
WhatsAppCloud::interactive()
    ->ctaUrl()
    ->to('919999999999')
    ->body('Visit our website')
    ->displayText('Open Website')
    ->url('https://example.com')
    ->send();
```

### Catalog Message

[](#catalog-message)

```
WhatsAppCloud::interactive()
    ->catalog()
    ->to('919999999999')
    ->body('Browse our catalog')
    ->footer('Best deals on WhatsApp!')
    ->thumbnail('product-sku-123')
    ->send();
```

### Order Details (Payments)

[](#order-details-payments)

```
WhatsAppCloud::interactive()
    ->orderDetails()
    ->to('919999999999')
    ->body('Your order summary')
    ->referenceId('ORD-2024-001')
    ->paymentType('upi')
    ->paymentConfig('my-payment-config')
    ->currency('INR')
    ->addItem('SKU-BREAD', 'Sourdough Bread', 1000, 2, 900)
    ->total(1800)
    ->send();
```

### Order Status

[](#order-status)

```
WhatsAppCloud::interactive()
    ->orderStatus()
    ->to('919999999999')
    ->body('Order update')
    ->referenceId('ORD-2024-001')
    ->status('processing')
    ->description('Your order is being prepared')
    ->send();
```

---

Templates
---------

[](#templates)

### Send Template

[](#send-template)

```
// Basic template
WhatsAppCloud::template()
    ->to('919999999999')
    ->name('hello_world')
    ->language('en_US')
    ->send();

// Template with body variables
WhatsAppCloud::template()
    ->to('919999999999')
    ->name('summer_sale')
    ->language('en_US')
    ->body(['John', 'SAVE25', '25%'])
    ->send();

// Template with image header
WhatsAppCloud::template()
    ->to('919999999999')
    ->name('promo_banner')
    ->language('en_US')
    ->headerImageUrl('https://example.com/banner.jpg')
    ->body(['Mark', 'Tuscan Getaway', '800'])
    ->quickReplyButton(0, 'STOP_PROMOTIONS')
    ->send();

// Template with URL button
WhatsAppCloud::template()
    ->to('919999999999')
    ->name('order_confirmation')
    ->language('en_US')
    ->body(['Mark', '#123456'])
    ->urlButton(0, 'order/123456')
    ->send();

// Catalog template
WhatsAppCloud::template()
    ->to('919999999999')
    ->name('intro_catalog_offer')
    ->language('en_US')
    ->body(['100', '400', '3'])
    ->catalogButton(0, 'product-sku-123')
    ->send();

// Flow template
WhatsAppCloud::template()
    ->to('919999999999')
    ->name('appointment_booking')
    ->language('en_US')
    ->body(['John'])
    ->flowButton(0, 'unique-flow-token', ['prefill_name' => 'John'])
    ->send();
```

### Manage Templates

[](#manage-templates)

```
use Vishwaraj\WhatsAppCloud\DTO\Templates\TemplateDefinitionData;
use Vishwaraj\WhatsAppCloud\Enums\TemplateCategory;

// Create template
$template = new TemplateDefinitionData(
    name:     'summer_promo_2024',
    language: 'en_US',
    category: TemplateCategory::Marketing,
    components: [
        [
            'type'   => 'HEADER',
            'format' => 'TEXT',
            'text'   => 'Summer Sale 🌞',
        ],
        [
            'type' => 'BODY',
            'text' => 'Hi {{1}}, use code {{2}} for {{3}} off!',
            'example' => ['body_text' => [['John', 'SAVE25', '25%']]],
        ],
        [
            'type' => 'FOOTER',
            'text' => 'Tap Stop to unsubscribe',
        ],
        [
            'type'    => 'BUTTONS',
            'buttons' => [
                ['type' => 'QUICK_REPLY', 'text' => 'Stop promotions'],
            ],
        ],
    ],
);

$response = WhatsAppCloud::templates()->create($template);
echo $response->id;     // template id
echo $response->status; // PENDING or APPROVED

// List all templates
$templates = WhatsAppCloud::templates()->list();

// Find by name
$results = WhatsAppCloud::templates()->find('summer_promo_2024');

// Delete by name
WhatsAppCloud::templates()->delete('summer_promo_2024');
```

---

Media
-----

[](#media)

```
// Upload
$upload = WhatsAppCloud::media()->upload('/path/to/image.jpg');
echo $upload->id; // use this as media ID

// Get media info
$info = WhatsAppCloud::media()->get('media-id-123');
echo $info->url;      // temporary download URL (valid 5 min)
echo $info->mimeType;

// Download to file
WhatsAppCloud::media()->download('media-id-123', '/local/save/path.jpg');

// Download as string
$bytes = WhatsAppCloud::media()->download('media-id-123');

// Get download URL only
$url = WhatsAppCloud::media()->downloadUrl('media-id-123');

// Delete
WhatsAppCloud::media()->delete('media-id-123');
```

---

Mark Message as Read
--------------------

[](#mark-message-as-read)

```
WhatsAppCloud::markRead('wamid.incoming_message_id');
```

Typing Indicator
----------------

[](#typing-indicator)

```
WhatsAppCloud::sendTypingIndicator('wamid.incoming_message_id');
```

---

Multi-WABA / Per-Request Overrides
----------------------------------

[](#multi-waba--per-request-overrides)

```
// Use a different phone number for this request
WhatsAppCloud::usingPhoneNumber('987654321')
    ->text()
    ->to('919999999999')
    ->body('From a different number')
    ->send();

// Use a different token
WhatsAppCloud::usingToken('another-access-token')
    ->text()
    ->to('919999999999')
    ->body('With different token')
    ->send();

// Use a different API version
WhatsAppCloud::usingVersion('v24.0')
    ->text()
    ->to('919999999999')
    ->body('Using v24')
    ->send();
```

---

Exception Handling
------------------

[](#exception-handling)

```
use Vishwaraj\WhatsAppCloud\Exceptions\WhatsAppApiException;
use Vishwaraj\WhatsAppCloud\Exceptions\AuthenticationException;
use Vishwaraj\WhatsAppCloud\Exceptions\RateLimitException;

try {
    WhatsAppCloud::text()->to('919999999999')->body('Hello')->send();
} catch (AuthenticationException $e) {
    // Invalid or expired token
} catch (RateLimitException $e) {
    // Too many requests
} catch (WhatsAppApiException $e) {
    echo $e->getCode();    // Meta error code
    echo $e->getMessage(); // Human-readable message
    echo $e->getDetails(); // Additional details if available
}
```

---

Testing
-------

[](#testing)

```
composer test
```

The package uses Laravel's `Http::fake()` — no real API calls in tests.

---

License
-------

[](#license)

MIT — [LICENSE](LICENSE)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance98

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community3

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

11d ago

### Community

---

Top Contributors

[![Vishwaraj123](https://avatars.githubusercontent.com/u/97008253?v=4)](https://github.com/Vishwaraj123 "Vishwaraj123 (2 commits)")

### Embed Badge

![Health badge](/badges/vishwaraj-whatsapp-cloud-api/health.svg)

```
[![Health](https://phpackages.com/badges/vishwaraj-whatsapp-cloud-api/health.svg)](https://phpackages.com/packages/vishwaraj-whatsapp-cloud-api)
```

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90923.5M35](/packages/facebook-php-business-sdk)[exsyst/swagger

A php library to manipulate Swagger specifications

35916.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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