Build an AI-powered virtual agent for Genesys Cloud using QnABot and Amazon Lex

The rise of artificial intelligence technologies enables organizations to adopt and improve self-service capabilities in contact center operations to create a more proactive, timely, and effective customer experience. Voice bots, or conversational interactive voice response systems (IVR), use natural language processing (NLP) to understand customers’ questions and provide relevant answers. Businesses can automate responses to frequently asked transactional questions by deploying bots that are available 24/7. As a result, customers benefit from reduced wait time and faster call resolution time, especially during peak hours.

In the post Enhancing customer service experiences using Conversational AI: Power your contact center with Amazon Lex and Genesys Cloud, we introduced Amazon Lex support on the Genesys Cloud platform and outlined the process of activating the integration. In this post, we demonstrate how to elevate traditional customer service FAQs with an interactive voice bot. We dive into a common self-service use case, explore Q&A interactions, and offer an automated approach using QnABot on AWS Solution built on Amazon Lex with Genesys Cloud.

Solution overview

Informational interactions are widely applicable, with examples such as hours of operation, policy information, school schedules, or other frequently asked questions that are high volume and straightforward. The solution discussed in this post enables customers to interact with a voice bot backed by a curated knowledge base in a natural and conversational manner. Customers can get answers without having to wait for a human customer service representative, thereby improving resolution time and customer satisfaction. You can also implement the same bot directly as a web client, or embed it into an existing site as a chat widget, expanding touch points through multiple channels and increasing overall engagement with customers.

For a demo video describing the experience of a customer dialing into a contact center and interacting with QnABot, check out the below video:

QnABot provides a preconfigured architecture that delivers a low-code experience, as shown in the following diagram. Behind the scenes, it uses Amazon Lex along with other AWS services. Non-technical users can deploy the solution with the click of a button, build their bot through a user-friendly interface, and integrate the voice bot into a Genesys Cloud call flow.

solution workflow

The solution workflow contains the following steps:

  1. The admin deploys the QnABot solution into their AWS account, opens the Content Designer UI, and uses Amazon Cognito to authenticate.
  2. After authentication, Amazon CloudFront and Amazon Simple Storage Service (Amazon S3) deliver the contents of the Content Designer UI.
  3. The admin configures questions and answers in the Content Designer, and the UI sends requests to Amazon API Gateway to save the questions and answers.
  4. The Content Designer AWS Lambda function saves the input in Amazon OpenSearch Service in a questions bank index.
  5. The admin activates the Amazon Lex integration on Genesys Cloud, exports a sample flow from the Content Designer UI, and imports this flow into Genesys Cloud using the Genesys Archy tool.
  6. The customer dials into Genesys Cloud and begins an interaction with QnABot. Genesys Cloud streams this audio to Amazon Lex, which converts the audio to text and calls the Bot Fulfillment Lambda function.
  7. The Bot Fulfillment function takes the user input and looks up the answer in OpenSearch Service. Alternatively, you can use Amazon Kendra if an index is configured and provided at the time of deployment. The answer is synthesized into voice by Amazon Polly and played back to the customer.
  8. User interactions with the Bot Fulfillment function generate logs and metrics data, which are sent to Amazon Kinesis Data Firehose then to Amazon S3 for later data analysis.

To implement this solution, we walk through the following steps:

  1. Enable Amazon Lex V2 integration with Genesys.
  2. Configure Archy, the Genesys Cloud Architect YAML processor.
  3. Export the Genesys call flow from the QnABot Content Designer.
  4. Import and publish the call flow with Archy.
  5. Import example questions to QnABot.
  6. Create a test call and interact with the bot.
  7. Customize the call flow in Genesys Architect.

Prerequisites

To get started, you need the following:

Enable Amazon Lex V2 integration with Genesys Cloud

The first step is to enable Amazon Lex V2 integration with Genesys Cloud. For instructions, refer to Enhancing customer service experiences using Conversational AI: Power your contact center with Amazon Lex and Genesys Cloud.

Configure Archy

We have prepared a sample inbound call flow to get you started with QnABot and Genesys Cloud. We use Archy, the Genesys Cloud Architect YAML processor tool, to publish this call flow. You must first generate an OAuth client ID and client secret, then you can download and configure Archy.

Generate an OAuth client ID and client secret

Archy requires either a client ID and secret pair or an authorization token. For more information about Archy’s OAuth requirements, refer to Prerequisites in the Archy installation documentation.

To generate a client ID and secret pair, complete the following steps:

  1. On the Genesys Cloud Admin page, navigate to Integrations, then choose OAuth.
  2. Choose Add Client.
  3. For App Name, enter QnABot.
  4. For Description, enter a description.
  5. For Grant Types, select Client Credentials.

A new Roles tab appears.

configure OAuth

  1. On the Roles tab, assign a role that has Architect > flow > publish permissions.

In the following screenshot, we’re assigning the admin role. You may have to also assign the Master Admin role.

  1. Choose Save.

