PHP code example of itsmedudes / laravel-whatsapp

1. Go to this page and download the library: Download itsmedudes/laravel-whatsapp 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/ */

    

itsmedudes / laravel-whatsapp example snippets


use LaravelWhatsapp\WhatsAppBusinessClient;
use LaravelWhatsapp\WhatsApp\MessagePayloadBuilder;

$client = app(WhatsAppBusinessClient::class)->forUser($userId);

$payload = MessagePayloadBuilder::text($to, 'Hello!');
$client->sendMessage($phoneNumberId, $payload);

use LaravelWhatsapp\WebhookVerifier;

$verifier = new WebhookVerifier();
$ok = $verifier->verifySignature($payload, $signatureHeader);

php artisan vendor:publish --tag=meta-config
php artisan vendor:publish --tag=meta-migrations
php artisan migrate