Download the PHP package clonixdev/laravel-whatsapp-notification-channel without Composer
On this page you can find all versions of the php package clonixdev/laravel-whatsapp-notification-channel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clonixdev/laravel-whatsapp-notification-channel
More information about clonixdev/laravel-whatsapp-notification-channel
Files in clonixdev/laravel-whatsapp-notification-channel
Package laravel-whatsapp-notification-channel
Short Description Whatsapp Notifications Channel for Laravel
License MIT
Homepage https://github.com/clonixdev/laravel-whatsapp-notification-channel
Informations about the package laravel-whatsapp-notification-channel
Whatsapp Notifications Channel for Laravel
This package makes it easy to send Whatsapp notification using WPPCONNECT SERVER) with Laravel.
This package was created based on the telegram notification package.
Thanks to Irfaq Syed for the codebase used here.
The packages is 100% free and opensource, if you are interested in hiring paid support, installation or implementation, Felipe D. Teodoro
Contents
-
Installation
-
Setting up your Whatsapp session
- Proxy or Bridge Support
-
- Usage
- Text Notification
- Attach a Contact
- Attach an Audio
- Attach a Photo
- Attach a Document
- Attach a Location
- Attach a Video
- Attach a GIF File
- Routing a Message
- Handling Response
- On-Demand Notifications
- Sending to Multiple Recipients
- Available Methods
- Shared Methods
- Whatsapp Message methods
- Whatsapp Location methods
- Whatsapp File methods
- Whatsapp Contact methods
- Whatsapp Poll methods
- Alternatives
- Changelog
- Testing
- Security
- Contributing
- Credits
- License
Installation
You can install the package via composer:
Publish config file
Publish the config file:
Setting up your Whatsapp session
Set your venom session WPPCONNECT SERVER and configure your Whatsapp Session:
Proxy or Bridge Support
You may not be able to send notifications if Whatsapp API is not accessible in your country,
you can either set a proxy by following the instructions here or
use a web bridge by setting the base_uri
config above with the bridge uri.
You can set HTTPS_PROXY
in your .env
file.
Usage
You can now use the channel in your via()
method inside the Notification class.
Text Notification
Attach an Audio
Attach a Photo
Attach a Document
Attach a Location
Attach a Video
Attach a GIF File
Routing a Message
You can either send the notification by providing with the whatapp number of the recipient to the to($whatsapp_number)
method like shown in the previous examples or add a routeNotificationForWhatsapp()
method in your notifiable model:
Handling Response
You can make use of the notification events to handle the response from Whatsapp. On success, your event listener will receive a Message object with various fields as appropriate to the notification type.
For a complete list of response fields, please refer the Venom Whatsapp API's Message object docs.
On-Demand Notifications
Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the
Notification::route
method, you may specify ad-hoc notification routing information before sending the notification. For more details, you can check out the on-demand notifications docs.
Sending to Multiple Recipients
Using the notification facade you can send a notification to multiple recipients at once.
If you're sending bulk notifications to multiple users, the Whatsapp API will not allow more than 30 messages per second or so. Consider spreading out notifications over large intervals of 8—12 hours for best results.
Also note that your bot will not be able to send more than 20 messages per minute to the same group.
If you go over the limit, you'll start getting
429
errors. For more details, refer Whatsapp Api FAQ.
Available Methods
Shared Methods
These methods are optional and shared across all the API methods.
to(int|string $number)
: Recipient's number.session(string $session)
: Session if you wish to override the default session for a specific notification.options(array $options)
: Allows you to add additional params or override the payload.getPayloadValue(string $key)
: Get payload value for given key.
Whatsapp Message methods
For more information on supported parameters, check out these docs.
content(string $content, int $limit = null)
: Notification message, supports markdown. For more information on supported markdown styles, check out these docs.view(string $view, array $data = [], array $mergeData = [])
: (optional) Blade template name with Whatsapp supported Markdown syntax content if you wish to use a view file instead of thecontent()
method.chunk(int $limit = 4096)
: (optional) Message chars chunk size to send in parts (For long messages). Note: Chunked messages will be rate limited to one message per second to comply with rate limitation requirements from Whatsapp.
Whatsapp Location methods
latitude(float|string $latitude)
: Latitude of the location.longitude(float|string $longitude)
: Longitude of the location.title(string $title)
: Title of locationdescription(string $description)
: description of location
Whatsapp File methods
content(string $content)
: (optional) File caption, supports markdown. For more information on supported markdown styles, check out these docs.view(string $view, array $data = [], array $mergeData = [])
: (optional) Blade template name with Whatsapp supported HTML or Markdown syntax content if you wish to use a view file instead of thecontent()
method.file(string|resource|StreamInterface $file, string $type, string $filename = null)
: Local file path or remote URL,$type
of the file (Ex:photo
,audio
,document
,video
,animation
,voice
,video_note
) and optionally filename with extension. Ex:sample.pdf
. You can use helper methods instead of using this to make it easier to work with file attachment.photo(string $file)
: Helper method to attach a photo.audio(string $file)
: Helper method to attach an audio file (MP3 file).document(string $file, string $filename = null)
: Helper method to attach a document or any file as document.video(string $file)
: Helper method to attach a video file.animation(string $file)
: Helper method to attach an animated gif file.
Whatsapp Contact methods
phoneNumber(string $phoneNumber)
: Contact phone number.name(string $name)
: Full name.firstName(string $firstName)
: (optional if you use name param) Contact first name.lastName(string $lastName)
: (optional) Contact last name.
Simple Whatsapp Api
For simple use, please consider using whatsapp-api instead.
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
- Felipe D. Teodoro
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-whatsapp-notification-channel with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^6.2 || ^7.0
illuminate/contracts Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
illuminate/notifications Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0
illuminate/support Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0