PHPackages                             nachoaguirre/wassenger-bundle - 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. nachoaguirre/wassenger-bundle

ActiveSymfony-bundle[API Development](/categories/api)

nachoaguirre/wassenger-bundle
=============================

Symfony bundle to integrate wassenger.com service

v0.2.0(yesterday)01↑2900%MITPHPPHP &gt;=8.4

Since Aug 1Pushed yesterdayCompare

[ Source](https://github.com/nachoaguirre/wassenger-bundle)[ Packagist](https://packagist.org/packages/nachoaguirre/wassenger-bundle)[ RSS](/packages/nachoaguirre-wassenger-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (2)Used By (0)

Wassenger Symfony Bundle
========================

[](#wassenger-symfony-bundle)

[![Latest Version](https://camo.githubusercontent.com/b2dcca8d64f3a7dfe5af60ee17a35d9c5d952d05dd40c87451c44780ffd23ff4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6e6163686f616775697272652f77617373656e6765722d62756e646c653f646973706c61795f6e616d653d746167)](https://github.com/nachoaguirre/wassenger-bundle)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Symfony Compatibility](https://camo.githubusercontent.com/ac7f4402e0e0712eaeaf5fc9c56a6d34a8426c0a2a975425864f33811a6d7c4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d362e34253230253246253230372e78253230253246253230382e782d626c7565)](https://symfony.com)[![PHP Version](https://camo.githubusercontent.com/3740b95dbd3e5d331bb3f7cb865082bc5d52b1a4bc239cd4a047f75c5cf49ab5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e342d707572706c65)](https://php.net)

What is it?
-----------

[](#what-is-it)

The **Wassenger Symfony Bundle** provides a seamless, modern, and event-driven integration between your Symfony application and the [Wassenger WhatsApp API](https://wassenger.com/).

Built with clean architecture principles in mind, it abstracts the complexity of raw HTTP requests and provides a developer-friendly interface to send messages, validate phone numbers, and build interactive WhatsApp bots using native Symfony Events.

How it works
------------

[](#how-it-works)

This bundle is built around three core pillars:

1. **The Provider:** A service that acts as a bridge to the Wassenger API, allowing you to dispatch text, media, scheduled or template messages to individuals and groups effortlessly.
2. **The Recipient Registry:** A configuration-driven system that lets you define stable aliases (e.g., `support_group`, `billing`) mapping to actual phone numbers or WhatsApp Group IDs.
3. **The Webhook Event Dispatcher:** A secure, out-of-the-box controller that receives incoming messages from Wassenger and converts them into Symfony `WebhookEvent` objects. Your application simply listens to these events to trigger business logic.

---

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

[](#requirements)

- **PHP:** &gt;= 8.4
- **Symfony:** 6.4 (LTS), 7.x or 8.x
- **Wassenger Account:** An active API Key and Device ID from Wassenger.

---

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

[](#installation)

Install the bundle using Composer:

```
composer require nachoaguirre/wassenger-bundle
```

If you are not using Symfony Flex, enable the bundle manually in your `config/bundles.php`:

```
return [
    // ...
    Nachoaguirre\WassengerBundle\NachoaguirreWassengerBundle::class => ['all' => true],
];
```

---

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

[](#configuration)

Set up your environment variables in your `.env` file:

```
WASSENGER_API_KEY=your_api_key_here
WASSENGER_DEVICE_ID=your_device_id_here
WASSENGER_WEBHOOK_SECRET=optional_secure_token
```

Create a configuration file at `config/packages/nachoaguirre_wassenger.yaml` to define your channels and global settings:

```
nachoaguirre_wassenger:
    enable_greetings: true # Toggles built-in multilingual auto-replies for "hello"
    webhook_secret: '%env(WASSENGER_WEBHOOK_SECRET)%'

    providers:
        wassenger:
            api_key: '%env(WASSENGER_API_KEY)%'
            device_id: '%env(WASSENGER_DEVICE_ID)%'

    # Define your static recipients (individuals or groups)
    recipients:
        support_team:
            identifier: '1203630234567890@g.us'
            type: 'group'
            enabled: true
        marketing:
            identifier: '+1234567890'
            type: 'individual'
            enabled: false # Easily pause notifications without changing code
```

---

Examples
--------

[](#examples)

### 1. Sending a Basic Message

[](#1-sending-a-basic-message)

Inject the `WassengerProvider` and `RecipientRegistry` into your services or controllers to send a message.

```
namespace App\Controller;

use Nachoaguirre\WassengerBundle\Provider\WassengerProvider;
use Nachoaguirre\WassengerBundle\Registry\RecipientRegistry;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class NotificationController
{
    #[Route('/notify', name: 'app_notify')]
    public function notify(WassengerProvider $whatsapp, RecipientRegistry $registry): Response
    {
        // Using an alias defined in YAML
        $support = $registry->getActive('support_team');
        if ($support) {
            $whatsapp->sendMessage($support->identifier, "🚨 System alert: CPU usage is high!");
        }

        // Or sending directly to a dynamic phone number
        // (The bundle automatically normalizes E164 formats, stripping spaces/dashes)
        $sent = $whatsapp->sendMessage('+56 9 1234 5678', "Your order has been shipped.");

        // Every send returns a SentMessage DTO with the Wassenger message ID,
        // useful to correlate delivery-status webhooks later on.
        // $sent->id, $sent->status, $sent->deliverAt, $sent->raw

        return new Response('Notifications sent. Message ID: ' . $sent->id);
    }
}
```

### 2. Sending Media (Images, Videos, Documents)

[](#2-sending-media-images-videos-documents)

Send any publicly reachable file by URL, with an optional caption. Wassenger supports images (JPEG, PNG, WEBP), videos (MP4), audio (MP3, OGG), GIFs and documents (PDF, DOCX, ZIP, etc.).

```
$whatsapp->sendMedia(
    '+56912345678',
    'https://example.com/invoices/inv-2026-001.pdf',
    caption: 'Here is your invoice 🧾'
);
```

### 3. Scheduling a Message

[](#3-scheduling-a-message)

Deliver a message at a future date. The bundle sends the timestamp in ISO 8601 (`deliverAt`), as expected by the Wassenger API.

```
$whatsapp->scheduleMessage(
    '+56912345678',
    '¡Feliz Navidad! 🎄',
    new \DateTimeImmutable('2026-12-24 20:00:00', new \DateTimeZone('America/Santiago'))
);
```

### 4. Sending to WhatsApp Groups

[](#4-sending-to-whatsapp-groups)

Pass a group ID (ending in `@g.us`) as the recipient — the bundle detects it automatically and addresses the group instead of a phone number. Group IDs also work through the Recipient Registry, as shown in the configuration above.

```
$whatsapp->sendMessage('1203630234567890@g.us', 'Deploy finished successfully ✅');
$whatsapp->sendMedia('1203630234567890@g.us', 'https://example.com/report.pdf', 'Weekly report');
```

### 5. Using Doctrine Entities as Recipients

[](#5-using-doctrine-entities-as-recipients)

You can bind your existing database entities (like `User` or `Customer`) to the bundle by implementing the `WhatsappRecipientInterface`.

```
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Nachoaguirre\WassengerBundle\Contract\WhatsappRecipientInterface;

#[ORM\Entity]
class User implements WhatsappRecipientInterface
{
    #[ORM\Column(length: 20)]
    private ?string $phone = null;

    public function getWhatsappIdentifier(): string
    {
        return $this->phone;
    }
}
```

Now you can pass the object directly to your notification logic, making your code incredibly clean.

### 6. Validating a Number

[](#6-validating-a-number)

Wassenger provides an endpoint to check if a number actually has an active WhatsApp account. The bundle wraps this into a convenient DTO.

```
$validation = $whatsapp->validateNumber('+56912345678');

if ($validation->exists) {
    echo "This is a valid WhatsApp account in " . $validation->countryData['name'];
} else {
    echo "Invalid number: " . $validation->errorMessage;
}
```

---

Building a WhatsApp Bot (Webhooks)
----------------------------------

[](#building-a-whatsapp-bot-webhooks)

The bundle exposes a secure webhook endpoint out of the box. To handle incoming messages and build interactive bots:

### Step 1: Import the Routing

[](#step-1-import-the-routing)

Add the bundle's routes to your `config/routes/nachoaguirre_wassenger.yaml`:

```
nachoaguirre_wassenger:
    resource: '@NachoaguirreWassengerBundle/config/routes.yaml'
```

*Configure Wassenger's dashboard to point to: `https://yourdomain.com/webhook/wassenger`*

### Step 2: Create an Event Subscriber

[](#step-2-create-an-event-subscriber)

Listen to the `WebhookEvent` in your application to process incoming text and run business logic.

```
namespace App\EventSubscriber;

use Nachoaguirre\WassengerBundle\Event\WebhookEvent;
use Nachoaguirre\WassengerBundle\Provider\WassengerProvider;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class ChatBotSubscriber implements EventSubscriberInterface
{
    public function __construct(
        private readonly WassengerProvider $whatsapp
    ) {}

    public static function getSubscribedEvents(): array
    {
        return [
            WebhookEvent::NAME => 'onMessageReceived',
        ];
    }

    public function onMessageReceived(WebhookEvent $event): void
    {
        if ($event->getEventType() !== 'message:in') {
            return; // Ignore read receipts, delivery statuses, etc.
        }

        $payload = $event->getPayload();
        $text = strtolower(trim($payload['data']['body'] ?? ''));
        $sender = $payload['data']['from'];

        match ($text) {
            'status' => $this->whatsapp->sendMessage($sender, "All systems operational! 🟢"),
            'help' => $this->whatsapp->sendMessage($sender, "Commands available: status, help"),
            default => null
        };
    }
}
```

---

License
-------

[](#license)

This bundle is open-source software licensed under the **MIT License**.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/52148018?v=4)[Ignacio Aguirre](/maintainers/nachoaguirre)[@nachoaguirre](https://github.com/nachoaguirre)

---

Top Contributors

[![nachoaguirre](https://avatars.githubusercontent.com/u/52148018?v=4)](https://github.com/nachoaguirre "nachoaguirre (8 commits)")

---

Tags

apisymfonybundlebotwhatsappWassenger

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/nachoaguirre-wassenger-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nachoaguirre-wassenger-bundle/health.svg)](https://phpackages.com/packages/nachoaguirre-wassenger-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M763](/packages/sylius-sylius)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M640](/packages/shopware-core)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)

PHPackages © 2026

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