Secure your VoiceWorx App with Multi-Factor Authentication
Last updated
Last updated
This document will demonstrate how to use the Custom Skill feature of the VoiceWorx platform with Multi-Factor Authentication (MFA) support.
The VoiceWorx platform can integrate with external platform via web API’s. To demonstrate this capability, a demo API endpoint has been created (https://demo.voiceworx.ai/api/Contacts) in our demo web app “demo.voiceworx.ai”. Multiple API endpoints have been created for Contacts module and will be using the endpoint that searches an underlying Contacts database and returns the contact number of a specific person.
The demo web app created has the ability to perform CRUD operations against the underlying Contacts database that is triggered by calls to the exposed contact API’s in demo.voiceworx.ai
Web App URL : http://demo.voiceworx.ai
Contact Finder : https://demo.voiceworx.ai/api/Contacts?Name={Name}
Here is a sample contact in the database.
Our goal is to demonstrate the capability of the VoiceWorx platform to integrate with external platforms and perform CRUD operations against them via web API calls with support for MFA. In this Alexa Skill it is called “Contact Finder”. This Alexa app will look up and return a person’s number that is stored in the contacts database and is accessible via the contacts API endpoints in demo.voiceworx.ai. The skill will be protected via a pin code sent to the users that invoked the skill’s phone and email. The MFA prevents unauthorized personnel from accessing the information provided by the skill. When a contact is asked and user has not authenticated with a PIN code, a 4-digit code is sent to the users email and phone number. When the correct pin code is provided by the user while interacting with the skill, access is granted but the PIN code is valid for five minutes. If a user does not interact with the skill within 5 minutes, on next interaction, a PIN code is regenerated and resent to the users email and phone number.
Note: the example uses Basic Authentication so username/passwords to the external resource is required.
The following shows the general steps/activities that will be carried out in setting up this integration. Note: It is advisable to use same email for signup across the 3 channels below. Step 1 -3 below are compulsory.
Ensure you Login With Amazon (LWA) https://developer.amazon.com/alexa/console/ask account is setup by your admin. If you are the account admin, you can follow this instruction to set it up.
Set up connection to the external web API
Create a custom skill in Voiceworx.
Publish the skill
Test the Alexa skill.
Login to the VoiceWorx platform, use left navigation menu and click “Integration” then select “Connect System”. In the resulting page, click “Connect External Systems”.
In “Connect External System” select or do the following:
Select Integration Category: Custom
Select System Type: Rest API Service
Click: Connect System.
Once in “Rest API Service Setup” select or enter the following:
System Instance Name: ContactFinder
Authorization Type: Basic Auth
Add Web API URL: https://demo.voiceworx.ai
Under Basic Auth Settings
Enter Username and Password
Click: Validate System to ensure you have access to the web API endpoint.
To create a custom skill, use left navigation menu and click “Custom Skills” then select “Manage Skills”. Then click “Create New Custom Skill”.
Now add Custom Skill by entering or selecting the following:
Name: Contact Finder
Custom Skill Type: Search
Category: None
Click: Save
In the top menu tabs, select “Data Sources” then “Create New Data Source”. Select or enter the following:
Name: ContactFinderDS
Integration Configuration: Rest API Service: ContactFinder
Manage Connections to create the external platform WebAPI integration
Click: Save
In the top menu tabs, select “Methods” then select “Create New Methods”. Then select or enter the following:
Name: GetPhoneNumberByName
Request Type: GET
Query Path: ?name={{Person}}
Result Type: Record
Method Path: /api/contacts
Method Result-Empty Result Template: Phone Number Not Found For Requested Contact
Result Template: {{Person}} phone number is {{Phone}}
Click: Save
In the top menu tabs, select “Intents” and “Create New Intent”. Then select or enter the following:
Name: GetPhoneNumberByName
Intent Type: Search
Intent Action: Executive Method
DataSource: ContactFinderDS
DataSource Method: GetPhoneNumberByName
Click: Save
In the top menu tabs, select “Slots” and select “Create New Slot”. Note the Reprompt message is what Alexa will ask if it can’t fill/resolve the person slot. Then select or enter the following:
Name: Person
Slot Order: Blank
Reprompt Message: What is the person name
Type: Person
Custom Skill: ContactFinder
Intent: GetPhoneNumber
Click: Save
In the top menu tabs, select “Utterance” and select “Create New Utterance”. Utterance are words spoken to launch specific intents. Now input or select the following:
Value: What is the phone number for (Person)
Custom Skill: ContactFinder
Intent: GetPhoneNumber
Click: Save
In the top menu tabs, select “Input” and select “Create New Input”. Then input or select the following:
Name: Person
Custom Skill: ContactFinder
Custom Intent: GetPhoneNumber
Data Source: ContactFinderDS
Data Source Method: GetPhoneNumberByName
In the top menu tabs select “Publish” then click “Add Skill Publishing”. Then enter or select the following:
External Skill Name: ContactFinder. (This will be the name of the skill in Alexa. Therefore, make it unique and different from the names of your other skills in Alexa.)
Skill Type: Select Search
Channel: Select Alexa
Uncheck the following: Require account linking, Auto Publish
Skill Invocation Name: ContactFinder. (This will be what users say to launch your skill in Alexa. It must be in lower case alphabets cannot contain START, BEGIN, STOP, EXIT, LAUNCH and cannot contain number or special characters.)
Optional: Replace all placeholder values in all “Message”. Uncheck all the settings shown in the second image below except the Enable MFA check box
Click: Save.
A slot named “Pin” will automatically be added for all intents.
In the top menu tabs select “Publish” then click “Publish to Alexa”.
Once in Publish Skill to Amazon Alexa select and do the following:
Selected Skill: Contact Finder
Select Amazon Account: LWA Config
Select the LWA account setup by your admin or the one you set up in step 4 above.
Click: Publish To Alexa
On the resulting screen, ensure that a success message shows for the publishing steps before clicking the “Go To Alexa Skill”. If success message not shown, click “Go To Skill Publishing” to fix any issue shown in publishing result.
On the Alexa skill page, ensure “Full Build Successful” message is shown in bottom right corner before starting to test skill.
Go to “test” tab in the top menu, then below “test” tab change the skill test status from “Off” to “Development”.
Invoke skill by typing the invocation name (Contact Finder) inserted in the publishing step in Voiceworx. If the invocation is successful, your configured welcome message will be displayed in the developer console.
Invoke an intent and a pin will be requested
Congratulations!
You have successfully completed a Secure your VoiceWorx Skill
with Multi-Factor Authentication.