Guided Integration of voice verification solution (VoiceIt) into BPCC using AWS Lambda

In our previous post, we discussed the benefits of Lambda through the use case of voice verification. Let’s look at the steps involved to build a short demo together. First, you’ll need administrator access to Bright Pattern Contact Center, an AWS account, and a VoiceIt account. If any of those platforms are new, it could be beneficial to take a few moments to familiarize yourself with them before continuing.

We’re going to be working in Python. It’s a well known language with the functionality we need, and supported by VoiceIt. It’s also very readable, so even if you haven’t coded much, it will make some sense. Feel free to use another language if it’s more suitable for you, but the guide will be following steps in Python.

Let’s start with VoiceIt. Go to the API documentation here, and see the different methods we will be calling and how voice verification works. We want the voiceit2 module available in lamba, so use your IDE or pip to download it and all dependencies to a folder and zip it.


We’ll want to keep those tabs to VoiceIt open for reference. But now switch over to the Lambda by logging into AWS and finding the link to it. Let’s create a function, select from scratch, choose your language (we’re using Python 3.8 as of this writing) and name your function. We’ll start with creating a user, so consider naming it something along those lines. You’ll start with a HelloWorld function that looks something like this:

Notice the red box around upload from, that’s what we’ll use to bring our voiceit2 module into our python environment. Go ahead and upload the zip file from the previous step. Depending on how you organized the dependencies, you may have to move some files to the top level. You’ll also need to create a file called, which was there initially but every upload overwrites the environment entirely. This is the entry function Lambda will look for when called. When completed, your environment will look like this:

So our dependency folders now reside in the top level directory, which is the function name, along with,, and

Let’s copy and paste the following few lines of code and go over them together:

import json
from voiceit2 import VoiceIt2

def lambda_handler(event, context):

my_voiceit = VoiceIt2( event['key'], event['tok'] )

response = my_voiceit.create_user()

return {
    'statusCode': response['status'], 
    'userID': response['userId']

The first two lines we’re importing python modules into our method. The method, lambda_handler, is expected by AWS Lambda. The event parameter contains all of our user defined information that can be passed to the function, while context gives us important runtime information.

Next we’ll create a VoiceIt2 object with basic authentication. Our key and token will be passed through the event as a JSON file, and python allows us to access it like a dictionary. Next we’ll create a user, and then return the results. The VoiceIt API documentation goes over what status codes are expected. In a more complete example, we can check those codes and do error handling.

To test our method, we’ll create a test event and deploy the environment and function to the cloud. Look below at where we’ll complete those tasks:


Click the deploy button, and then go to configure a test event. Your event should have two entries, the access token and key, both of which can be found via the VoiceIt console. It should look like what follows, except you our example is hiding the actual key/token values:

Afterwards you should be able to run the test, see the results, and find a created user in VoiceIt. The next step is to use this inside a Bright Pattern Contact Center scenario or workflow. In the picture below, on the far left panel we can see the Lamba call as an option in the builder. In the middle panel, we can see that we’re using it inside our scenario. In the right panel, we can see the fields we’ve filled out to use it. We’ve given the block an appropriate title, CreateUser. We’ve selected our integration account. Then we have the exact name of our function we just created, viCreateUser. We will add two fields to the call, which will be passed into the function as JSON to the event object, our key and token. The response is the standard HTML response, and payload is the status and userID that we are returning from Lambda.

You’re ready to start working with AWS Lambda and VoiceIt or other platforms in BP Contact Center. If you haven’t configured an AWS integration account previously, see our documentation here for setting one up.

Download VoiceIt, Lambda, and Scenario Files

Thank you and we’re excited to hear more about your creations using AWS Lambda!