Sending and Verifying OTPs
Send an OTP
To verify a user’s phone number, you’ll first need to send them an OTP.
The
name parameter is optional, but recommended. It customizes the message to say “Your [name] code is…”, e.g. “Your Twilio code is…”Verify the Code
When your user inputs the code, verify it using the OTP ID from the previous step.
The verification will return a boolean (true/false). OTPs expire 15 minutes after sending.
Parameters
otp.new(params)
The recipient’s phone number in E.164 format (e.g., “+1234567890”).
The language code for the OTP message. See supported languages below.
Optional app name shown in the OTP message as “Your [name] code is…”.
Response
Unique identifier for the generated OTP, used for verification and resending.
Request metadata including ID, timestamp, and API version.
otp.verify(params)
The unique OTP identifier returned from the
otp.new() call.The 6-digit verification code entered by the user.
Response
Indicates whether the OTP was successfully verified. Returns
true if valid, false if invalid or expired.Request metadata including ID, timestamp, and API version.
otp.resend(params)
The unique OTP identifier from the original
otp.new() call.Response
Indicates whether the OTP was successfully resent to the original phone number.
Request metadata including ID, timestamp, and API version.
Reverse OTP
For reverse OTP flows use:contiguity.otp.reverseInitiate(params)contiguity.otp.reverseVerify(params)contiguity.otp.reverseCancel(params)
Supported Languages
Contiguity currently supports 33 languages for OTPs, including:English (en), Afrikaans (af), Arabic (ar), Catalan (ca), Chinese / Mandarin (zh), Cantonese (zh-hk), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), Finnish (fi), French (fr), German (de), Greek (el), Hebrew (he), Hindi (hi), Hungarian (hu), Indonesian (id), Italian (it), Japanese (ja), Korean (ko), Malay (ms), Norwegian (nb), Polish (pl), Portuguese - Brazil (pt-br), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv), Tagalog (tl), Thai (th), Turkish (tr), and Vietnamese (vi)
