Download the PHP package nachoaguirre/wassenger-bundle without Composer
On this page you can find all versions of the php package nachoaguirre/wassenger-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wassenger-bundle
Wassenger Symfony Bundle
What is it?
The Wassenger Symfony Bundle provides a seamless, modern, and event-driven integration between your Symfony application and the Wassenger WhatsApp API.
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
This bundle is built around three core pillars:
- 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.
- 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. - The Webhook Event Dispatcher: A secure, out-of-the-box controller that receives incoming messages from Wassenger and converts them into Symfony
WebhookEventobjects. Your application simply listens to these events to trigger business logic.
Requirements
- PHP: >= 8.4
- Symfony: 6.4 (LTS), 7.x or 8.x
- Wassenger Account: An active API Key and Device ID from Wassenger.
Installation
Install the bundle using Composer:
If you are not using Symfony Flex, enable the bundle manually in your config/bundles.php:
Configuration
Set up your environment variables in your .env file:
Create a configuration file at config/packages/nachoaguirre_wassenger.yaml to define your channels and global settings:
Examples
1. Sending a Basic Message
Inject the WassengerProvider and RecipientRegistry into your services or controllers to send a message.
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.).
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.
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.
5. Using Doctrine Entities as Recipients
You can bind your existing database entities (like User or Customer) to the bundle by implementing the WhatsappRecipientInterface.
Now you can pass the object directly to your notification logic, making your code incredibly clean.
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.
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
Add the bundle's routes to your config/routes/nachoaguirre_wassenger.yaml:
Configure Wassenger's dashboard to point to: https://yourdomain.com/webhook/wassenger
Step 2: Create an Event Subscriber
Listen to the WebhookEvent in your application to process incoming text and run business logic.
License
This bundle is open-source software licensed under the MIT License.
All versions of wassenger-bundle with dependencies
symfony/http-client Version ^6.4|^7.0|^8.0
symfony/config Version ^6.4|^7.0|^8.0
symfony/dependency-injection Version ^6.4|^7.0|^8.0
symfony/event-dispatcher Version ^6.4|^7.0|^8.0
symfony/http-kernel Version ^6.4|^7.0|^8.0
symfony/console Version ^6.4|^7.0|^8.0