A Laravel package to send WhatsApp OTPs and SMS messages using Twilio.
Supports:
- WhatsApp messages & OTPs
- SMS messages
- PHP >= 8.0
- Laravel >= 9.x
- Twilio SDK (included via composer)
- Go to Twilio WhatsApp Services
- Create a new WhatsApp Service
- Note down your Service SID
- Go to Twilio Content Template Builder
- Create your template for OTP or messages
- Copy the Content SID
- For OTP - use default Verification Content SID
- Go to WhatsApp Senders
- Register your WhatsApp number
- Use the number in your config as
whatsapp_from
(without thewhatsapp:
prefix)
composer require programmerhasan/twilio-whatsapp
php artisan vendor:publish --provider="ProgrammerHasan\TwilioWhatsApp\TwilioWhatsAppServiceProvider" --tag=config
Add your .env values:
TWILIO_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_CONTENT_SID=your_whatsapp_content_sid
TWILIO_WHATSAPP_FROM=+1415XXXXXXX
use TwilioWhatsApp;
$otp = TwilioWhatsApp::sendOtp('+88017XXXXXXXX');
use TwilioWhatsApp;
TwilioWhatsApp::sendMessage('+88017XXXXXXXX', 'Hello from Twilio WhatsApp!');
Support: programmerhasan.s@gmail.com or +8801975568604
This repository is licensed under the MIT License.
Copyright 2025 ProgrammerHasan.