VoiceIt's API 2.0 Node Wrapper
A NodeJS wrapper for VoiceIt's API2.0 featuring Face + Voice Verification and Identification.
Getting Started
Sign up for a free Developer Account at voiceit.io and activate API 2.0 from the settings page. Then you should be able view the API Key and Token. You can also review the HTTP Documentation at api.voiceit.io
Installation
In order to easily integrate VoiceIt API 2 into your Node project, please install the VoiceIt Node Package by running the following command in npm project
npm install --save voiceit2-nodejs
API Calls
Initialization
Make Sure to add this at the top of your project file
voiceit2 = require('voiceit2-nodejs');
First assign the API Credentials an initialize a VoiceIt2 struct.
let myVoiceIt = new voiceit2("API_KEY", "API_TOKEN");
User API Calls
Get All Users
Get all users associated with the apiKey
myVoiceIt.getAllUsers((jsonResponse)=>{
console.log(jsonResponse, status);
});
Create User
Create a new user
myVoiceIt.createUser((jsonResponse)=>{
console.log(jsonResponse)
});
Check User Exists
Check whether a user exists for the given userId(begins with 'usr_')
myVoiceIt.checkUserExists({
userId:"USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Get Groups for User
Get a list of groups that the user with given userId(begins with 'usr_') is a part of
myVoiceIt.getGroupsForUser({
userId:"USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Delete User
Delete user with given userId(begins with 'usr_')
myVoiceIt.deleteUser({
userId:"USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Group API Calls
Get All Groups
Get all the groups associated with the apiKey
myVoiceIt.getAllGroups((jsonResponse)=>{
console.log(jsonResponse, status);
});
Create Group
Create a new group with the given description
myVoiceIt.createGroup({
description: "Sample Group Description"
}(jsonResponse)=>{
console.log(jsonResponse)
});
Get Group
Returns a group for the given groupId(begins with 'grp_')
myVoiceIt.getGroup({
groupId: "GROUP_ID_HERE"
}(jsonResponse)=>{
console.log(jsonResponse)
});
Delete Group
Delete group with given groupId(begins with 'grp_'), Note: This call does not delete any users, but simply deletes the group and disassociates the users from the group
myVoiceIt.deleteGroup({
groupId: "GROUP_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Check Group Exists
Checks if group with given groupId(begins with 'grp_') exists
myVoiceIt.checkGroupExists({
groupId: "GROUP_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Add User to Group
Adds user with given userId(begins with 'usr_') to group with given groupId(begins with 'grp_')
myVoiceIt.addUserToGroup({
userId: "USER_ID_HERE",
groupId: "GROUP_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Remove User from Group
Removes user with given userId(begins with 'usr_') from group with given groupId(begins with 'grp_')
myVoiceIt.removeUserFromGroup({
userId: "USER_ID_HERE",
groupId: "GROUP_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Enrollment API Calls
Get All Enrollments for User
Gets all enrollment for user with given userId(begins with 'usr_')
myVoiceIt.getAllEnrollmentsForUser({
userId: "USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Get Face Enrollments for User
Gets face enrollments for user with given userId(begins with 'usr_')
myVoiceIt.getFaceEnrollmentsForUser({
userId: "USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Delete All Enrollments for User
Delete all enrollments for user with the given userId(begins with 'usr_')
myVoiceIt.deleteAllEnrollmentsForUser({
userId: "USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Delete Enrollment for User
Delete enrollment for user with given userId(begins with 'usr_') and enrollmentId(integer)
myVoiceIt.deleteEnrollmentForUser({
userId: "USER_ID_HERE",
enrollmentId : "ENROLLMENT_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Delete Face Enrollment
Delete face enrollment for user with given userId(begins with 'usr_') and faceEnrollmentId(integer)
myVoiceIt.deleteFaceEnrollment({
userId: "USER_ID_HERE",
faceEnrollmentId : "FACE_ENROLLMENT_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Create Voice Enrollment
Create voice enrollment for user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES', etc.). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.createVoiceEnrollment({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
audioFilePath : "FULL_AUDIO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Create Voice Enrollment by URL
Create voice enrollment for user with given userId(begins with 'usr_') and contentLanguage('en-US','es-ES', etc.). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.createVoiceEnrollmentByUrl({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
audioFileURL : "PUBLIC_URL_TO_AUDIO_FILE_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Create Video Enrollment
Create video enrollment for user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES', etc.) and optionally a boolean to disable blink detection. Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.createVideoEnrollment({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.createVideoEnrollment({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Create Video Enrollment by URL
Create video enrollment for user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES', etc.) and optionally a boolean to disable blink detection. Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.createVideoEnrollmentByUrl({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFileURL : "PUBLIC_URL_TO_VIDEO_FILE_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.createVideoEnrollmentByUrl({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFileURL : "PUBLIC_URL_TO_VIDEO_FILE_HERE",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Create Face Enrollment
Create face enrollment for user with given userId(begins with 'usr_') and optionally a boolean to disable blink detection. Note: It is recommended that you send a 2 second mp4 video
myVoiceIt.createFaceEnrollment({
userId: "USER_ID_HERE",
videoFilePath : "FULL_VIDEO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.createFaceEnrollment({
userId: "USER_ID_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Verification API Calls
Voice Verification
Verify user with the given userId(begins with 'usr_') and contentLanguage('en-US','es-ES', etc.). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.voiceVerification({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
audioFilePath : "FULL_AUDIO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Voice Verification by URL
Verify user with the given userId(begins with 'usr_') and contentLanguage('en-US','es-ES', etc.). Note: File recording need to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.voiceVerificationByUrl({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
audioFileURL : "PUBLIC_URL_TO_AUDIO_FILE_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Video Verification
Verify user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES', etc.) and optionally a boolean to disable blink detection. Note: File recording needs to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.videoVerification({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.videoVerification({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Video Verification by URL
Verify user with given userId(begins with 'usr_'), contentLanguage('en-US','es-ES', etc.) and optionally a boolean to disable blink detection. Note: File recording needs to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.videoVerificationByUrl({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFileURL : "PUBLIC_URL_TO_VIDEO_FILE_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.videoVerificationByUrl({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFileURL : "PUBLIC_URL_TO_VIDEO_FILE_HERE",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Face Verification
Verify user's face with given userId(begins with 'usr_') and optionally a boolean to disable blink detection. Note: Provide an about 2 seconds long video(mp4 codec is recommended) of the user's face
myVoiceIt.faceVerification({
userId: "USER_ID_HERE",
videoFilePath : "FULL_VIDEO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.faceVerification({
userId: "USER_ID_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Identification API Calls
Voice Identification
Identify user inside group with the given groupId(begins with 'grp_') and contentLanguage('en-US','es-ES', etc.). Note: File recording needs to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.voiceIdentification({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
audioFilePath : "FULL_AUDIO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Voice Identification by URL
Identify user inside group with the given groupId(begins with 'grp_') and contentLanguage('en-US','es-ES', etc.). Note: File recording needs to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.voiceIdentificationByUrl({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
audioFileURL : "PUBLIC_URL_TO_AUDIO_FILE_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Video Identification
Identify user inside group with the given groupId(begins with 'grp_'), contentLanguage('en-US','es-ES', etc.) and optionally a boolean to disable blink detection. Note: File recording needs to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.videoIdentification({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.videoIdentification({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Video Identification by URL
Identify user inside group with the given groupId(begins with 'grp_') , contentLanguage('en-US','es-ES', etc.) and optionally a boolean to disable blink detection. Note: File recording needs to be no less than 1.2 seconds and no more than 5 seconds
myVoiceIt.videoIdentificationByUrl({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFileURL : "PUBLIC_URL_TO_VIDEO_FILE_HERE"
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
or with blinkDetection disabled
myVoiceIt.videoIdentificationByUrl({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFileURL : "PUBLIC_URL_TO_VIDEO_FILE_HERE",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse, status);
});
Authors
Armaan Bindra, armaan@voiceit.io
License
voiceit2-nodejs is available under the MIT license. See the LICENSE file for more info.