Overview

The OTP Link feature provides a secure verification method by sending clickable links via WhatsApp. Unlike traditional OTP codes, this approach allows users to verify their identity with a single tap, creating a smoother user experience while maintaining security.

How It Works

  1. Your application requests an OTP link to be sent to a user’s WhatsApp
  2. CrunchzApp generates a unique verification link and delivers it via WhatsApp
  3. The user clicks the link, which opens in their browser
  4. Upon successful verification, the user is redirected to your application or a callback URL is triggered

Available Methods

Send a standard verification link to a WhatsApp contact.

use CrunchzApp\CrunchzApp;

CrunchzApp::otp('link')
  ->contact('xxx@c.us')
  ->send();

By default, OTP links expire after 15 minutes and use a standard verification message.

Create a fully customized verification experience with custom prompts, messages, and callbacks.

use CrunchzApp\CrunchzApp;
use Illuminate\Support\Str;

$code = strtoupper(Str::random(6));
return CrunchzApp::otp('link')
  ->contact('xxx@c.us')
  ->prompt('Give me login code at MyRepublic')
  ->responseMessage(
    successResponse: 'This is your code, please make it safe and secure *##'.$code.'##*',
    failedResponse: 'Your phone number or your prompt are incorrect',
    expiredResponse: 'This link is expired, please try a new link',
  )
  ->callback(
    successCallback: 'https://github.com/crunchzApp/success-callback',
    failedCallback: 'https://github.com/crunchzApp/failed-callback'
  )
  ->send();

When using custom codes in your response messages, ensure they are properly formatted and highlighted (as shown with the ##code## syntax in the example).

Customization Options

Common Use Cases

Error Handling