Hypersender

Messaging APIs

WhatsApp APISend and receive from your own numberSMS gateway appApproved on Google Play, Android 9 to 16OTP APICodes and WhatsApp sign-in links

Build with it

MCP serverWhatsApp and SMS from your AI assistantIntegrationsn8n, AI assistants and SDKsWhatsApp API pricingPlans, and per-message costs comparedDocsAPI reference and setup guides
SDKsLaravelNode.jsPythonGon8n

WhatsApp

CRM integrationPayment remindersOrder updatesWhatsApp OTPIncoming message webhooksWhatsApp AI chatbotCustomer serviceWhatsApp automationMessaging from LaravelClaude to WhatsAppChatGPT integrationZapier and MakeWhatsApp surveys

SMS

Appointment remindersSMS OTPFilter and tag SMSSMS forwardingSMS gateway appAndroid SMS gateway
All use cases
WhatsApp link generatorA short chat link with a ready message, a QR code with your logo and a button for your website.WhatsApp message templatesReady messages for orders, appointments and payments, with a builder that checks them against Meta's rules.WhatsApp text formatterBold, italic, strikethrough, lists and quotes, with keyboard shortcuts and a live iPhone preview.SMS character counterCharacters, SMS parts and GSM-7 or Unicode, plus the characters that make a message longer.Phone validatorCheck if a number is valid, see its country and line type, and copy it in E.164 or WhatsApp format. Works on lists too.Phone number formatterTurn a messy list into one format: E.164, international, national or WhatsApp chat IDs, ready to copy or download.Phone number extractorPaste any text, an email or a spreadsheet and get every phone number in it, cleaned up and without repeats.CSV to VCF converterTurn a CSV file or cells copied from Excel into a VCF file you can import to your phone's contacts.vCard QR code generatorA QR code that saves your name, number, email and website to the phone that scans it.Name decorationStylish versions of a name in English or Arabic for PUBG, Free Fire, Instagram and TikTok.
All free tools

Company

BlogGuides, tutorials and comparisonsAlternativesHypersender vs WATI, Twilio and moreAbout HypersenderWho we are and how we workFAQsShort answers to common questions

Community

Latest postNovember 30, 2026WhatsApp Business Web: Log In, Features and LimitsWhatsApp Business Web: log in with a QR code or phone number, see what works on a computer, the 4-device limit, and fixes when it stops working.Read the post
PricingDocs
Sign InGet Started
Hypersender

Product

  • Features
  • Use cases
  • MCP server
  • Pricing
  • WhatsApp API pricing
  • SDKs
  • Integrations
  • Docs

Free tools

  • WhatsApp link generator
  • WhatsApp message templates
  • WhatsApp text formatter
  • SMS character counter
  • Phone validator
  • Name decoration
  • All tools

Resources

  • About Hypersender
  • FAQ
  • Blog
  • Alternatives
  • Discord
  • WhatsApp

Legal

  • Terms and Conditions
  • Privacy Policy
Featured onFeatured on LaunchAFFeatured on LaunchAFFeatured on Twelve ToolsFeatured on Twelve Tools

© 2026 Hypersender. All rights reserved.

GET IT ONGoogle Play
HypersenderHypersenderHypersenderHypersenderHypersender
All articles

Developer guides

Laravel OTP Verification over WhatsApp and SMS

Laravel OTP verification with the Hypersender SDK: send a code over WhatsApp or SMS, check what the user types, and rate-limit both routes.

Hypersender·November 30, 2026·3 min read
Laravel OTP Verification over WhatsApp and SMSLaravel OTP Verification over WhatsApp and SMS
On this page
  1. What you need
  2. Install the SDK and add the OTP keys
  3. Send the code
  4. Check the code
  5. Routes and rate limits
  6. Send the code by SMS instead
  7. Skip the code with a WhatsApp link
  8. Common problems
  9. Pricing

On this page

  1. What you need
  2. Install the SDK and add the OTP keys
  3. Send the code
  4. Check the code
  5. Routes and rate limits
  6. Send the code by SMS instead
  7. Skip the code with a WhatsApp link
  8. Common problems
  9. Pricing

