Skip to main content
Generate a one-time password and send it over WhatsApp or SMS with the Go SDK. The channel follows your OTP instance: a WhatsApp instance sends a WhatsApp message, an SMS instance sends a plain-text SMS. The response includes the OTP uuid, generated code, status, and expiry time so you can track validation.

Parameters

Send the request

  • The method takes ctx and chatID as the first arguments and the other fields in a *hypersender.RequestCodeOptions (or nil for the defaults). Set the *bool fields with hypersender.Bool.
  • On an SMS instance, otp["chat_id"] is the phone number in international format, +201001234567.
  • Store uuid if you plan to track or audit the request.
  • Use status to monitor the send/validation lifecycle (pending, sent, validated, expired).
  • expires_at and created_at are ISO 8601 strings. Parse them with time.Parse(time.RFC3339, ...) if you need time.Time values.
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.
Last modified on November 24, 2026