PHP code example of axolotesource / laravel-whatsapp-api

1. Go to this page and download the library: Download axolotesource/laravel-whatsapp-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

axolotesource / laravel-whatsapp-api example snippets


$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')
        ])
    ]);

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();
bash
php artisan vendor:publish