1. Get the SDK

We provide SDKs for many popular languages to make your life easier.

npm add @ding-live/ding

Want to see another language make its way to the list? Tell us

2. Initialize the SDK

Initialize the SDK by pasting the snippet below.

Copy API_TOKEN and CUSTOMER_UUID from the Settings > API page of your dashboard.

import { Ding } from "@ding-live/ding";
import { DeviceType } from "@ding-live/ding/dist/models/components";

const sdk = new Ding({
  apiKey: "API_KEY",

3. Send a code

Call the Authentication endpoint with your phone number. You will receive a code by SMS.

const res = await sdk.otp.createAuthentication({
  customerUuid: "CUSTOMER_UUID",
  phoneNumber: "+1234567890",

In production, we recommend storing the authentication_uuid in a distributed cache like Redis between send and check calls if you use a stateless backend.

4. Verify the code

Call the Check endpoint with the authentication_uuid returned by the previous call and the code you received.

const res = await sdk.otp.check({
  authenticationUuid: "AUTH_UUID",
  checkCode: "123456",
  customerUuid: "CUSTOMER_UUID",

Congratulations, you’ve just integrated Ding!. Now, you can go to the dashboard and see your OTP codes in the Authentications tab.

Going further

Here are a few more steps before moving on to production:


Test your integration

To make sure your integration is correct, use test numbers in your automated tests. Add them in the Settings > API tab.


Add fraud signals

Add Signals such as ip_address, app_version and is_returning_user to your Authentication requests to better prevent fraud and reduce your expenses.


Plug your webhook

Listen to Webhook events to get notified when an OTP is sent or billed.

Next steps

Get more in-depth with our guides to prepare your integration for production:

API Reference

Learn more about Prelude’s API endpoints.