What you can do
- Request OTP codes: Generate a one-time code and send it from a WhatsApp or SMS instance.
- Validate codes: Check user-entered codes against the active OTP.
- Generate OTP links (WhatsApp only): Create WhatsApp links that complete verification without typing. SMS instances can’t generate links.
Prerequisites
- Go module with
github.com/hypersender/hypersender-goinstalled (Installation). - Hypersender API token and Instance UUID from the dashboard, set as
HYPERSENDER_OTP_API_KEYandHYPERSENDER_OTP_INSTANCE_ID. - For SMS, an SMS instance with the Hypersender SMS app running on the linked Android phone. See SMS quick start.
Base URL and auth
Quick start (request and validate)
hypersender.Result (a map[string]any), with the OTP details under data. Any 4XX or 5XX response returns a *hypersender.Error; a wrong, used, or expired code returns one with StatusCode 422.
The optional booleans in
RequestCodeOptions are *bool, so that an explicit false is sent. Set them with hypersender.Bool(true) or hypersender.Bool(false), or leave them nil to use the API’s defaults.Send the code over SMS
With an SMS instance, pass the phone number in international format aschatID. Spaces, dashes, dots, and parentheses are removed, and 00 at the start is read as +. WhatsApp chat IDs are rejected for SMS.