This lab is provided as part of AWS Summit Online, click here to explore the full list of hands-on labs.
ℹ️ You will run this lab in your own AWS account. Please follow directions at the end of the lab to remove resources to avoid future costs.
In this lab, you will be building a contact center using Amazon Connect and integrating with Amazon Lex. Amazon Lex interprets dual-tone multi-frequency signaling (DTMF) digits entered on a keypad. It matches the intent based on that input in the same way it matches the intent when you speak an utterance. This provides for greater flexibility for customers to interact with your contact center.
Duration: Approximately 1 hour
Overview
- Launch AWS CloudFormation Stack
- Create Lex Chat Bot
- Create Amazon Connect Instance
- Amazon Connect Lex Integration
You will use AWS CloudFormation to deploy an AWS Lambda function in your AWS account. It will be deployed in the Sydney region. Please ensure you follow directions at the end of the lab to delete the CloudFormation stack to remove resources.
Amazon Lex is currently available in the N. Virginia, Oregon, Sydney and Ireland regions. Additional regions will be added in future.
1. Login to your AWS account.
2. Right-click this link and open in a new browser tab: Launch Stack into the Sydney Region with CloudFormation
The CloudFormation console will be displayed, with some information already entered.
3. Click Next three times.
4. At the bottom of the page, select "I acknowledge that AWS CloudFormation might create IAM resources".
5. Click Create stack.
This will create an AWS Lambda function that you will use with Amazon Lex. There is no need to wait, you can continue with the next steps.
You will now create a Lex Chat Bot that will be used to book appointments at a dental surgery. It will be capable of booking appointments for cleaning and whitening, and can also check and cancel appointments.
6. In the Services menu, click Amazon Lex.
7. Confirm that you are running in the Sydney region (shown in the top-right of the console). If a different region is showing, change to Sydney.
8. Click Get Started.
You will be presented with a "Create your bot" page. A number of sample bots are provided, but you will create your own custom bot.
9. Click Custom bot, then configure:
- Bot name:
BookAppointment
- Output voice: Salli
- Session timeout: 5 minutes
- COPPA: No
- Click Create.
You will now configure the intents for the Lex bot, which are the actions that the user can perform.
The first intent is for users to book an appointment.
10. Click + Create Intent, then:
- Click Create Intent
- Name:
BookAppointment
- Click Add
Slot Types are used to define special values that a user will provide. You will create an Appointment Type that will accept pre-defined values.
11. In the left navigation pane, beside Slot types click ⨁, then:
- Click Create slot type
- Slot type name:
AppointmentTypeValue
- Description:
Types of Appointments
- Values:
cleaning
whitening
- Click Save slot type
You will now define utterances, which are spoken or typed phrases that will invoke the intent.
12. In Sample utterances, enter the following phrases (press Enter after each one):
I want to book an appointment
Book Appointment
One
13. Expand Lambda initialization and validation, then:
- Select (turn on) Initialization and validation code hook
- Lambda function: lex-connect-book-appointment
- Click OK
This tells Lex to use the AWS Lambda function that you loaded at the start of the lab.
You will now define Slots, which tell Lex how to interpret user requests.
14. Create three slots as shown below (click ⨁ to save each one):
15. Select (turn on) Required for each of these slots (as shown in the picture).
16. Under Fulfillment:
- Select AWS Lambda function
- Lambda function: lex-connect-book-appointment
17. Click Save Intent (at the bottom of the page).
You will create another intend for checking appointments.
18. In the left navigation pane, beside Intents click ⨁, then:
- Click Create intent
- Name:
CheckAppointment
- Click Add
19. In Sample utterances, enter the following phrases (press Enter after each one):
two
check appointment
20. Under Fulfillment:
- Select AWS Lambda function
- Lambda function: lex-connect-book-appointment
(If a pop-up asks for confirmation of permissions, click OK.)
21. Click Save Intent (at the bottom of the page).
22. Click Build (in the top-right), then:
- Read the notice
- Click Build
- Wait until the build has finished (it will take about 30 seconds)
23. Click Publish (in the top-right), then:
- Create an alias:
BookAppointment
- Click Publish
- When it is finished, click Close
You will now use Amazon Connect to create a virtual contact center. It will use your Lex Bot to interact with callers.
24. In the Services menu, select Amazon Connect.
25. Click Get started, then configure:
- Access URL: Enter your initials and a random number (eg
jb642
) - Click Next step
- First/Last Name: Enter your name
- Username:
lab-admin
- Password:
ConnectLab1
- Email address: Enter your email address
- Click Next step
- Incoming calls: Yes
- Outgoing calls: No
- Click Next step twice
- Click Create instance
Wait until Amazon Connect finishes creating your virtual contact center.
26. Click the Amazon Connect AWS console link at the very bottom of the page.
27. Click the name of your Connect instance in the Instance Alias column.
28. In the left navigation pane, click Contact flows.
29. Under Amazon Lex:
- For Region, select Asia Pacific: Sydney (which is where you just created the Lex Bot)
- For Bot, select BookAppointment
- Click + Add Lex Bot (to right right of BookAppointment)
Note: It should now display the message "No Lex bots available to add" under the Bot field. If this message is not displayed, make sure you clicked the + Add Lex Bot link.
This tells Amazon Connect to use your Lex Bot to interact with users.
30. In the left navigation pane, click Overview.
31. Click Login as Administrator.
You will now configure the call flow that your callers will experience.
32. In the left navigation pop-out menu, choose Routing -> Contact flows.
33. Click Create contact flow.
34. Click Enter a name (in the top-left corner), then enter: Lex lab
35. Under Interact, drag a Get customer input block onto the designer.
36. Click the heading of the Get customer input block to display its settings, then:
- Select Text-to-speech or chat text
- Enter text:
To make an appointment, press or say 1. To check an appointment, press or say 2
37. Below that, click the Amazon Lex heading, then:
- Select an existing Lex bot: BookAppointment
- Alias:
BookAppointment
- Click Add an attribute
- Click Use attribute
- Destination key:
ContactNumber
- Type: System
- Attribute: Customer Number
- Click Add an intent then add
BookAppointment
- Click Add another intent then add
CheckAppointment
- Click Save
38. Connect the blocks by dragging a line from Entry Point - Start to the Get customer input block.
39. Under Interact, drag a Play prompt block onto the designer, then:
- Connect Default to Play Prompt
- Connect Error to Play Prompt
40. Click the title of the Play prompt block, then:
- Click Text-to-speech or chat text
- Enter text:
All of our agents are busy at the moment. Please call again.
- Click Save
41. On the left, expand Terminate/Transfer and drag Disconnect / hang up onto the designer, then:
- Connect it to the other blocks as shown:
42. Click Save (in the top right).
43. Click Publish, then click Publish.
44. In the left navigation pop-out menu, choose Routing -> Phone numbers.
45. Click Claim a number
46. Select a phone number in a location of your choice.
47. Towards the bottom of the page, for Contact flow / IVR select Lex Lab.
48. Click Save. It will take a few minutes for the Contact Flow to be effective.
Use your phone to call the number you claimed, and follow the prompts.
- Make an appointment. You should receive an SMS reminder.
- Call again, then check the appointment. Connect recognises your phone number automatically.
Once you have finished testing the lab, follow these instructions to delete the resources from your AWS account. This will avoid any future costs for the services uses.
49. To release the number you claimed:
- Select the phone number and click Release
50. Close the Amazon Lex administrator browser tab (with the blue cloud icon)
51. Return to the Amazon Connect management console browser tab (with the orange cube icon), then:
- In the left navigation pane, click Amazon Connect (above Overview)
- Select (tick) the Instance Alias (tick the box, do not click the link)
- Click Remove
- You will be asked to type the name of your instance to confirm deletion
52. In the Services menu, select Amazon Lex.
53. Click BookAppointment, then:
- Click the Settings tab
- Delete ⨂ the BookAppointment alias
54. Click the left arrow in the top-left corner to return to the Lex dashboard.
55. Click the ⃝ circle beside BookAppointment, then:
- In the Actions menu, click Delete
- Click Continue
56. In the left navigation pane, click Intents, then:
- Delete both intents
57. In the left navigation pane, click Slot types, then:
- Delete the displayed slot type
58. In the Services menu, select CloudFormation, then:
- Delete the LexFunction stack.