send
abstract suspend fun send(request: IOTPsWhatsAppSendSecondaryParameters): OTPsWhatsAppSendSecondaryResponse
Sends a one-time passcode via WhatsApp to an existing user's phone number. Routes to POST /sdk/v1/otps/whatsapp/send/primary if no session is active, or POST /sdk/v1/otps/whatsapp/send/secondary if a session exists (to add an additional auth factor).
Kotlin:
StytchConsumer.otps.whatsapp.send(
OTPsWhatsAppSendSecondaryParameters(phoneNumber = "+15005550006")
)Content copied to clipboard
iOS:
let params = OTPsWhatsAppSendSecondaryParameters(phoneNumber: "+15005550006")
let response = try await StytchConsumer.otps.whatsapp.send(params)Content copied to clipboard
React Native:
StytchConsumer.otps.whatsapp.send({ phoneNumber: "+15005550006" })Content copied to clipboard
Return
OTPsWhatsAppSendSecondaryResponse containing the methodId needed for OtpClient.authenticate.
Parameters
request
IOTPsWhatsAppSendSecondaryParameters
phoneNumber— The phone number to send the OTP to, in E.164 format (e.g."+15005550006").expirationMinutes?— Expiration for the OTP, in minutes.locale?— Locale used for the message (e.g."en").
Throws
StytchError
if the request fails.
if the coroutine is cancelled.