axolotesource / laravel-whatsapp-api
This Laravel package facilitates sending WhatsApp messages seamlessly within your application. With easy integration, it empowers developers to incorporate WhatsApp messaging functionality, enhancing user engagement and communication in a straightforward manner.
Requires
- php: >=7.4
Requires (Dev)
- orchestra/testbench: ^8.15
- phpunit/phpunit: ^10.4
This package is not auto-updated.
Last update: 2025-03-12 12:22:27 UTC
README
INSTALL
composer require axolotesource/laravel-whatsapp-api
To publish the configuration file, run the following command:
php artisan vendor:publish
When prompted to select the provider, choose Axolotesource\LaravelWhatsappApi\LaravelWhatsappApiServiceProvider.
WhatsAppMessages
Examples
templete(string $to, string $templateName = null): Template
This method allows you to send a template-type message (this is the first message that should be sent to the client). For the second parameter, it can be null, and if so, it retrieves the value from config('laravel-whatsapp-api.default_initial_template');.
$whatsappMessage = WhatsAppMessages::templete($phoneNumber) ->language('es_MX') ->addComponents([ BodyComponent::create([ Params::text('This is a test message') ]), ButtonComponent::create([ Params::button('yes') ]), ButtonComponent::create([ Params::button('no') ]), ButtonComponent::create([ Params::button('never') ]) ]);
interactiveButtons(string $to): InteractiveButtons
WhatsAppMessages::interactiveButtons($phoneNumber) ->setHeaderImage( 'https://url.com/test.jpg' ) ->addButton('Button 1', 1) ->addButton('Button 2', 2) ->addButton('Button 3', 3) ->body('This is te body message') ->send();