How to Send Laravel Password Reset Links via WhatsApp API (Step-by-Step Guide)

Password Reset via WhatsApp in Laravel Using WaSenderAPI
Want to improve your Laravel application's user experience and deliverability during password resets? Learn how to implement password reset via WhatsApp using WaSenderAPI, an affordable and reliable WhatsApp messaging platform.
Why Reset Passwords via WhatsApp in Laravel?
Email-based resets are becoming outdated — users often miss the email, it lands in spam, or takes too long to deliver. With WhatsApp password reset integration, you can provide real-time delivery, greater visibility, and a better mobile experience.
WaSenderAPI offers a simple, secure, and developer-friendly API to send WhatsApp messages programmatically, making it perfect for Laravel projects.
What You’ll Learn
- How to set up WaSenderAPI in Laravel
- How to send secure password reset links via WhatsApp
- How to customize notifications and handle failures
- Best practices for phone validation and token protection
Step 1: Prerequisites
Before starting, make sure you have:
- Laravel 8 or newer installed
- A WaSenderAPI account with an active device and API key
- Composer and GuzzleHTTP installed (
composer require guzzlehttp/guzzle
) - Your
users
table includes aphone_number
column in international format
Step 2: Add the API Key to .env
WASENDER_API_KEY=your-wasender-api-key
This allows us to securely access the API from Laravel without hardcoding credentials.
Step 3: Create the WhatsApp Notification Class
php artisan make:notification WhatsAppResetPassword
Edit the generated file at app/Notifications/WhatsAppResetPassword.php
:
use Illuminate\Notifications\Notification; use GuzzleHttp\Client; class WhatsAppResetPassword extends Notification { protected $token; public function __construct($token) { $this->token = $token; } public function via($notifiable) { return ['whatsapp']; } public function toWhatsapp($notifiable) { $link = url('/password/reset', $this->token) . '?email=' . urlencode($notifiable->email); $message = "👋 Hello {$notifiable->name},\n\nClick the link below to reset your password:\n$link\n\nThis link will expire in 60 minutes."; try { $client = new Client(); $response = $client->post('https://wasenderapi.com/api/send-message', [ 'headers' => [ 'Authorization' => 'Bearer ' . env('WASENDER_API_KEY'), 'Accept' => 'application/json', ], 'json' => [ 'to' => [$notifiable->phone_number], 'text' => $message, ] ]); } catch (\Exception $e) { \Log::error('Failed to send WhatsApp reset link: ' . $e->getMessage()); } } }
Step 4: Update User Model to Use the New Notification
In app/Models/User.php
, add:
use App\Notifications\WhatsAppResetPassword; public function sendPasswordResetNotification($token) { $this->notify(new WhatsAppResetPassword($token)); }
Step 5: Validate Phone Numbers in International Format
Ensure that your users provide valid international phone numbers, especially if you’re dealing with WhatsApp delivery.
$request->validate([ 'phone_number' => ['required', 'regex:/^\d{10,15}$/'], // Customize as needed ]);
Step 6: Test the Flow
Visit the Laravel password reset page (usually /forgot-password
) and enter a user’s email. Laravel will trigger the WhatsApp message using your notification logic.
You can also trigger it manually using:
$user = User::where('email', 'example@example.com')->first(); $user->sendPasswordResetNotification(Str::random(60));
Advanced Customizations
- Multi-language support: Use Laravel's localization to send messages in different languages.
- Rate limiting: Use Laravel's throttle middleware or logic to prevent abuse.
- Fallback to email: Add email as a fallback in case WhatsApp delivery fails.
Security Best Practices
- Use HTTPS for all reset links
- Log WhatsApp sending attempts and errors securely
- Store phone numbers in an encrypted database column if needed
- Set a short token expiration time (Laravel default is 60 minutes)
Real-World Use Cases
- SaaS Platforms: Allow password reset via WhatsApp for B2B users on the go
- E-Commerce: Ensure timely password reset for shoppers who can’t wait for emails
- Internal Tools: Speed up employee access recovery through WhatsApp
Conclusion
With just a few tweaks, you’ve now implemented a modern, fast, and reliable WhatsApp-based password reset system in Laravel using WaSenderAPI. This solution improves UX and fits both customer-facing apps and internal tools.
Get Started with WaSenderAPI to revolutionize your Laravel workflows.
Frequently Asked Questions
Can I send a verification code instead of a link?
Yes. You can generate a short numeric token, save it in the database, and prompt the user to enter it on a verification page.
How do I know if the WhatsApp message failed?
WaSenderAPI returns a response object. You can log the response status or message and implement retry logic if needed.
Is WaSenderAPI GDPR compliant?
WaSenderAPI stores only essential metadata and does not read message content. Still, you should update your privacy policy accordingly.
Can I combine email and WhatsApp notifications?
Yes. In your via()
method, return both ['mail', 'whatsapp']
and customize the notification content for each channel.
Related Posts

The Best Unofficial WhatsApp API Provider for Developers in 2025
Looking for a reliable unofficial WhatsApp API provider? Discover WaSenderAPI — a powerful, affordable, and easy-to-use WhatsApp API with no approval or complex setup required.

How to Build a WhatsApp AI Chatbot in 5 Minutes Using Python (No Coding Skills Needed)
Learn how to build your own AI chatbot for WhatsApp in just 5 minutes using Python, Google Gemini, and WaSenderAPI. No coding experience needed. This beginner-friendly guide gives you a ready-to-use script to start automating WhatsApp conversations for only $6/month.

Unofficial WhatsApp API: Best Integration Option for Developers in 2025
Discover the power of an unofficial WhatsApp API in 2025. Learn why developers prefer third-party solutions like WasenderAPI for fast, affordable, and flexible WhatsApp automation without Meta’s restrictions.