Laravel OTP verification with Hypersender takes two calls: requestCode sends a one-time code from your own WhatsApp number or SMS phone, and validateCode checks what the user typed. Hypersender creates the code, sends it, and tracks expiry and single use, so you don't need an otps table.

This guide builds a phone verification flow for logged-in users: a form that sends the code, a form that checks it, and rate limits on both.

What you need

  • Laravel 10, 11 or 12, on PHP 8.2 or newer
  • A Hypersender account with a WhatsApp instance connected by QR code, or an SMS instance on an Android phone
  • The instance's API key and instance ID, from the dashboard

Install the SDK and add the OTP keys

bash
composer require hypersender/hypersender-laravel
php artisan vendor:publish --tag=hypersender-config

The OTP client has its own keys in .env:

env
HYPERSENDER_OTP_API_KEY=your_api_key
HYPERSENDER_OTP_INSTANCE_ID=your_instance_id

The instance decides the channel. A WhatsApp instance sends the code as a WhatsApp message, and an SMS instance sends a plain-text SMS from the phone.

Add a place to store the verified number:

bash
php artisan make:migration add_phone_to_users_table
php
Schema::table('users', function (Blueprint $table) {
    $table->string('phone')->nullable();
    $table->timestamp('phone_verified_at')->nullable();
});

Send the code

php
namespace App\Http\Controllers;
 
use Hypersender\Hypersender;
use Illuminate\Http\Request;
 
class PhoneVerificationController extends Controller
{
    public function send(Request $request)
    {
        $data = $request->validate([
            'phone' => ['required', 'regex:/^[1-9]\d{7,14}$/'], // country code + number, digits only
        ]);
 
        $response = Hypersender::otp()->requestCode(
            chatId: $data['phone'].'@c.us',
            length: 6,
            useNumber: true,
            useLetter: false,
            allCapital: false,
            name: config('app.name'),
            expires: 300,
        );
 
        if ($response->failed()) {
            return back()->withErrors(['phone' => 'We could not send a code to that number.']);
        }
 
        $request->session()->put('otp_chat_id', $response->json('data.chat_id'));
 
        return redirect()->route('phone.verify');
    }
}

The user gets a message with your app name and the code. expires is in seconds, from 60 to 1800, and length can be 4 to 10. Set useLetter to true for codes like K7P2QX.

The response includes the generated code in data.code. Keep it on the server. Don't return it to the browser and don't log it.

Check the code

Add the second method to the same controller:

php
public function verify(Request $request)
{
    $data = $request->validate(['code' => ['required', 'string', 'max:10']]);
 
    $chatId = $request->session()->get('otp_chat_id');
 
    if (! $chatId) {
        return redirect()->route('phone.edit');
    }
 
    $response = Hypersender::otp()->validateCode(
        chatId: $chatId,
        code: $data['code'],
    );
 
    if (! $response->successful() || $response->json('data.status') !== 'validated') {
        return back()->withErrors(['code' => 'That code is wrong or has expired.']);
    }
 
    $request->session()->forget('otp_chat_id');
 
    $request->user()->forceFill([
        'phone' => strstr($chatId, '@', true),
        'phone_verified_at' => now(),
    ])->save();
 
    return redirect()->intended('/dashboard');
}

A wrong, expired or already used code comes back as HTTP 422 with success: false, so one check covers all three. A code works once: after a successful check, the same code fails.

Routes and rate limits

php
use App\Http\Controllers\PhoneVerificationController;
 
Route::middleware('auth')->group(function () {
    Route::view('/phone', 'phone.edit')->name('phone.edit');
    Route::view('/phone/verify', 'phone.verify')->name('phone.verify');
 
    Route::post('/phone', [PhoneVerificationController::class, 'send'])
        ->middleware('throttle:3,10');
 
    Route::post('/phone/verify', [PhoneVerificationController::class, 'verify'])
        ->middleware('throttle:5,1');
});

