Use the Hypersender OTP service from Laravel to send verification codes or passwordless links over WhatsApp (and SMS for codes), then validate user submissions securely using the packaged SDK methods.
What you can do
- Request OTP codes: Generate a one-time code and deliver it over WhatsApp.
- Validate codes: Check user-entered codes against the active OTP.
- Generate magic links: Create WhatsApp links that complete verification without typing.
Prerequisites
- Laravel app with the Hypersender Laravel package installed (Installation).
- Hypersender API token and Instance UUID from the dashboard.
- Laravel HTTP client available (
Illuminate\\Support\\Facades\\Http).
Base URL and auth
Base URL: https://app.hypersender.com/api/otp/v2
Auth: Authorization: Bearer YOUR_API_TOKEN
Instance: X-Instance-UUID: YOUR_INSTANCE_UUID
Quick start (request and validate)
use Hypersender\Hypersender;
// 1) Send a code
$request = Hypersender::otp()->requestCode([
'chatId' => '[email protected]', // WhatsApp chat ID
'length' => 6,
'useLetter' => false,
'useNumber' => true,
'name' => 'YourApp',
'expires' => 300,
]);
// 2) Validate it later
$validation = Hypersender::otp()->validateCode([
'chatId' => $request['chat_id'] ?? '[email protected]',
'code' => $request['code'] ?? '123456',
]);
Keep tokens and OTP codes out of logs. Use HTTPS for all calls.
Next steps