Written By: Rachana Sharma, Software Engineer, Powerupcloud Technologies
Ever since AWS Connect was announced, we have been waiting for an excuse to get our hands on it and put it to use for solving a real-world use case. Soon enough, we were presented with the opportunity to automate voice-based IVR support for a large government entity in Singapore.
Regular readers of this blog might be aware that we have a thriving enterprise chatbot platform, Botzer.io and our product are used by multiple enterprise customers. So with the experience of deploying chatbots under our belt, when we ran into something like AWS Connect, it made perfect sense to integrate with Lex to automate voice-based IVR customer support. Why settle for text when you can make them bots talk 😉
That’s exactly what we did and this post explains how we made Connect, AWS Lambda, and Lex work together along with our Botzer engine at a high level.
Some of the queries handled by our final deployed solution are below:
- Verifying user’s identity using NRIC number from the database
- Verifying user’s mobile number using OTP authentication
- Providing user a personalized response post verification
- Allowing user to make transactions
AWS Connect And Contact Flows
After you set up your first AWS connect instance (tip: go through this video)you will be able to make calls to a customer care solution. Every activity on AWS connect including the IVR played is a contact flow. A contact flow is an editable roadmap directing the customer experience of the contact center. You can edit all contact flows in the contact flow module of the Routing menu.
The first Contact flow played as IVR to the user is Sample inbound flow (first call experience). You can edit this flow to put customized flows in IVR.
- Edit Get customer input module: The Sample IVR gives you 7 predefined options. we have reduced it to 4 DTMF input where each will perform specific operations. After you edit this module by double-clicking you can see an output connection for branching all 4 respective options.
- For each of the specified DTMF input, we have used the transfer to flow module in Transfer/Terminate menu. We can edit a transfer to flow to specify the contact flow name to be called when the respective button is pressed. The flow needs to be published so that it comes in the search menu to select a flow option.
Enable call recording: The module is available in the Set section of flow modules. We can edit call recording behaviour by double-clicking the module and choosing one of the following:
- Agent and Customer
- Agent only
- Customer only
This will save your recording in the S3 bucket mentioned in the setting of the AWS connect Data storage section.
Store customer input to Contact attribute:
We can store customer’s input to contact attribute using store customer input module in interact section. You need to specify text for which user will type this value. This value will get saved as a system attribute. We can use the Set Contact attributes module to assign a key to this value so that we pass this key as an attribute other Lambda, Lex modules or use it in other contact flows.
Lambda Integration with Connect
Amazon Connect can successfully invoke a Lambda function in an AWS account when a resource policy has been set on the Lambda function. you can follow this link to set a resource policy for lambda and see sample request response from lambda to AWS connect.
Use Case: Buy CDP data
- This contact flow Calls lambda function to send OTP: We need to give full ARN of Lambda function. We are sending the user’s mobile number as a system attribute and NRIC number as a user-defined attribute( Taken from the first flow from a user) to lambda.
Lambda will get an event with a mobile number in it and make a rest call to send OTP to the user. We are using the AWS SNS service to send a message to the mobile. We can avoid using REST and put all the code in Lambda if we make a deployment package. Details of creating a deployment package here.
Following is the code for sending the OTP:
2) After the Lambda function sends an OTP to the user’s mobile IVR will ask for verification: Aws connect can take a user’s input in Store Customer input block of interact menu. We can branch the activity further based on the customer’s input using Check contact attribute module in the Branch menu. Here we are, authentication users, if the user types the correct OTP otherwise returning him to the main flow with a failed authentication message.
Lex integration with AWS connect
Amazon Lex is a service for building conversational interfaces using voice and text. By integrating these two services you can take advantage of Lex‘s automatic speech recognition (ASR) and natural language processing/understanding (NLU) capabilities to create great self-service experiences for your customers.
Use Case Opening of a CDP account
- We need to first add our Lexbot to connect to start using it in our Contact flows. To do this from the AWS console we need to go to our AWS instance settings and add bots in contact flows section.
- We can start building a contact flow by dragging Get customer Input from the interact menu. After dragging double click on the block and set the input to Amazon Lex and specify the name and Alias. you can also send a session attribute to the bot.
- We have created a Lex bot that will trigger for slots if the intent of the user is “open CDP account”. On fulfilment of all the required slots, Lex will call the Lambda function to connect integration.
- The Lambda function will fetch the slot values from the event sent and make a POST call to REST API which will insert a record of the user in DB and send an Email to the customer with his details using AWS SES service.
On successful execution of Lambda flow will be transferred again from lex to aws connect.
We will soon publish the relevant code used for this on GitHub and update this post.
Hope you found this useful. Happy customer servicing! 🙂