throttle:3,10 allows three codes per user every 10 minutes, so nobody can use your form to flood a number. throttle:5,1 allows five guesses a minute, which makes guessing a 6-digit code before it expires impractical. Hypersender has its own limits on top: up to 10 code requests and 20 checks a minute.

The two Blade views are plain forms: one posts phone, the other posts code.

Send the code by SMS instead

Point HYPERSENDER_OTP_INSTANCE_ID at an SMS instance and pass the number in international format, with no @c.us:

php
$response = Hypersender::otp()->requestCode(
    chatId: '+'.$data['phone'],
    length: 6,
    useNumber: true,
    useLetter: false,
    allCapital: false,
    name: config('app.name'),
    expires: 300,
);

The SMS reads like YourApp code: 482913, and the wording rotates between a few short versions so carriers are less likely to filter it. Validate with the same + number.

In verify, store ltrim($chatId, '+') instead of the strstr call. The phone sends through its SIM, so the cost is your mobile plan. The SMS OTP guide covers sending your own message text.

Skip the code with a WhatsApp link

On a WhatsApp instance, generateLink returns a WhatsApp link with a prefilled message. The user opens it and sends that message from their own WhatsApp, which proves they own the number, so there's no code to type:

php
$response = Hypersender::otp()->generateLink(
    chatId: $user->phone.'@c.us',
    expires: 600,
    name: config('app.name'),
    message: [
        'prompt' => 'Send me my sign-in link',
        'success' => 'Here is your link: {link}',
        'failed' => 'Sign-in failed, please try again.',
        'expired' => 'This link has expired. Ask for a new one.',
    ],
    callback: [
        'success' => route('otp.link.success'),
        'failed' => route('otp.link.failed'),
    ],
);
 
$link = $response->throw()->json('data.whatsapp_link');

SMS instances can't create links. The OTP link guide has the full flow and what to check before you sign a user in from a callback.

Common problems

  • The code never arrives: the instance isn't connected. Open the dashboard and scan the QR code again, or check that the SMS phone is online.
  • The request is rejected: the chat ID format doesn't match the instance. WhatsApp needs 201001234567@c.us, SMS needs +201001234567.
  • Every check fails: validate with the exact chat_id the request returned. That's why the controller keeps it in the session.
  • Too many requests: you hit the per-minute limit. Wait a minute and let the user retry.

Pricing

WhatsApp OTP is part of the WhatsApp plan, from $9.99 per number a month, with no fee per code. Starter includes 3,000 OTP requests per number a month. See the WhatsApp OTP use case and the plans.

The package reference is in the Laravel OTP docs, and Send WhatsApp messages in Laravel covers the rest of the SDK. Create a Hypersender account to get your API key and instance ID.

Keep reading

What Is a Webhook? How Webhooks Work, With ExamplesWhat Is a Webhook? How Webhooks Work, With Examples

Developer guides

What Is a Webhook? How Webhooks Work, With Examples

What is a webhook: an HTTP request an app sends to your URL when an event happens. How webhooks work, with a real payload to test for free.

November 29, 2026·3 min read

By Hypersender

Webhook vs API: The Difference, With ExamplesWebhook vs API: The Difference, With Examples

Developer guides

Webhook vs API: The Difference, With Examples

Webhook vs API: an API answers when you ask, a webhook calls you when something happens. When to use each, with WhatsApp and SMS examples.

November 29, 2026·2 min read

By Hypersender

Send WhatsApp Message From Google Sheets With Apps ScriptSend WhatsApp Message From Google Sheets With Apps Script

Developer guides

Send WhatsApp Message From Google Sheets With Apps Script

Send WhatsApp message from Google Sheets: a free Apps Script that sends one message per row from your own number, with an SMS version.

November 28, 2026·3 min read

By Hypersender

Start Sending WhatsApp and SMS Messages Today

Start a free trial: 14 days for WhatsApp and 28 days for SMS, with up to 100 messages a day.

Contact SalesGet Started