├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── lab1-Building_Chat_Bots_With_Lex ├── README.md ├── images │ ├── Picture01.png │ ├── Picture02.png │ ├── Picture03.png │ ├── Picture04.png │ ├── Picture05.png │ ├── Picture05b.png │ ├── Picture06.png │ ├── Picture06b.png │ ├── Picture07.png │ ├── Picture08.png │ ├── Picture08b.png │ ├── Picture09-testbot.png │ ├── Picture09.png │ ├── Picture10-responsecard.png │ ├── Picture10.png │ ├── Picture11.png │ ├── Picture12.png │ ├── Picture13.png │ ├── Picture13b.png │ ├── Picture14.png │ ├── Picture15.png │ └── lex.png └── myPersonalBanker_v1.js └── lab2-Building_Connect_Call_Center ├── Advanced_Workflow ├── Lex_WorkFlow ├── README.md ├── Simple_Workflow ├── images ├── Picture01.png ├── Picture01b.png ├── Picture02.png ├── Picture03.png ├── Picture04.png ├── Picture05.png ├── Picture06.png ├── Picture07.png ├── Picture08.png ├── Picture09.png ├── Picture10.png ├── Picture11.png ├── Picture12.png ├── Picture13.png ├── Picture14.png ├── Picture15.png ├── Picture15b.png ├── Picture15c.png ├── Picture16.png ├── Picture17.png ├── Picture18.png └── Picture19.png └── myPersonalResponder_v1.js /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Issue #, if available:* 2 | 3 | *Description of changes:* 4 | 5 | 6 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # IDEs and editors 33 | .idea 34 | .project 35 | .classpath 36 | .c9/ 37 | *.launch 38 | .settings/ 39 | *.sublime-workspace 40 | 41 | # IDE - VSCode 42 | .vscode/* 43 | !.vscode/settings.json 44 | !.vscode/tasks.json 45 | !.vscode/launch.json 46 | !.vscode/extensions.json 47 | 48 | # misc 49 | .sass-cache 50 | connect.lock 51 | typings 52 | 53 | # Logs 54 | logs 55 | *.log 56 | npm-debug.log* 57 | yarn-debug.log* 58 | yarn-error.log* 59 | 60 | 61 | # Dependency directories 62 | node_modules/ 63 | jspm_packages/ 64 | 65 | # Optional npm cache directory 66 | .npm 67 | 68 | # Optional eslint cache 69 | .eslintcache 70 | 71 | # Optional REPL history 72 | .node_repl_history 73 | 74 | # Output of 'npm pack' 75 | *.tgz 76 | 77 | # Yarn Integrity file 78 | .yarn-integrity 79 | 80 | # dotenv environment variables file 81 | .env 82 | 83 | # next.js build output 84 | .next 85 | 86 | # Lerna 87 | lerna-debug.log 88 | 89 | # System Files 90 | .DS_Store 91 | Thumbs.db 92 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check [existing open](https://github.com/aws-samples/amazon-lex-connect-workshop/issues), or [recently closed](https://github.com/aws-samples/amazon-lex-connect-workshop/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *master* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws-samples/amazon-lex-connect-workshop/labels/help%20wanted) issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](https://github.com/aws-samples/amazon-lex-connect-workshop/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | 61 | We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes. 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build an Amazon Connect Call Center 2 | 3 | ## Lab Overview 4 | 5 | In this workshop, you will initially build a very simple example of a flow for customer service chatbot for a fictitious FinTech company using Amazon Lex. Once you have built the chatbot you will integrate it with Amazon Connect to create a call center workflow. 6 | 7 | Whilst it is possible to do Lab 1 without completing Lab 2 a large amount of the second lab is dependent on having completed the first lab. 8 | 9 | ## Prerequisites 10 | 11 | In order to complete this workshop you'll need an AWS Account with sufficient permission to create AWS IAM, Amazon Lex, Amazon Connect, AWS Lambda resources. 12 | 13 | Please ensure you follow the instructions regarding the Regions to deploy your Amazon Lex code 14 | 15 | ## The Labs 16 | 17 | * [Lab 1](./lab1-Building_Chat_Bots_With_Lex/README.md) - Building your first Amazon Lex chatbot 18 | * [Lab 2](./lab2-Building_Connect_Call_Center/README.md) - Creating your first call center using Amazon Connect 19 | 20 | ## Questions and Contact 21 | 22 | For questions on the AWS Lex Connect Workshop, or to contact the team, please leave a comment on GitHub. 23 | 24 | ## Cleanup 25 | 26 | To clean up all the resources created in this workshop: 27 | 28 | * If you have created an Amazon Connect instance, go to Amazon Connect console, select the instance and click Remove 29 | * Delete the Amazon Lex bot in the Amazon Lex Console 30 | 31 | ## License 32 | 33 | This sample code is made available under the MIT-0 license. See the LICENSE file. -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/README.md: -------------------------------------------------------------------------------- 1 | **Last Updated:** April 2019 2 | 3 | # Building Chatbots with Amazon Lex 4 | 5 | ## Overview 6 | 7 | Amazon Lex is a service for building conversational interfaces into any application using voice and text. Amazon Lex provides the advanced deep learning functionalities of automatic speech recognition (ASR) for converting speech to text, and natural language understanding (NLU) to recognize the intent of the text, to enable you to build applications with highly engaging user experiences and lifelike conversational interactions. With Amazon Lex, the same deep learning technologies that power Amazon Alexa are now available to any developer, enabling you to quickly and easily build sophisticated, natural language, conversational bots ("chatbots"). This lab is designed to demonstrate how to create a new bot including defining intents and slots. This lab will walk you through the following: 8 | 9 | - Creating a Lex bot 10 | - Adding intents 11 | - Adding slot types 12 | - Using AWS Lambda as the back-end logic for Lex 13 | 14 | # Step 1: Create the bot 15 | 16 | 1. Log in to the [AWS console](https://console.aws.amazon.com/lex/home) and navigate to the Amazon Lex service 17 | 2. **Please ensure you have selected North Virginia as the region in the top right (Amazon Connect is not available in all regions yet)** 18 | 3. If you have never created a bot, click "Get Started" 19 | 4. Choose "Custom bot", which will display a dialog asking you to defined your bot 20 | 5. Our bot name will be "PersonalBanker" 21 | 6. Choose your preferred output voice 22 | 7. Session timeout should be 5 minute 23 | 8. Choose "No" to the Children's Online Privacy Protection Act (COPPA) question 24 | 25 | The form should now look as follows, noting that we're going to accept the default IAM role. 26 | 27 | ![Create your Lex bot](images/Picture01.png) 28 | 29 | 8. Click "Create" 30 | 9. We will start by creating an intent, which represents an action that the user wants to perform. For example, we're going to create one intent in this lab for "Get Balance Check" ; (If you have time afterwards you can create a separate intent for getting last transaction) Click the "Create Intent" button. 31 | 10. In the window that pops-up click the "Create intent" link 32 | 33 | ![Add intent](images/Picture02.png) 34 | 35 | 11. Our first intent enables the user to get account details, so name this intent "GetBalanceCheck" then click "Add". 36 | 37 | ![Create intent](images/Picture03.png) 38 | 39 | 12. We now want to provide samples of what our user would type or say to perform this action (i.e. to activate this intent). Under "Sample utterances", type the below phrases and hit [enter] or click the blue "+" sign after each phrase. Make sure you do not add a question mark at the end of the phrase as this will cause build issues later on. 40 | 41 | - _Check my bank balance_ 42 | - _how much money is in my account_ 43 | - _how much money do i have_ 44 | 45 | 46 | ![Sample utterance](images/Picture04.png) 47 | 48 | 13. Next we define a slot which is information we need to process the users request. This information can be included in the utterance (query) that the user types or says, and if not included, Lex will prompt the user for the information. While Lex includes many built-in slot types (such as number, colour, city, food, etc), in this case we want to define a custom slot to get the account type that the user is referring to. 49 | 50 | Click on the blue "+" sign next to "Slot types" on the left hand side of the screen and select the "Create slot type" link - note, "Slot types" is initially greyed out, and on some laptop screens may not be obvious 51 | ![Add slot type](images/Picture05b.png) 52 | 53 | 14. Click create slot type 54 | ![Add slot type](images/Picture05.png) 55 | 56 | 14. For 'Slot type name' enter "AccountType" and optionally enter a description (although description is not required) 57 | 58 | 15. Select restrict to Slot values and Synonyms 59 | 60 | 16. For Value, we want to allow the user to make queries against either their "Saving" or "Current" account so enter those as values, clicking the blue "+" sign after each word. 61 | 62 | ![Create slot AccountType](images/Picture06b.png) 63 | 64 | 16. Click "Add slot to intent" 65 | 17. We now have to link the slot types to the Intent with additional information such as whether it is required or not and the prompt to use (ie how Lex will ask?) Enter 'What type of account do you have (current or saving?)'. 66 | 67 | In the existing Slot list change the "Name" field from "slotOne" to "AccountType" so that it matches the slot name that we specified when we created the sample utterences. 68 | 69 | 18. Specify "What type of account do you want to check (Current or Savings)?" for the "Prompt" field. This prompt will be used by our bot if the user does not specify an account type when asking a question. 70 | 71 | ![Prompt for AccountType](images/Picture07.png) 72 | 73 | 19. We are now going to ask a security follow up question and ask the user to enter their four digit pin number. 74 | 75 | Add another slot and add the name as "PinNumber". Select the slot type AMAZON.FOUR_DIGIT_NUMBER and add the prompt as "what is your pin number for your {AccountType} account". Ensure you click on the plus icon to add your new slot. 76 | 77 | ![Prompt for AccountType](images/Picture08b.png) 78 | 79 | It is worth noting as you build other intents you can modify the order of the Slot collection (ie what questions get asked in which order) and also whether or not the slot is "Required" before passing the values to our external function. 80 | 81 | 1. Scroll down and click "Save Intent" 82 | 83 | If at any point you made a mistake in the steps above, selecting the "Latest" version of the intent at the top, next to the intent name, will allow you to edit your choices. 84 | 85 | 21. Let's build this simple Bot: Hit the grey Build button at the top right corner. You will be asked for confirmation to build. Click "Build". 86 | 87 | The build process takes approximately a minute. Once complete, you can ask your bot a question as a way to test it. For example, you could type "what is my balance 88 | ?" in the chat window, or click the microphone symbol, speak your request and client it again to have Lex translate your speech to text. At this stage since we have not added in the backend Lambda function, the response will be that the bot is ready for fulfillment and will show you the values which will be transferred. 89 | 90 | 91 | ![TestBot](images/Picture09-testbot.png). 92 | 93 | 22. It is possible to give the user a simpler interface on the bot to multiple choice questions using Response Cards. If you click on the small cog icon next to the "AccountType" slot you get the option to add a "Prompt response card". Add a title "Select your card type" and add button title Saving Account (choose value Saving) and Current Account (value Current). Click "Save" and rebuild and test. You will now be presented with a multiple choice option select. 94 | 95 | ![ResponseCard](images/Picture10-responsecard.png) 96 | 97 | # Step 2: Fulfilling the bot 98 | 99 | We are now in a position that we can transfer the answers to the 'slots' over to a function to perform logic and get a result for the user. 100 | 101 | Here we will create a Lambda function that has some Javascript code to detect the intent name ('GetBalanceCheck' and return values based on the AccountType and if the Pin number was entered correctly. 102 | 103 | In the Lambda function we have hard-coded an Array of data but in a real world example we would have authenticated the user and would use a database lookup for the account balances. 104 | 105 | 1. Use the AWS Console to navigate to Lambda. 106 | 2. Click on the orange 'Create a function' link under the 'Getting Started' section 107 | 3. On the "Create function" page, click the "Author from scratch" button 108 | 4. Let's give our function the name of "myPersonalBanker" and optionally provide a description 109 | 5. Choose Node.js 14.x as the Runtime 110 | 6. We will "Create new role from template – give it a Lex-style role name (such as "LexRole") and select "Test Harness permissions" as the policy template. 111 | 112 | 113 | ![Author new Lambda function](images/Picture11.png) 114 | 115 | 1. Hit "Create function" on the bottom right and you'll be take to the "Configuration" window. We are not adding any additional triggers, nor are we using Lambda Layers, so scroll down to the "Function code" section 116 | 2. Open the lambda function code you will find [here](./myPersonalBanker_v1.js) (myPersonalBanker\_v1.js). Copy and paste the code into the inline editor – make sure that you overwrite any template code that is already in the code box 117 | 3. Scroll down to the '"Execution role" section and ensure that the role you created previously is selected in the "Existing role" drop-down – if not then please select it 118 | 4. Leave the rest unchanged, then hit the orange "Save" button at the top of the screen 119 | 120 | # Step 3: Link the bot with the Lambda function 121 | 122 | In this step we will link the three intents we created to the Lambda function. We do this by providing the Lambda function as the method that contains the business logic used to 'fulfill' the users requests. Once this is done (and the bot rebuilt), when a user specifies an intent (such as 'what is my checking account balance'), Lex will call our Lambda function and pass it the intent name ('GetAccountDetail') and the slot value ('checking'). 123 | 124 | To do this, we go back to the [Lex Console](https://console.aws.amazon.com/lex). 125 | 126 | 1. Click on Personal Banker 127 | 2. Enure the 'GetBalanceCheck' intent is selected 128 | 3. Make sure that the 'Latest' version is selected for both the bot and the intent 129 | 130 | ![Set Lex latest version](images/Picture12.png) 131 | 132 | 4. Scroll down to "Fulfillment", select "AWS Lambda function", choose "myPersonalBanker" and click "OK" in the popup warning window which opens. It indicates you are giving Lex the permission to run this Lambda function. 133 | 134 | ![Add Lambda permission](images/Picture13.png) 135 | 136 | 5. Click "Save intent" 137 | 6. Repeat the above steps **3, 4 and 5** for intents "GetLoanDetail" and "GetLoanProducts" 138 | 7. Click "Build" and then click "Build" again on the confirmation screen. 139 | 140 | # Step 4: Running and debugging the bot 141 | 142 | 1. If you now test the bot as you did at the bottom of [Step 1](#testingthebot) you will see a sample response back from the lambda function. This function has been setup to show you how a very basic flow can be configured and over the next few steps we will modify the code to make the function more helpful. 143 | 144 | The function 'closes' the Lex box with a message displaying the values passed into the slot. If you look within the Javascript for the function named 'simpleResponse' you should be able to see it does very little other than return data back to the user. 145 | 146 | 2. To make the application more useful we want to pass values into the function and retrieve data back from a data source (in this case an array but in production this could be a database). 147 | 148 | If you modify the lambda function and look for the line **'return simpleResponse(intentRequest, callback);'** and place '//' before this line and remove the '//' from the line below so it looks like: 149 | 150 | ``` javascript 151 | //return simpleResponse(intentRequest, callback); 152 | return balanceIntentError(intentRequest, callback); 153 | //return balanceIntent(intentRequest, callback); 154 | ``` 155 | 156 | Save your lambda function and retry the Lex bot. First off all try by choosing 'Saving' and saying the 'PinNumber' is 1234. You should now get a nice response from lex telling you of your account balance. However, at the moment your Lex box will error if you enter an incorrect PinNumber which is not helpful to the user. 157 | ![Add Lambda permission](images/Picture14.png) 158 | 159 | 3. Finally we are going to add some error handling and a feedback loop to the user until a correct PinNumber is entered. The code will check to see if there is an account match and if not will request the user tries again and resets the 'Slot'. 160 | 161 | If you modify the lambda function and look for the line **'return balanceIntentError(intentRequest, callback);'** and place '//' before this line and remove the '//' from the line below so it looks like: 162 | 163 | ``` javascript 164 | //return simpleResponse(intentRequest, callback); 165 | //return balanceIntentError(intentRequest, callback); 166 | return balanceIntent(intentRequest, callback); 167 | ``` 168 | ![Add Lambda permission](images/Picture15.png) 169 | # Conclusion 170 | 171 | In this lab you have learned the basic operations to manage a Lex bot. First, you created a bot, then you defined intents and slot types. Finally you defined a Lambda function and attached it to your chatbot. 172 | 173 | **NOTE We will be continuing on from this Lab in the second Lab so please do not delete the Lex Bot you have created in this exercise.** 174 | -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture01.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture02.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture03.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture04.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture05.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture05b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture05b.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture06.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture06b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture06b.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture07.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture08.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture08b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture08b.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture09-testbot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture09-testbot.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture09.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture10-responsecard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture10-responsecard.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture10.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture11.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture12.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture13.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture13b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture13b.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture14.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/Picture15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/Picture15.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/images/lex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab1-Building_Chat_Bots_With_Lex/images/lex.png -------------------------------------------------------------------------------- /lab1-Building_Chat_Bots_With_Lex/myPersonalBanker_v1.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | 3 | // Route the incoming request based on intent. 4 | const accounts = [ 5 | { 6 | type: 'current', 7 | pinNumber: '1234', 8 | balance: '134.12', 9 | }, 10 | { 11 | type: 'saving', 12 | pinNumber: '1234', 13 | balance: '154.12', 14 | }, 15 | ]; 16 | 17 | // Check to see if an account matches for the account type and also that the pin number for that 18 | // account matches the array 19 | const getAccount = (type, pinNumber) => { 20 | const result = accounts.find(account => account.type.toLowerCase() === type.toLowerCase() 21 | && account.pinNumber === pinNumber); 22 | return result; 23 | }; 24 | 25 | const balanceIntent = (intentRequest, callback) => { 26 | const { slots } = intentRequest.currentIntent; 27 | const sessionAttributes = { ...intentRequest.sessionAttributes, ...slots }; 28 | const account = getAccount(slots.AccountType, slots.PinNumber); 29 | 30 | if (!account) { 31 | callback(elicitSlot(sessionAttributes, 'GetBalanceCheck', slots, 'PinNumber', { 32 | contentType: 'PlainText', 33 | content: 'No accounts have been found with this pin number please re-enter your pin number', 34 | })); 35 | } else { 36 | callback(close(sessionAttributes, 'Fulfilled', { 37 | contentType: 'PlainText', 38 | content: `You have £${account.balance} in your account`, 39 | })); 40 | } 41 | }; 42 | 43 | const balanceIntentError = (intentRequest, callback) => { 44 | const { slots } = intentRequest.currentIntent; 45 | const sessionAttributes = { ...intentRequest.sessionAttributes, ...slots }; 46 | const account = getAccount(slots.AccountType, slots.PinNumber); 47 | callback(close(sessionAttributes, 'Fulfilled', { 48 | contentType: 'PlainText', 49 | content: `You have £${account.balance} in your account, is there anything can help you with?`, 50 | })); 51 | }; 52 | 53 | // This a simple example to demonstrate how lambda can work with the flow 54 | const simpleResponse = (intentRequest, callback) => { 55 | const { slots } = intentRequest.currentIntent; 56 | const $msg = `Thank you for using the lambda function. 57 | You submitted the following values AccountType:${slots.AccountType} 58 | pinNumber ${slots.PinNumber}. Now it's time to make it actually do something!`; 59 | callback(close({}, 'Fulfilled', { 60 | contentType: 'PlainText', 61 | content: $msg, 62 | })); 63 | }; 64 | 65 | // Called when the user specifies an intent for this skill. 66 | const dispatch = (intentRequest, callback) => { 67 | console.log(JSON.stringify(intentRequest, null, 2)); 68 | console.log(`dispatch userId=${intentRequest.userId}, intentName=${intentRequest.currentIntent.name}`); 69 | const intentName = intentRequest.currentIntent.name; 70 | 71 | if (intentName === 'GetBalanceCheck') { 72 | return simpleResponse(intentRequest, callback); 73 | // return balanceIntentError(intentRequest, callback); 74 | // return balanceIntent(intentRequest, callback); 75 | } 76 | return {}; 77 | }; 78 | 79 | const loggingCallback = (response, originalCallback) => { 80 | console.log('lambda response:\n', JSON.stringify(response, null, 2)); 81 | originalCallback(null, response); 82 | }; 83 | 84 | // The handler function is the one that gets called by lambda as it is invoked 85 | exports.handler = (event, context, callback) => { 86 | try { 87 | console.log(`event.bot.name=${event.bot.name}`); 88 | dispatch(event, response => loggingCallback(response, callback)); 89 | } catch (err) { 90 | callback(err); 91 | } 92 | }; 93 | 94 | 95 | // --------------- Helpers that build all of the responses ----------------------- 96 | // continue dialog with the customer, expressing that the user will select another intent after 97 | // she hears this response 98 | const nextIntent = (sessionAttributes, message) => { 99 | console.log(`nextIntent: ${JSON.stringify(message)}`); 100 | return { 101 | sessionAttributes, 102 | dialogAction: { 103 | type: 'ElicitIntent', 104 | message, 105 | }, 106 | }; 107 | }; 108 | 109 | const elicitSlot = (sessionAttributes, intentName, slots, slotToElicit, message) => ({ 110 | sessionAttributes, 111 | dialogAction: { 112 | type: 'ElicitSlot', 113 | intentName, 114 | slots, 115 | slotToElicit, 116 | message, 117 | }, 118 | }); 119 | 120 | 121 | const confirmIntent = (sessionAttributes, intentName, slots, message) => ({ 122 | sessionAttributes, 123 | dialogAction: { 124 | type: 'ConfirmIntent', 125 | intentName, 126 | slots, 127 | message, 128 | }, 129 | }); 130 | 131 | 132 | const close = (sessionAttributes, fulfillmentState, message) => ({ 133 | sessionAttributes, 134 | dialogAction: { 135 | type: 'Close', 136 | fulfillmentState, 137 | message, 138 | }, 139 | }); 140 | 141 | const delegate = (sessionAttributes, slots) => ({ 142 | sessionAttributes, 143 | dialogAction: { 144 | type: 'Delegate', 145 | slots, 146 | }, 147 | }); 148 | -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/Advanced_Workflow: -------------------------------------------------------------------------------- 1 | {"modules":[{"id":"22e3889d-8092-4767-ba6f-0f58b13f7a0b","type":"SetVoice","branches":[{"condition":"Success","transition":"5c31604c-8dce-4248-8ff1-80f0c2c72158"}],"parameters":[{"name":"GlobalVoice","value":"Joanna"}],"metadata":{"position":{"x":173,"y":36}}},{"id":"5c31604c-8dce-4248-8ff1-80f0c2c72158","type":"SetRecordingBehavior","branches":[{"condition":"Success","transition":"ef3ade0a-1906-4e45-8e42-761e0ef81805"}],"parameters":[{"name":"RecordingBehaviorOption","value":"Enable"},{"name":"RecordingParticipantOption","value":"Both"}],"metadata":{"position":{"x":400,"y":40}}},{"id":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a","type":"Disconnect","branches":[],"parameters":[],"metadata":{"position":{"x":880,"y":500}}},{"id":"0d3490fa-8ec5-4b5d-8bfd-af156b753a19","type":"Transfer","branches":[{"condition":"AtCapacity","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[],"metadata":{"position":{"x":620,"y":280},"useDynamic":false,"queue":null},"target":"Queue"},{"id":"1b222d83-5812-4380-83e2-cc780957fee5","type":"PlayPrompt","branches":[{"condition":"Success","transition":"2b402849-b24e-4436-b3c4-677b10b29037"}],"parameters":[{"name":"Text","value":"Welcome to our simple call center - thanks for calling.","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":280,"y":560},"useDynamic":false}},{"id":"2b402849-b24e-4436-b3c4-677b10b29037","type":"GetUserInput","branches":[{"condition":"Evaluate","conditionType":"Equals","conditionValue":"GetBalanceCheck","transition":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a"},{"condition":"NoMatch","transition":"0d3490fa-8ec5-4b5d-8bfd-af156b753a19"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[{"name":"Text","value":"How can we help you? \nPress 1 or say Advisor to speak to an advisor.\nPress 2 or say Check my balance to get your balance","namespace":null},{"name":"TextToSpeechType","value":"text"},{"name":"BotName","value":"FinTechLexBot"},{"name":"BotAlias","value":"$LATEST"},{"name":"BotRegion","value":"us-east-1"}],"metadata":{"position":{"x":540,"y":500},"conditionMetadata":[{"id":"1f75751e-cf85-4424-acfd-290c2e9c59eb","value":"GetBalanceCheck"}],"useDynamic":false,"dynamicMetadata":{}},"target":"Lex"},{"id":"b8bb9603-37ef-4650-aa68-64e861dd8fe8","type":"SetAttributes","branches":[{"condition":"Success","transition":"9713edd1-4e3d-43b1-98bd-16ec077db32d"},{"condition":"Error","transition":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a"}],"parameters":[{"name":"Attribute","value":"CustomerName","key":"CustomerName","namespace":"External"}],"metadata":{"position":{"x":60,"y":740}}},{"id":"9713edd1-4e3d-43b1-98bd-16ec077db32d","type":"PlayPrompt","branches":[{"condition":"Success","transition":"2b402849-b24e-4436-b3c4-677b10b29037"}],"parameters":[{"name":"Text","value":"Hi $.External.CustomerName welcome to the FinTechDemo","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":300,"y":900},"useDynamic":false}},{"id":"f756f833-d5c1-4757-af9f-86c17bf4e428","type":"CheckAttribute","branches":[{"condition":"NoMatch","transition":"1b222d83-5812-4380-83e2-cc780957fee5"},{"condition":"Evaluate","conditionType":"Equals","conditionValue":"1","transition":"b8bb9603-37ef-4650-aa68-64e861dd8fe8"},{"condition":"Evaluate","conditionType":"Equals","conditionValue":"0","transition":"1b222d83-5812-4380-83e2-cc780957fee5"}],"parameters":[{"name":"Attribute","value":"CustomerMatch"},{"name":"Namespace","value":"External"}],"metadata":{"position":{"x":40,"y":440},"conditionMetadata":[{"id":"566c11ca-0636-488a-9446-40840be715c3","operator":{"name":"Equals","value":"Equals","shortDisplay":"="},"value":"1"},{"id":"21dd5c5d-7c70-44f3-bcc0-484061460f0a","operator":{"name":"Equals","value":"Equals","shortDisplay":"="},"value":"0"}]}},{"id":"7aa813c2-ee3c-483e-8fac-834f20158e9a","type":"PlayPrompt","branches":[{"condition":"Success","transition":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a"}],"parameters":[{"name":"Text","value":"Oh dear there has been an error.","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":960,"y":240},"useDynamic":false}},{"id":"ef3ade0a-1906-4e45-8e42-761e0ef81805","type":"SetQueue","branches":[{"condition":"Success","transition":"c048f7dc-5348-4721-9486-01eeac3baf8e"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[{"name":"Queue","value":"arn:aws:connect:us-east-1:117026838272:instance/ed452c18-7508-468f-a510-09d1d661ef1d/queue/24dd7d91-ffcc-43e3-a33f-9fc3afd3d598","namespace":null,"resourceName":"BasicQueue"}],"metadata":{"position":{"x":620,"y":40},"useDynamic":false,"queue":{"id":"arn:aws:connect:us-east-1:117026838272:instance/ed452c18-7508-468f-a510-09d1d661ef1d/queue/24dd7d91-ffcc-43e3-a33f-9fc3afd3d598","text":"BasicQueue"}}},{"id":"c048f7dc-5348-4721-9486-01eeac3baf8e","type":"InvokeExternalResource","branches":[{"condition":"Success","transition":"f756f833-d5c1-4757-af9f-86c17bf4e428"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[{"name":"FunctionArn","value":"arn:aws:lambda:us-east-1:117026838272:function:myPersonalResponder","namespace":null},{"name":"TimeLimit","value":"3"},{"name":"Parameter","key":"PhoneNumber","value":"Customer Number","namespace":"System"}],"metadata":{"position":{"x":40,"y":220},"dynamicMetadata":{"PhoneNumber":true},"useDynamic":false},"target":"Lambda"}],"version":"1","type":"contactFlow","start":"22e3889d-8092-4767-ba6f-0f58b13f7a0b","metadata":{"entryPointPosition":{"x":40,"y":40},"snapToGrid":true,"name":"Advanced Workflow","description":null,"type":"contactFlow","status":"published","hash":"0b9302aa5aa9b29ac2287d85feddbee9dc1348430dbb4e6c55fd0c56e3597646"}} -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/Lex_WorkFlow: -------------------------------------------------------------------------------- 1 | {"modules":[{"id":"22e3889d-8092-4767-ba6f-0f58b13f7a0b","type":"SetVoice","branches":[{"condition":"Success","transition":"5c31604c-8dce-4248-8ff1-80f0c2c72158"}],"parameters":[{"name":"GlobalVoice","value":"Joanna"}],"metadata":{"position":{"x":173,"y":36}}},{"id":"5c31604c-8dce-4248-8ff1-80f0c2c72158","type":"SetRecordingBehavior","branches":[{"condition":"Success","transition":"ef3ade0a-1906-4e45-8e42-761e0ef81805"}],"parameters":[{"name":"RecordingBehaviorOption","value":"Enable"},{"name":"RecordingParticipantOption","value":"Both"}],"metadata":{"position":{"x":400,"y":40}}},{"id":"ef3ade0a-1906-4e45-8e42-761e0ef81805","type":"SetQueue","branches":[{"condition":"Success","transition":"1b222d83-5812-4380-83e2-cc780957fee5"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[{"name":"Queue","value":"arn:aws:connect:us-east-1:117026838272:instance/ed452c18-7508-468f-a510-09d1d661ef1d/queue/24dd7d91-ffcc-43e3-a33f-9fc3afd3d598","namespace":null,"resourceName":"BasicQueue"}],"metadata":{"position":{"x":620,"y":40},"useDynamic":false,"queue":{"id":"arn:aws:connect:us-east-1:117026838272:instance/ed452c18-7508-468f-a510-09d1d661ef1d/queue/24dd7d91-ffcc-43e3-a33f-9fc3afd3d598","text":"BasicQueue"}}},{"id":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a","type":"Disconnect","branches":[],"parameters":[],"metadata":{"position":{"x":880,"y":500}}},{"id":"0d3490fa-8ec5-4b5d-8bfd-af156b753a19","type":"Transfer","branches":[{"condition":"AtCapacity","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[],"metadata":{"position":{"x":620,"y":280},"useDynamic":false,"queue":null},"target":"Queue"},{"id":"7aa813c2-ee3c-483e-8fac-834f20158e9a","type":"PlayPrompt","branches":[{"condition":"Success","transition":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a"}],"parameters":[{"name":"Text","value":"Oh dear there has been an error.","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":960,"y":240},"useDynamic":false}},{"id":"1b222d83-5812-4380-83e2-cc780957fee5","type":"PlayPrompt","branches":[{"condition":"Success","transition":"2b402849-b24e-4436-b3c4-677b10b29037"}],"parameters":[{"name":"Text","value":"Welcome to our simple call center - thanks for calling.","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":60,"y":260},"useDynamic":false}},{"id":"2b402849-b24e-4436-b3c4-677b10b29037","type":"GetUserInput","branches":[{"condition":"Evaluate","conditionType":"Equals","conditionValue":"GetBalanceCheck","transition":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a"},{"condition":"NoMatch","transition":"0d3490fa-8ec5-4b5d-8bfd-af156b753a19"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[{"name":"Text","value":"How can we help you? \nPress 1 or say Advisor to speak to an advisor.\nPress 2 or say Check my balance to get your balance","namespace":null},{"name":"TextToSpeechType","value":"text"},{"name":"BotName","value":"FinTechLexBot"},{"name":"BotAlias","value":"$LATEST"},{"name":"BotRegion","value":"us-east-1"}],"metadata":{"position":{"x":320,"y":400},"conditionMetadata":[{"id":"1f75751e-cf85-4424-acfd-290c2e9c59eb","value":"GetBalanceCheck"}],"useDynamic":false,"dynamicMetadata":{}},"target":"Lex"}],"version":"1","type":"contactFlow","start":"22e3889d-8092-4767-ba6f-0f58b13f7a0b","metadata":{"entryPointPosition":{"x":40,"y":40},"snapToGrid":true,"name":"Lex Workflow","description":null,"type":"contactFlow","status":"published","hash":"338bcd3ca5d2cfb67c6bee9d0990a6efa4b955dfe4e4669eb5fad2348b88d126"}} -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/README.md: -------------------------------------------------------------------------------- 1 | **Last Updated:** April 2019 2 | 3 | # Building a Call Center with Amazon Connect 4 | 5 | ## Overview 6 | 7 | Amazon Connect is a cloud-based contact center solution which makes it easy to set up and manage a customer contact center and provide reliable customer engagement at any scale. You can deploy a contact center in just a few steps, onboard agents from anywhere, and begin to engage with your customers. 8 | 9 | - Creating a Call Center 10 | - Create a simple contact flow 11 | - Adding a Lex Bot to your flow 12 | - Improving your Call Flows 13 | - Extra: Getting personal with your caller 14 | 15 | # Step 1: Setting Up A Call Center 16 | 17 | 1. Log in to the [AWS console](https://console.aws.amazon.com/connect/home?region=us-east-1#) and navigate to the Amazon Connect service 18 | 2. **Please ensure you have selected North Virginia as the region in the top right (Amazon Connect is not available in all regions yet)** 19 | 3. If you have never created a Call Center, click "Get Started" 20 | 4. Enter a custom Access URL (This is a unique name so you will might need to be creative) then click 'Next Step' 21 | 5. For this lab we will be using the default Admin account - so you can chose to "Skip" the Administrator account. Then click 'Next Step' 22 | 6. For this lab you will not need to make Outbound calls, uncheck this option and click 'Next Step' 23 | 7. The Connect application will automatically create you a S3 bucket and encrypt the data. Click 'Next Step' 24 | 8. Finally click 'Create Instance'. 25 | ![Create your Connect Instance](images/Picture01.png) 26 | 11. This may take a minute or two to setup. 27 | 12. Once it is setup you will be presented with a screen which allows you to 'Get Started' 28 | 13. Your browser will pop up a warning to ask you show notifications - this is to allow the Connect Application to notify you when a call is coming in. Click allow on the pop up. 29 | ![Create your Connect Instance](images/Picture01b.png) 30 | 31 | 14. At this point your Call Center is setup but you don't have any numbers so you need to 'Claim your first number' - For this lab chose a **UK Direct Dial Number** and click 'Next'. 32 | 15. This is the first number for your call center - you now can call the number and go through the default first call example that is part of Amazon Connect by ringing the number that is allocated to you or click 'Skip for now'. 33 | 34 | # Step 2: Create a simple Contact Flow 35 | 36 | Amazon Connect is based around creating contact flows, these are highly customisable and in this step we will create a very simple flow to help demonstrate how to setup a call. The flow will welcome the customer and then place them in the queue for an agent 37 | 38 | 1. When you create a new Connect environment you are presented with a "default workflow" which you can find by clicking on the 'Routing' option then 'Contact Flows' 39 | ![ContactFlows](images/Picture02.png) 40 | 41 | and then looking at 'Sample inbound flow (first call experience)'. There is a LOT going on in this flow so we are going to create our own 'Simple flow'. 42 | 43 | 44 | 3. We are going to import a pre made 'Simple contact flow'. First of all download the following file to your computer [Simple Workflow](https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/master/lab2-Building_Connect_Call_Center/Simple_Workflow). 45 | 4. Head back to the 'Contact Flows' section listed above and in the top right click on 'Create contact flow'. 46 | 5. In the top right click on the down arrow next to the "Save" button and click Import Flow (beta). 47 | ![ContactFlows](images/Picture03.png) 48 | 49 | 5. Browse and find the file labelled Simple Workflow 50 | 6. Once the flow is uploaded you will see the following flow: 51 | ![Simpleflow](images/Picture04.png) 52 | 53 | Let's take a moment to understand what is going on with this flow. The top line of the flow diagram is configuring the flow. You can chose which Amazon voice you want the dialogue prompts to have, we have enabled call recordings to go to our S3 buckets and said that all calls will go to the default queue that is set up when you create a call center. 54 | 55 | On the second line we create a message to say to the customer dialing in: 56 | ``` 57 | Welcome to our simple call center - thanks for calling, we are just transferring you to an agent please wait. 58 | ``` 59 | 60 | This is completely customisable and you can even record your own audio prompt. Following this we transfer the caller to the queue ready for an advisor. 61 | 62 | The other items in the flow relate to what happen when an error occurs and also the end of the call. 63 | 64 | 1. The Contact Flow is complete and we need to Publish it by clicking on the arrow next to save and choosing 'Save & Publish' 65 | 66 | ![SaveAndPublish](images/Picture05.png) 67 | 68 | 1. The flow is now created but it is not linked to the telephone number we created earlier. In order to associate the flow - chose 'Phone Numbers' from the Routing menu 69 | 70 | ![Phone numbers](images/Picture06.png) 71 | 72 | 9. Click on the number and you will be presented with an Edit screen - choose Simple Workflow in the Contact flow / IVR section and click Save. 73 | ![Phone numbers edit](images/Picture07.png) 74 | 75 | 10. Wait a few seconds and then call your phone number again and see how the flow has changed. Maybe modify the text in the Play Prompt section of the flow and Republish and call in again and see how it changes? 76 | 11. If you want to act as a Call Agent you need to click on the phone icon in the top right of the screen and ensure you are set to 'Available' 77 | 78 | ![Phone numbers edit](images/Picture08.png) 79 | 80 | # Step 3: Adding your lex bot into the flow. 81 | 82 | We are now going to leverage the Lex Bot you built in Lab 1 within your contact flow. 83 | 84 | 1. First of all we need to give Amazon Connect permission to access your lex bot. Head to [AWS Console](https://console.aws.amazon.com/connect/home) page for your connect app and chose your Connect instance. 85 | 86 | 2. Click on Contact flows and in the Amazon Lex section you can chose the Lex Bot you created earlier (ensure you click + Add Lex Bot link) 87 | ![Phone numbers edit](images/Picture09.png) 88 | 89 | 3. We are now going to modify the simple workflow to integrate your Lex bot. On the left hand menu chose "Interact" and drag "Get Customer Input" into your workflow. 90 | 91 | ![Add interaction](images/Picture11.png) 92 | 93 | 4. If you click on the top line of the box you have dragged in you will be presented with the following option on the right hand side of your screen: 94 | 95 | ![Phone numbers edit](images/Picture10.png) 96 | 97 | Within this edit window we are going to add a starting question (to introduce the bot) - click on 'Text to speech' and enter some text into the box below (eg "How can we help you today?"). 98 | 99 | Chose Amazon Lex and select your Lex Bot from the drop down list. 100 | 101 | Finally you need to add the "Intents" you wish to allow flows from - add the intent "GetBalanceCheck" (this is the Intent we created in lab 1). 102 | 103 | 5. We now need to adjust the Simple workflow to introduce our Lex bot. First of all you need to remove the link between the Play Prompt and Transfer to queue. You can remove a link by hovering over the arrow and clicking on the red cross. 104 | ![Phone numbers edit](images/Picture13.png) 105 | 106 | 6. Once the link has been removed we need to introduce our recently created Input. Click and hold on the circle on the Okay within Play prompt and join it to our new box. When a connection is successfully made there will be a yellow circle at the end of the block 107 | ![Phone numbers edit](images/Picture12.png) 108 | 109 | 7. We now have the input flow but we need to connect the output of the Input. If you join the "Default" option to the "Transfer to Queue" block and the other two options to "Disconnect / Hang Up". 110 | 111 | 8. At this point if you click 'Save & Publish' and then try redialing your number you will be presented with a new option. If you respond to the question "How can we help you today?" with the phrase "I'd like to check my balance" you will now enter your Lex bot flow you built in Lab 1. 112 | 113 | # Step 4: Improving your Call flows 114 | 115 | In the above example after introducing the Lex bot our customer is now actually unable to speak to an advisor as they can only get the balance of their account. 116 | 117 | In order to create a flow back to an advisor we need to go back to edit the Lex bot we created in Lab 1 and create a new Intent that listens for "Speak to an advisor" 118 | 119 | 1. Head back to the Lex bot you created in Lab 1 [AWS console](https://console.aws.amazon.com/lex/home). Click on the + symbol next to Intents and add a new intent called "Advisor" 120 | ![Phone numbers edit](images/Picture14.png). 121 | 122 | 2. Add the following utterances: 123 | 124 | - _advisor_ 125 | - _talk_ 126 | - _talk to someone_ 127 | - _talk to advisor_ 128 | 129 | These are all phrases which the user might say in order to invoke the Call Center Advisor (feel free to add any others you can think of). 130 | 131 | 3. We are also going to add the utterance: 132 | 133 | - _one_ 134 | 135 | Adding this utterance will allow the customer to engage with our Lex Bot via the keypad as well (ie we can tell the customer to say "Speak to Advisor or Press 1 on the keypad") 136 | 137 | Your utterences should now look like this: 138 | ![Phone numbers edit](images/Picture17.png) 139 | 140 | 4. Click 'Build' at the top. 141 | 5. At this point we should also modify the GetBalanceCheck Intent to also add the utterance: 142 | 143 | 144 | - _two_ 145 | 146 | for the same reason as above. 147 | 148 | 6. Now we need to add the intent to our Connect flow. Head to your flow and click on Get Customer Input Flow. Click on "Add another intent" and type Advisor. 149 | 150 | 151 | ![Phone numbers edit](images/Picture15.png) 152 | 153 | 7. Having added an additional Intent this is now added to the flow. 154 | 155 | ![Phone numbers edit](images/Picture15b.png) 156 | 157 | You will want to join the arrow from the "Advisor" intent into the transfer to queue flow option. 158 | 159 | ![Phone numbers edit](images/Picture15c.png) 160 | 161 | 8. Click Save & publish and recall your contact center. You can now either ask for an advisor (or press 1) on your keypad or continue on with the Lex flow you built earlier by selecting 2. 162 | 163 | # Step 5: Interacting with your user based on their dialer number (Extra Credits) 164 | 165 | When a customer calls Amazon Connect the service has access to the caller number so it is possible to build functionality to personally greet the user when they dial in using Lambda. This section is slightly less guided as it extends on a lot of the topics already covered. 166 | 167 | 1. Create a new Lambda function named "myPersonalResponder" 168 | 2. Open the lambda function code you will find [here](./myPersonalResponder_v1.js) (myPersonalResponder\_v1.js). Copy and paste the code into the inline editor – make sure that you overwrite any template code that is already in the code box and save. At the top of the file is a 169 | 3. Within the Connect Admin (where you added your Lex bot) you can also attach Lambda functions. You will need to modify your workflow to add your new Lambda. 170 | ![Phone numbers edit](images/Picture16.png) 171 | 172 | 4. Head to your workflow and Click Integrate from the left hand menu and drag "Invoke AWS function" 173 | ![Phone numbers edit](images/Picture18.png) 174 | 175 | 176 | and add the lambda function to the workflow: 177 | 178 | ![Phone numbers edit](images/Picture19.png) 179 | 180 | 5. Review the Advanced_Workflow by Importing it as a new Flow, in this flow we add following steps: 181 | 1. Invoke our AWS Lambda function 182 | 2. The Lambda function returns an Object in which we define whether there is a CustomerMatch (CustomerMatch = 0/1) 183 | 3. If there is a Customer Match: 184 | 1. We branch off and Set a Contract Attribute to equal the Customer Name returned from the Lambda function 185 | 2. We play a different prompt to the user which is personalised and uses the variable we return 186 | 4. If there is No customer match we simply respond with the original welcome message. 187 | 6. Replicate this flow in the Simple Workflow you have been using during this lab to add this functionality. 188 | 189 | 190 | -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/Simple_Workflow: -------------------------------------------------------------------------------- 1 | {"modules":[{"id":"22e3889d-8092-4767-ba6f-0f58b13f7a0b","type":"SetVoice","branches":[{"condition":"Success","transition":"5c31604c-8dce-4248-8ff1-80f0c2c72158"}],"parameters":[{"name":"GlobalVoice","value":"Joanna"}],"metadata":{"position":{"x":173,"y":36}}},{"id":"5c31604c-8dce-4248-8ff1-80f0c2c72158","type":"SetRecordingBehavior","branches":[{"condition":"Success","transition":"ef3ade0a-1906-4e45-8e42-761e0ef81805"}],"parameters":[{"name":"RecordingBehaviorOption","value":"Enable"},{"name":"RecordingParticipantOption","value":"Both"}],"metadata":{"position":{"x":400,"y":40}}},{"id":"1b222d83-5812-4380-83e2-cc780957fee5","type":"PlayPrompt","branches":[{"condition":"Success","transition":"0d3490fa-8ec5-4b5d-8bfd-af156b753a19"}],"parameters":[{"name":"Text","value":"Welcome to our simple call center - thanks for calling, we are just transferring you to an agent please wait.","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":60,"y":260},"useDynamic":false}},{"id":"ef3ade0a-1906-4e45-8e42-761e0ef81805","type":"SetQueue","branches":[{"condition":"Success","transition":"1b222d83-5812-4380-83e2-cc780957fee5"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[{"name":"Queue","value":"arn:aws:connect:us-east-1:117026838272:instance/ed452c18-7508-468f-a510-09d1d661ef1d/queue/24dd7d91-ffcc-43e3-a33f-9fc3afd3d598","namespace":null,"resourceName":"BasicQueue"}],"metadata":{"position":{"x":620,"y":40},"useDynamic":false,"queue":{"id":"arn:aws:connect:us-east-1:117026838272:instance/ed452c18-7508-468f-a510-09d1d661ef1d/queue/24dd7d91-ffcc-43e3-a33f-9fc3afd3d598","text":"BasicQueue"}}},{"id":"0d3490fa-8ec5-4b5d-8bfd-af156b753a19","type":"Transfer","branches":[{"condition":"AtCapacity","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"},{"condition":"Error","transition":"7aa813c2-ee3c-483e-8fac-834f20158e9a"}],"parameters":[],"metadata":{"position":{"x":280,"y":260},"useDynamic":false,"queue":null},"target":"Queue"},{"id":"7aa813c2-ee3c-483e-8fac-834f20158e9a","type":"PlayPrompt","branches":[{"condition":"Success","transition":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a"}],"parameters":[{"name":"Text","value":"Oh dear there has been an error.","namespace":null},{"name":"TextToSpeechType","value":"text"}],"metadata":{"position":{"x":620,"y":460},"useDynamic":false}},{"id":"09fcc5e0-d6b4-4bf4-99d1-a77d71860c1a","type":"Disconnect","branches":[],"parameters":[],"metadata":{"position":{"x":880,"y":500}}}],"version":"1","type":"contactFlow","start":"22e3889d-8092-4767-ba6f-0f58b13f7a0b","metadata":{"entryPointPosition":{"x":40,"y":40},"snapToGrid":true,"name":"Simple Workflow","description":null,"type":"contactFlow","status":"published","hash":"d6cfb4329060a7b051ea9b16b57f9a8ab666525c0b0e513af6d310e09d586c06"}} -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture01.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture01b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture01b.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture02.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture03.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture04.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture05.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture06.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture07.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture08.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture09.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture10.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture11.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture12.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture13.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture14.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture15.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture15b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture15b.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture15c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture15c.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture16.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture17.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture18.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/images/Picture19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-lex-connect-workshop/38f40142c6cd1dfddbe11fe93be4ea3728fd983b/lab2-Building_Connect_Call_Center/images/Picture19.png -------------------------------------------------------------------------------- /lab2-Building_Connect_Call_Center/myPersonalResponder_v1.js: -------------------------------------------------------------------------------- 1 | 2 | // This is an array to define the contact numbers you want to recognise 3 | // as a user dials in. 4 | const callerNumbers = [ 5 | { 6 | PhoneNumber: 'insertNumberHere in +44 format', 7 | CustomerName: 'Insert Name', 8 | }, 9 | ]; 10 | 11 | // This function performs a key-value style lookup. It's likely in production systems the data 12 | // would be stored in a database rather than an array. 13 | const checkCaller = dialerNumber => callerNumbers.find(caller => caller.PhoneNumber === dialerNumber); 14 | 15 | 16 | exports.handler = (event, context, callback) => { 17 | // check to see if the caller is a match in our array 18 | const match = checkCaller(event.Details.Parameters.PhoneNumber); 19 | // return a response in the format required by Connect 20 | // the object returns whether the customer is a match or not as a bool 21 | // and then returns the caller details if a match is found. 22 | const response = { 23 | CustomerMatch: match ? 1 : 0, 24 | ...match, 25 | }; 26 | return callback(null, response); 27 | }; 28 | --------------------------------------------------------------------------------