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.
Create a fully customized verification experience with custom prompts, messages, and callbacks.
Copy
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();
Copy
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();
Custom message shown after successful verification
failedResponse
string
No
Custom message shown after failed verification
expiredResponse
string
No
Custom message shown when link has expired
successCallback
string
No
URL to call when verification succeeds
failedCallback
string
No
URL to call when verification fails
When using custom codes in your response messages, ensure they are properly formatted and highlighted (as shown with the ##code## syntax in the example).
The prompt() method allows you to customize the text shown to users when they click the verification link. This can be used to provide context about why they’re being asked to verify.
The responseMessage() method lets you define custom messages for different verification outcomes:
successResponse: Shown after successful verification
failedResponse: Shown after failed verification
expiredResponse: Shown when the link has expired
The callback() method allows you to specify webhook URLs that will be called when verification succeeds or fails:
successCallback: Called on successful verification