Skip to main content
Generate a one-time password and deliver it to a WhatsApp user using the Laravel SDK. The response includes the OTP uuid, generated code, status, and expiry time so you can track validation.

Parameters

FieldTypeRequiredDescription
chatIdstringyesWhatsApp chat ID of the recipient (e.g., [email protected]).
lengthintnoCode length (default 6).
useLetterboolnoInclude letters (default false).
useNumberboolnoInclude numbers (default true).
allCapitalboolnoUppercase letters when useLetter is true (default false).
namestringnoDisplay name inside the message (e.g., your app name).
expiresintnoTTL in seconds (default 1800).

Send the request

use Hypersender\Hypersender;

$otp = Hypersender::otp()->requestCode([
  'chatId' => '[email protected]',
  'length' => 6,
  'useLetter' => false,
  'useNumber' => true,
  'allCapital' => false,
  'name' => 'YourApp',
  'expires' => 900,
]);
  • Store uuid if you plan to track or audit the request.
  • Use status to monitor the send/validation lifecycle (pending, sent, validated, expired).
Request OTP Code

Next

Validate the code the user enters with Validate OTP Code.
OTP codes are short-lived and single-use. Prompt users to request a new code after expiry or repeated failures.