Latest 0.4
Homepage https://github.com/voiceittech/VoiceItApi2IosSDK
License MIT
Platforms ios 8.0
Frameworks UIKit, AVFoundation
Authors

Version
License
Platform

VoiceIt API 2.0 iOS SDK

A library that gives you access to the VoiceIt’s New VoiceIt API 2.0 featuring Voice + Face Verification and Identification right from your iOS app.

Getting Started

Get a Developer Account at VoiceIt and activate API 2.0 from the settings page, you should now be able view the API Key and Token (as shown below). Also review the HTTP Documentation at api.voiceit.io. All the documentation shows code snippets in both Swift 3 and Objective-C.

API Key and Token

Installation

VoiceItApi2IosSDK is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "VoiceItApi2IosSDK"

and then run pod install in your terminal

pod install

Also add the following permission keys to your info.plist file like shown below:

  • NSCameraUsageDescription – Needed for Face Biometrics
  • NSMicrophoneUsageDescription – Needed for Voice Biometrics

API Key and Token

API Calls

Initialization

Swift

First import VoiceItApi2IosSDK into your Swift file then initialize a reference to the SDK inside a ViewController passing in a reference to the ViewController as the first argument

import VoiceItApi2IosSDK

class ViewController: UIViewController {
    var myVoiceIt:VoiceItAPITwo?

    override func viewDidLoad() {
        super.viewDidLoad()
        /* Reference to ViewController and API Credentials */
        myVoiceIt  = VoiceItAPITwo(self, apiKey: "API_KEY_HERE", apiToken: "API_TOKEN_HERE")
    }
}

Objective-C

First import VoiceItAPITwo.h into your Objective-C file, then initialize a reference to the SDK inside a ViewController passing in a reference to the ViewController as the first argument

#import "ViewController.h"
#import "VoiceItAPITwo.h"

@interface ViewController ()
    @property VoiceItAPITwo * myVoiceIt;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    /* Reference to ViewController and API Credentials */
    _myVoiceIt = [[VoiceItAPITwo alloc] init:self apiKey:@"API_KEY_HERE" apiToken:@"API_TOKEN_HERE"];
}

User API Calls

Get All Users

Get all the users associated with the apiKey

