<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dineshstack / laravel-whatsapp-cost-control example snippets
use Dineshstack\WhatsApp\Services\WhatsAppService;
$wa = app(WhatsAppService::class);
// A pre-approved template
$wa->sendTemplate('971501234567', 'order_shipped', 'en_US', [
['type' => 'body', 'parameters' => [['type' => 'text', 'text' => '#4821']]],
]);
// OTP via the template configured in whatsapp.templates.otp
$wa->sendOtp('971501234567', '482913');
// Free-form text (only lands inside an open 24h service window)
$wa->sendText('971501234567', 'Your driver has arrived.');
use Dineshstack\WhatsApp\Models\WhatsAppSuppression;
use Dineshstack\WhatsApp\Services\WhatsAppSuppressionService;
app(WhatsAppSuppressionService::class)->suppress('971501234567', WhatsAppSuppression::SCOPE_ALL, WhatsAppSuppression::SOURCE_MANUAL, 'Asked at the counter');
app(WhatsAppSuppressionService::class)->lift('971501234567', WhatsAppSuppression::SOURCE_MANUAL);
bash
php artisan whatsapp:test {phone} # end-to-end send check
php artisan whatsapp:templates # list templates as Meta sees them
php artisan whatsapp:prune-logs # trim the audit log (default 90 days)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.