set up admin role

  1. On the Client Details tab, copy the values for the client ID and client secret.

configure client credential

Download and configure Archy

Download and unzip the appropriate version of Archy for your operating system. Then navigate to the folder in a terminal and begin the setup process by running the following command:

./archy setup

welcome page for Archy

Continue through the Archy setup, and provide the client ID and client secret when prompted.

Export the call flow YAML from the QnABot Content Designer

Now that Archy is authorized to publish call flows, we export the preconfigured call flow from the QnABot Content Designer.

  1. Log in to the QnABot Content Designer.
  2. On the Tools menu, choose Genesys Cloud.

Genesys Cloud in QnABot Content Designer

  1. Choose Next until you reach the Download Call Flow section.
  2. Choose Download Inbound Call Flow.

download call flow

You download a file named QnABotFlow.yaml, which is a preconfigured Genesys call flow.

  1. Copy this file to the same folder Archy is located in.

Import and publish the call flow with Archy

To publish the call flow to Archy, run the following command:

./archy publish --file QnABotFlow.yaml

When complete, a new inbound call flow named QnABotFlow is available in Genesys Architect.

import call flow into Architect

To assign this call flow, on the Genesys Cloud Admin page, navigate to Routing and choose Call Routing.

The new QnABotFlow should appear in the list of call flows under Regular Routing. Assign the flow, then choose Save.

configure call routing

Import example questions to QnABot

Navigate back to the QnABot Content Designer, choose the Tools menu, and choose Import.

import sample questions

Expand Examples/Extensions, find the GenesysWizardQnA example, and choose Load.

load sample questions

If you navigate back to the main questions and answers page, you now have the GenesysHelper questions. These are a set of example questions and answers for you to get started.

sample question overview

Create a test phone call and interact with the bot

Back to Genesys Cloud Admin, make sure you have an inbound phone number associated with the QnABotFlow call flow under Call Routing. We now navigate to the agent desktop and make a test call to interact with the bot for the first time.

configure test call

QnABot is designed to answer questions based on the data preconfigured in the Content Designer. Let’s try the following:

  • What is your business hour?
  • What is the meaning of life?

Each time QnABot provides an answer, you have the option to ask another question, conclude the call by saying “Goodbye,” or ask to be connected to a human agent by saying “I would like to speak to an agent.”

Customize the call flow with Genesys Architect

The Genesys call flow is preconfigured to enable specific Amazon Lex session attributes. For example, if you edit the question with ID GenesysHelper.Hours, the answer contains the following statement:

{{setSessionAttr 'genesys_nextPrompt' 'Do you want to know the hours for Seattle or Boston?'}}

This is based on Handlebars, and allows you to set values for session attributes. The exported Genesys Cloud CX call flow contains a block that reads back the value of the genesys_nextPrompt session attribute, which is only spoken by the Genesys call flow.

To branch to a queue or another call flow, a QnABot answer can use setSessionAttr to set genesys_nextAction to a specific value. An example of this is in the question with ID GenesysHelper.Agent, where the answer has {{setSessionAttr 'nextAction' 'AGENT'}}. In the call flow’s QnABot reusable task, there is a switch block that reads the value of this attribute to branch to a specific action. The example call flow contains branches for AGENT, MENU, and END. If there is no value for the genesys_nextAction session attribute, the call flow plays back any string found in the genesys_nextPrompt content, or the value of the defaultPrompt task variable defined at the beginning of the main flow, which is set by default to ask another question or say return to main menu.

The following diagram illustrates the main call flow.

primary call flow

The following diagram illustrates the flow of the reusable task.

reusable task

Clean up

To avoid incurring future charges, delete the resources created via the template by navigating to the AWS CloudFormation console, selecting the QnABot stack created by the template, and choosing Delete. This removes all resources created by the template.

To remove the resources in Genesys Cloud, first remove the call flow from call routing. Then delete the call flow from Genesys Architect.

Conclusion

In this post, we walked through how to get started with QnABot and Genesys Cloud with an easy-to-deploy, readily usable solution to address a transactional interaction use case. This voice bot frees your customer service representatives to spend time with your customers on more complex tasks, and provides users with a better experience through self-service. Customer satisfaction increases, while costs decrease, because you’re consuming fewer connected minutes and maximizing agent utilization.

To get started, you can launch QnABot with a single click and go through the QnABot Workshop to learn about additional features. Amazon Lex integration is available on Genesys AppFoundry.


About the Authors

Christopher Lott is a Senior Solutions Architect in the AWS AI Language Services team. He has 20 years of enterprise software development experience. Chris lives in Sacramento, California, and enjoys gardening, aerospace, and traveling the world.

Jessica Ho is a Solutions Architect at Amazon Web Services, supporting ISV partners who build business applications on AWS. She is passionate about creating differentiated solutions that unlock customers for cloud adoption. Outside of work, she enjoys turning her garden into a mini jungle.

Read More