Voice Prompt OTP

Overview

This guide will show you how to use the AXN Verify API to verify an individual by Voice OTP.

📘

Prerequisites

  • Deploy the "Voice Prompt OTP" service by following the directions below.
  • Obtain the access keys for your new service.
  • Download and use the Voice Prompt OTP Postman Project to try it out

Deploying a Voice Prompt OTP Service

In IDDataWeb Admin > Verification Services, click Add Verification Service, then select
Voice Prompt OTP.

You'll be prompted to review and edit the service. Once finished, click Save and Close, then exit the service to Deploy.


To run Voice Prompt OTP, what you'll do:

  • Collect the Personal Mobile Phone number of the end user.
  • Send the Voice OTP.
  • Verify the OTP .

1. Get Access Token

(POST) https://api.preprod.iddataweb.com/v1/token

API Reference: https://docs.iddataweb.com/reference/auth

This access token is used to authenticate your requests. Place this token in the header of each subsequent request. See the postman project above for examples.

Locate your workflow's access keys


Then, to request an access token:


var axios = require('axios')

var user = 'Your Service API Key';
var password = 'Your Service Shared Secret';

var base64encodedData = Buffer.from(user + ':' + password).toString('base64');

var request = async () => {
  var response = await axios({
    url: 'https://api.preprod.iddataweb.com/v1/token',
    method: 'post',
    params: {
      grant_type: 'client_credentials'
    },
    headers: {
      'Content-Type': 'application/json',
      'Cache-Control': 'no-cache',
      Authorization: 'Basic ' + base64encodedData
    }
  })
  console.log(response.data)
}
request();

Response


{
    "errorCode": "",
    "errorDescription": "",
    "access_token": "TjZK7NSjw45AxGK9UhOE9uJDaZT23gKYuUC-9GMTAgLU", // your access token
    "expires_in": "1800",
    "token_type": "Bearer"
}

2. Send OTP

(GET) https://api.preprod.iddataweb.com/v1/otp

Once you've received an access token, you can request a Voice OTP by specifying the Dial code and Phone number to send to, and authenticating the request using the Bearer token obtained from the previous step.

API Reference: https://docs.iddataweb.com/reference/otp


Request


var axios = require("axios");
var token = "YOUR_BEARER_TOKEN"; // -- obtained from step 1 --

var params = {
  type: "voice", // ✅
  dialCode: "1",
  telephone: "1234567890",
  apikey: "YOUR_MOBILEMATCH_OTP_API_KEY", // -- obtained from step 2 --
  credential: "(Optional) USERNAME",
  appID: "(Optional) YOUR_APPLICATION_NAME",
};

var request = async () => {
  var response = await axios({
    url: "https://api.preprod.iddataweb.com/v1/otp",
    method: 'get',
    params: params,
    headers: {
      "Content-Type": "application/json",
      "Cache-Control": "no-cache",
      Authorization: "Bearer " + token,
    },
  });
  console.log(response.data);
};
request();

Response


{
  responseCode: '200',
  errorDescription: null,
  asi: 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx',
  status: 'SUCCESS'
}

3. Verify OTP

(POST) https://api.preprod.iddataweb.com/v1/slverify

API Reference: https://api.preprod.iddataweb.com/v1/slverify

Lastly, confirm the OTP and the user's session (ASI) to complete verification.


Request


var axios = require("axios");
var token = "YOUR_BEARER_TOKEN"; // -- obtained from step 1 --

var data = {
	"asi": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx", // -- obtained from step 2 --
    "apikey": "YOUR_MOBILEMATCH_OTP_API_KEY", // -- obtained from step 1 --
    "credential": "USERNAME",
    "appID":"YOUR_APPLICATION_NAME",
    "userAttributes": [
        {
        	"attributeType": "PINCode",
        	"values": {
        		"pincode": "111111",
        		"pinType": "voice" // ✅
        	}
        },
        {
            "attributeType": "InternationalTelephone",
            "values": {
                "dialCode": "1",
                "telephone": "123456789"
            }
        },
]
}



var request = async () => {
  var response = await axios({
    url: "https://api.preprod.iddataweb.com/v1/slverify",
    method: 'post',
    data: data,
    headers: {
      "Content-Type": "application/json",
      "Cache-Control": "no-cache",
      Authorization: "Bearer " + token,
    },
  });
  console.log(response.data);
};
request();

Response


{ 
    "errorCode": "",
    "errorDescription": "",
    "transaction_id": "xxxx-xx-xxxx-xx-xxxxx",
    "userAttributes": ["..."],
    "userAssertionList": ["..."],
    "mbun": "xxxxx-xxxx-xxxx-xxxxx",
    "forwardApiKey": "",
    "policyObligation": false,
    "policyDecision": "approve" // expect "approve", "deny"
}

Result

If policyDecision = approve, the individual has been approved.

policyDecisionis a standard output of /slverify, the endpoint used to verify user information. Additional information on the output of SLVerify can be found here.

For instructions on how to test this workflow (including real user data), please visit: Testing MobileMatch Only