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.

1.0.0 2023-11-21 08:07 UTC

This package is not auto-updated.

Last update: 2024-04-24 08:32:42 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();

Coming song more documentation....