programmerhasan / twilio-whatsapp
A Laravel package to send WhatsApp messages and OTPs via Twilio.
v1.0.0
2025-08-14 11:33 UTC
Requires
- php: ^8.0
- illuminate/support: ~6|~7|~8|~9|^10.0|^11.0|^12.0
- twilio/sdk: ^8.7
This package is auto-updated.
Last update: 2025-08-14 11:40:29 UTC
README
A Laravel package to send WhatsApp OTPs and SMS messages using Twilio.
Supports:
- WhatsApp messages & OTPs
- SMS messages
Requirements
- PHP >= 8.0
- Laravel >= 9.x
- Twilio SDK (included via composer)
Twilio Setup
1. Create a WhatsApp Service
- Go to Twilio WhatsApp Services
- Create a new WhatsApp Service
- Note down your Service SID
2. Content Template
- Go to Twilio Content Template Builder
- Create your template for OTP or messages
- Copy the Content SID
- For OTP - use default Verification Content SID
3. WhatsApp Sender
- Go to WhatsApp Senders
- Register your WhatsApp number
- Use the number in your config as
whatsapp_from
(without thewhatsapp:
prefix)
Installation
composer require programmerhasan/twilio-whatsapp
Publishing config file
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
Usage
WhatsApp OTP
use TwilioWhatsApp;
$otp = TwilioWhatsApp::sendOtp('+88017XXXXXXXX');
Send WhatsApp Message
use TwilioWhatsApp;
TwilioWhatsApp::sendMessage('+88017XXXXXXXX', 'Hello from Twilio WhatsApp!');
Support: programmerhasan.s@gmail.com or +8801975568604
License
This repository is licensed under the MIT License.
Copyright 2025 ProgrammerHasan.