A NodeJS wrapper for VoiceIt's API2.0 featuring Face + Voice Verification and Identification.
- Getting Started
- Installation
- API Calls
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
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
Make Sure to add this at the top of your project file
let voiceit2 = require('voiceit2-nodejs');
First assign the API Credentials an initialize a VoiceIt2 struct.
let myVoiceIt = new voiceit2("API_KEY", "API_TOKEN");
Get all users associated with the apiKey
myVoiceIt.getAllUsers((jsonResponse)=>{
console.log(jsonResponse);
});
Create a new user
myVoiceIt.createUser((jsonResponse)=>{
console.log(jsonResponse)
});
Check whether a user exists for the given userId(begins with 'usr_')
myVoiceIt.checkUserExists({
userId:"USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
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 with given userId(begins with 'usr_')
myVoiceIt.deleteUser({
userId:"USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Get all the groups associated with the apiKey
myVoiceIt.getAllGroups((jsonResponse)=>{
console.log(jsonResponse);
});
Create a new group with the given description
myVoiceIt.createGroup({
description: "Sample Group Description"
},(jsonResponse)=>{
console.log(jsonResponse)
});
Returns a group for the given groupId(begins with 'grp_')
myVoiceIt.getGroup({
groupId: "GROUP_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
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)
});
Checks if group with given groupId(begins with 'grp_') exists
myVoiceIt.checkGroupExists({
groupId: "GROUP_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse)
});
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)
});
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)
});
Gets all enrollment for user with given userId(begins with 'usr_')
myVoiceIt.getAllEnrollmentsForUser({
userId: "USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse);
});
Gets face enrollments for user with given userId(begins with 'usr_')
myVoiceIt.getFaceEnrollmentsForUser({
userId: "USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse);
});
Delete all enrollments for user with the given userId(begins with 'usr_')
myVoiceIt.deleteAllEnrollmentsForUser({
userId: "USER_ID_HERE"
},(jsonResponse)=>{
console.log(jsonResponse);
});
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);
});
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);
});
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);
});
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);
});
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);
});
or with blinkDetection disabled
myVoiceIt.createVideoEnrollment({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse);
});
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);
});
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);
});
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);
});
or with blinkDetection disabled
myVoiceIt.createFaceEnrollment({
userId: "USER_ID_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse);
});
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);
});
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);
});
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);
});
or with blinkDetection disabled
myVoiceIt.videoVerification({
userId: "USER_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse);
});
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);
});
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);
});
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);
});
or with blinkDetection disabled
myVoiceIt.faceVerification({
userId: "USER_ID_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse);
});
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);
});
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);
});
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);
});
or with blinkDetection disabled
myVoiceIt.videoIdentification({
groupId: "GROUP_ID_HERE",
contentLanguage : "CONTENT_LANGUAGE_HERE",
videoFilePath : "FULL_VIDEO_PATH",
doBlinkDetection: false
},(jsonResponse)=>{
console.log(jsonResponse);
});
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);
});
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);
});
Armaan Bindra, [email protected]
voiceit2-nodejs is available under the MIT license. See the LICENSE file for more info.