Swift
myVoiceIt?.getAllUsers({
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt getAllUsers:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Create User

Create a new user

Swift
myVoiceIt?.createUser({
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt createUser:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Get User

Check whether a user exists for the given userId(begins with ‘usr_’)

Swift
myVoiceIt?.getUser("USER_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt getUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Get Groups for User

Get a list of groups that the user with given userId(begins with ‘usr_’) is a part of

Swift
myVoiceIt?.getGroupsForUser("USER_ID_HERE", callback: {
                jsonResponse in
                print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt getGroupsForUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Delete User

Delete user with given userId(begins with ‘usr_’)

Swift
myVoiceIt?.deleteUser("USER_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt deleteUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Group API Calls

Get All Groups

Get all the groups associated with the apiKey

Swift
myVoiceIt?.getAllGroups({
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt getAllGroups:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Create Group

Create a new group with the given description

Swift
myVoiceIt?.createGroup("A Sample Group Description", callback: {
    jsonResponse in
})
Objective-C
[_myVoiceIt createGroup:@"A Sample Group Description" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Get Group

Returns a group for the given groupId(begins with ‘grp_’)

Swift
myVoiceIt?.getGroup("GROUP_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt getGroup:@"GROUP_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", 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

Swift
myVoiceIt?.deleteUser("USER_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt deleteUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Group Exists

Checks if group with given groupId(begins with ‘grp_’) exists

Swift
myVoiceIt?.groupExists("GROUP_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt groupExists:@"GROUP_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Add User to Group

Adds user with given userId(begins with ‘usr‘) to group with given groupId(begins with ‘grp‘)

Swift
myVoiceIt?.addUser(toGroup: "GROUP_ID_HERE", userId: "USER_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt addUserToGroup:@"GROUP_ID_HERE" userId:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
            NSLog(@"JSONResponse: %@", jsonResponse);
}];

Remove User from Group

Removes user with given userId(begins with ‘usr‘) from group with given groupId(begins with ‘grp‘)

Swift
myVoiceIt?.removeUser(fromGroup: "GROUP_ID_HERE", userId: "USER_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt removeUserFromGroup:@"GROUP_ID_HERE" userId:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Enrollment API Calls

Get All Enrollments for User

Gets all enrollment for user with given userId(begins with ‘usr_’)

Swift
myVoiceIt?.getAllEnrollments(forUser: "USER_ID_HERE", callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt getAllEnrollmentsForUser:@"USER_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Delete Enrollment for User

Delete enrollment for user with given userId(begins with ‘usr_’) and enrollmentId(integer)

Swift
myVoiceIt?.deleteEnrollment(forUser: "USER_ID_HERE", enrollmentId: "ENROLLMENT_ID_HERE", callback: {
    jsonResponse in
})
Objective-C
[_myVoiceIt deleteEnrollmentForUser:@"USER_ID_HERE" enrollmentId:@"ENROLLMENT_ID_HERE" callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
}];

Create Audio Enrollment

Create audio enrollment for user with given userId(begins with ‘usr_’) and contentLanguage(‘en-US’,’es-ES’ etc.). Note: Immediately upon calling this method it records the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be added as an enrollment and returns the result in the callback

Swift
myVoiceIt?.createAudioEnrollment("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", recordingFinished: {
    print("Audio Enrollment Recording Finished, now waiting for API Call to respond")
}, callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt createAudioEnrollment:@"USER_ID_HERE" contentLanguage: @"CONTENT_LANGUAGE_HERE" recordingFinished:^(void){
    NSLog(@"Audio Enrollment Recording Finished, now waiting for API Call to respond");
} callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
} ];

Create Video Enrollment

Create video enrollment for user with given userId(begins with ‘usr_’) and contentLanguage(‘en-US’,’es-ES’ etc.). Note: Immediately upon calling this method it displays the camera and starts recording a video of the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be added as an enrollment and returns the result in the callback

Swift
myVoiceIt?.createVideoEnrollment("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", recordingFinished: {
    print("Video Enrollment Recording Finished, now waiting for API Call to respond")
}, callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt createVideoEnrollment:@"USER_ID_HERE" contentLanguage: @"CONTENT_LANGUAGE_HERE" recordingFinished:^(void){
    NSLog(@"Video Enrollment Recording Finished, now waiting for API Call to respond");
} callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
} ];

Audio Verification

Verify user with the given userId(begins with ‘usr_’) and contentLanguage(‘en-US’,’es-ES’ etc.). Note: Immediately upon calling this method it records the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be verified and returns the resulting confidence in the callback

Swift
myVoiceIt?.audioVerification("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", recordingFinished: {
    print("Audio Verification Recording Finished, now waiting for API Call to respond")
}, callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt audioVerification:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" recordingFinished:^(void){
    NSLog(@"Audio Verification Recording Finished, now waiting for API Call to respond");
} callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
} ];

Video Verification

Verify user with given userId(begins with ‘usr_’) and contentLanguage(‘en-US’,’es-ES’ etc.). Note: Immediately upon calling this method it displays the camera and starts recording a video of the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be added as an enrollment and returns the result in the callback

Swift
myVoiceIt?.videoVerification("USER_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", recordingFinished: {
    print("Video Verification Recording Finished, now waiting for API Call to respond")
}, callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt videoVerification:@"USER_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" recordingFinished:^(void){
    NSLog(@"Video Verification Recording Finished, now waiting for API Call to respond");
} callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
} ];

Audio Identification

Identify user inside group with the given groupId(begins with ‘grp_’) and contentLanguage(‘en-US’,’es-ES’ etc.). Note: Immediately upon calling this method it records the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, then it sends the recording to be identified and returns the found userId and confidence in the callback

Swift
myVoiceIt?.audioIdentification("GROUP_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", recordingFinished: {
    print("Audio Identification Recording Finished, now waiting for API Call to respond")
}, callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt audioIdentification:@"GROUP_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" recordingFinished:^(void){
    NSLog(@"Audio Identification Recording Finished, now waiting for API Call to respond");
} callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
} ];

Video Identification

Identify user inside group with the given groupId(begins with ‘grp_’) and contentLanguage(‘en-US’,’es-ES’ etc.). Note: Immediately upon calling this method it displays the camera and starts recording a video of the user saying their VoicePrint phrase for 5 seconds calling the recordingFinished callback first, , then it sends the recording to be identified and returns the found userId and voice and face confidence in the callback

Swift
myVoiceIt?.videoIdentification("GROUP_ID_HERE", contentLanguage: "CONTENT_LANGUAGE_HERE", recordingFinished: {
    print("Video Identification Recording Finished, now waiting for API Call to respond")
}, callback: {
    jsonResponse in
    print("JSON RESPONSE: (jsonResponse!)")
})
Objective-C
[_myVoiceIt videoIdentification:@"GROUP_ID_HERE" contentLanguage:@"CONTENT_LANGUAGE_HERE" recordingFinished:^(void){
    NSLog(@"Video Identification Recording Finished, now waiting for API Call to respond");
} callback:^(NSString * jsonResponse){
    NSLog(@"JSONResponse: %@", jsonResponse);
} ];

Author

armaanbindra, [email protected]

License

VoiceItApi2IosSDK is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "VoiceItApi2IosSDK",
    "version": "0.4",
    "summary": "A pod that lets you add voice and face verification and identification to your iOS apps, brought to you by VoiceIt",
    "description": "A pod that lets you add voice and face verification and identification to your iOS apps, brought to you by VoiceIt. Please visit https://voiceit.tech to learn more and sign up for an account.",
    "homepage": "https://github.com/voiceittech/VoiceItApi2IosSDK",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "armaanbindra": "[email protected]"
    },
    "source": {
        "git": "https://github.com/voiceittech/VoiceItApi2IosSDK.git",
        "tag": "0.4"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "VoiceItApi2IosSDK/Classes/**/*",
    "frameworks": [
        "UIKit",
        "AVFoundation"
    ]
}

Pin It on Pinterest

Share This