Contiguity offers a free OTP API that simplifies phone number verification using OTPs via SMS, which eliminates the need to develop custom logic. Gone are the days of paying for this simple feature.

Contiguity still bills you for the text messages on our pay-as-you-go tier, includes them in Unlimited, and subtracts them from your quota if you’re on the Free tier.

We don’t charge extra for the OTP API.

Installing the SDK

1

Install the SDK

Contiguity is working on adding several SDKs over the coming months, including ones for Swift, Java, Dart, and more.

Use npm to install @contiguity/javascript

npm i @contiguity/javascript
2

Initialize the Client

After installation, import Contiguity into your project and give it your token.

const contiguity = require('@contiguity/javascript')
const client = contiguity.login("your token here")

You can also initialize it with the optional ‘debug’ flag:

const client = contiguity.login("your token here", true)

Sending and Verifying OTPs

1

Send an OTP

To verify a user’s phone number, you’ll first need to send them an OTP.

const otp_id = await client.otp.send({ 
    to: "+15555555555", 
    language: "en", 
    name: "Contiguity" 
})

The name parameter is optional, but recommended. It customizes the message to say “Your [name] code is…”, e.g. “Your Twilio code is…”

2

Verify the Code

When your user inputs the code, verify it using the OTP ID from the previous step.

const verify = await client.otp.verify({
    otp_id: otp_id,  // from the previous step
    otp: input       // the 6 digits your user inputted
})

The verification will return a boolean (true/false). OTPs expire 15 minutes after sending.

3

Resend if Needed

If needed, you can resend an OTP using the original OTP ID.

const resend = await client.otp.resend({
    otp_id: otp_id  // from the first step
})

Resending an OTP does not renew its expiry time.

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)