Create a contact center that has the following functionality:
- Play a hot message if there is one.
- If a phone number has called before say "welcome back", if not, greet the caller.
- Ask the person if they would like to be called back later to respond to a survey after the call.
- Using their voice to choose, give them the option of waiting on hold, being called back later, or connected to the emergency line.
- If they choose to wait, check to see if it is in the hours of operation and if anyone is available. If no one is currently available, put the caller in the callback queue.
- If they select the callback queue, place the customer in a callback queue.
- If they are connected to the emergency line, look up who is on call and connect the customer to that person. If they're unable to connect, reach out to someone else.
- If the person choose to answer the survey, call the person back to answer a satisfaction survey.
- Log into the console.
- Navigate to the Amazon Connect service page.
- Select Add an instance
- For identity management, choose Store users within Amazon Connect and enter a unique url to serve as an access point for your Contact center. Click Next.
- For production applications, it may make more sense to integrate with an existing directory, but for the purposes of today, let's use the built in user management capabilities.
- For Create an Administrator page, add an admin identity. You can use your IAM user to authenticate as an admin into the instance if you do not create a separate entity. Click Next.
- For Telephony Options, make sure both incoming and outbound calls are selected. Click Next.
- For Data storage, leave the default settings. Click Next.
- Review and Create the instance.
- Once the instance is created, select Get Started.
- Import a Chat Bot
- Open the Amazon Lex console.
- Cancel out of the default getting started page.
- Under Actions, select Import.
- Upload the ConnectBot.zip file.
- Click into the newly created bot and select Build.
- Publish the bot as ConnectBot.
- Go to the CloudFormation service and launch a stack.
- Select Template is ready and upload the full-template.yml file in this repo.
- Name the stack and add the following information from your Connect instance into the parameters:
- UserPhoneNumber = your phone number
- Keep the other settings as default.
- Accept the Capabilities and transforms conditions and Create Stack.
- What does this create for you?
- ContactHistoryTable: A DynamoDB table that will let you track who calls and the last time they called.
- ContactLookupLambda: A Lambda function that when given CustomerNumber as a parameter (when invoked from Connect) will look up the number in your table and return whether they are a new_caller or return_caller via attribute ContactStatus.
- ContactRouterLambda: A Lambda function that will return a primary contact and escalation contact (your phone number) via attributes TargetContact and EscalationContact.
- HotMessageTable: A DynamoDB table that will let you store hot messages to be played out to the user dynamically.
- GetHotMessageLambda: A Lambda function that can return any active hot message.
- OutboundDialQueue: An SQS Queue that stores people queued for an automated outbound contact.
- PutContactinQueueLambda: A Lambda function that puts a contact in the outbound dial queue when given CustomerNumber as a parameter from Connect.
- InitiateOutboundDialLambda: A Lambda function that uses the SQS Queue to trigger an automated outbound dial.
- Relevant IAM roles and policies
- Navigate to the Amazon Connect service.
- Select the Amazon Connect instance created earlier.
- Select Contact flows from the menu on the left.
- Under the Amazon Lex section, select and add the Amazon Lex bot that was imported.
- Under the AWS Lambda section, select and add the Lambda functions created by the Cloudformation template.
- ContactLookupLambda
- ContactRouterLambda
- GetHotMessage
- InitiateOutboundDialLambda
- Access the instance.
- Navigate to the Amazon Connect access URL
- Connect with the Username and Password for the admin account.
- Once you've entered the Amazon Connect application, select "Let's go".
- Claim your phone number. Select a US (+1) Direct Dial number and click Next.
- You can port your own US phone number to Amazon Connect if you'd like to replace existing phone numbers.
- Wait a minute or so. Meanwhile, let's review user management, queues, and routing profiles.
- Give yourself a call! Amazon Connect comes with a number of example contact flows to demonstrate different functionalities.
- Test them out.
- Under Routing, select Contact Flows.
- Select create contact flow.
- Enter the name TransferToQueue.
- Under Interact, add a Play prompt module and link it to Entry point.
- Click into the module, select Text to speech and enter the text "I'm putting you in the queue".
- Under Set, add a Set working queue module and link it to the Play prompt module.
- Click into the module and select the BasicQueue.
- Under Terminate/Transfer add a Transfer to Queue module and link it to the Success option of the Set working queue module.
- Add two more Play prompt modules. Make one say "Something went wrong. Try again later" and the other "I'm sorry. It seems our queue is at capacity. Try again later".
- Link the error message to the Error options on set working queue, Transfer to Queue, and the at capacity message.
- Under Terminate/Transfer, add a Disconnect/Hang up module and link your final messages to it.
- Save and then publish.
- Under phone numbers, select the number you've claimed.
- Under Contact flow / IVR, select the TransferToQueue contact flow you just created and save.
- Open up the CCP by clicking the phone icon in the upper right hand corner.
- Wait a few moments and give yourself a call.
- Notice that when a customer is put into a queue, they are really put into the Default customer queue. If you want to change the experience, you can. You can also build things like interruptible queue flows. Similarly, the agent (you) heard the Default agent whisper. Whispers are used to share information to only one side of the conversation.
- Under Routing, select Contact Flows.
- Select create contact flow.
- In the upper right next to the Save button, select Import flow (beta).
- Upload the TransferToCallbackQueue file from the contact-flows folder in the repository.
- Modify the Set working queue module to select the BasicQueue and save.
- Click through the modules to understand how the pieces work together.
- Save, Publish, and test the TransferToCallbackQueue contact flow like your TransferToQueue contact flow. Notice that when connected using the callback queue, the caller heard the Default outbound contact flow.
- Under Routing, select Contact Flows.
- Select create contact flow.
- Enter the name InboundCallRouter.
- Under Branch, select Check hours of operation. Select Basic Hours.
- Build out the Error flow with error message and termination.
- Under Branch, select Check staffing. Under Status to check, select Available. Optionally select the basic queue. Link this module to Check hours of operation's In Hours module. Link the error option.
- Under Terminate/Transfer, select Transfer to flow. Select your TransferToQueue contact flow and save. Link this to the True output of Check Staffing and the error path.
- Add a Play prompt module that says "There is currently no one ready to accept your call. Let me put you in the callback queue so you don't have to wait on hold" and link this to the False output of Check Staffing.
- Under Terminate/Transfer, select Transfer to flow. Select your TransferToCallbackQueue contact flow and save. Link this to your prompt and the error path.
- Add a Play prompt module that says "We are currently closed. Please call again later." Link this to the Out of Hours option and terminate.
- Save, Publish, and Update your phone number's Contact Flow.
- Now you can test how the caller is routed when you are Available or Unavailable in the CCP. Similarly, if you can change the Basic Hours of operation to see how users are routed.
- Create a contact flow and Import the OnCallFlow from the contact-flows folder.
- Update the Invoke AWS Lambda function module to call a lambda function that looks like ContactRouterLambda and save the module
- Update the Get customer input module to select the Lex bot in the account and save.
- Save, Publish, and test the OnCallFlow contact flow like your TransferToQueue contact flow. The Lambda function we're invoking is picking up two contacts from a backend system and using that to dynamically route to another individual. Look at the ContactRouterLambda to see how we do that.
- Create a new contact flow called InboundLexRouter.
- Under Interact, add a Get customer input module. Add a Text to speech prompt. "Would you like to wait on hold or be called back later when we are ready to serve you?" Select Amazon Lex and the ConnectBot in the account. Add WaitOnHold, CallBack, and Emergency as Intents.
- Create an error flow.
- Under Terminate/Transfer, select Transfer to flow. Select your InboundCallRouter contact flow and save. Link this to the WaitOnHold output and the error path.
- Under Terminate/Transfer, select Transfer to flow. Select your TransferToCallbackQueue contact flow and save. Link this to the Callback output and the error path.
- Under Terminate/Transfer, select Transfer to flow. Select your OnCallFlow contact flow and save. Link this to the Emergency output and the error path.
- Save, Publish, and Test by pointing your phone number to the InboundLexRouter contact flow.
- Create a new contact flow and import the CallerSurvey contact flow.
- Modify the Get customer input module to point to the ConnectBot in the account.
- Save and Publish (test if you'd like).
- Take a note of the Contact Flow ID. It is the last 36 character string in the URL. The URL is formatted like so: https://[CONNECTINSTANCENAME].awsapps.com/connect/contact-flows/edit?id=arn:aws:connect::[ACCOUNTNUMBER]:instance/[INSTANCEID]/contact-flow/[CONTACTFLOWID]
- Create a new contact flow and import the EntryPoint contact flow.
- Modify the first Invoke AWS Lambda function to ensure it is calling a lambda function that looks like GetHotMessageLambda.
- Modify the second Invoke AWS Lambda function to ensure it is calling a lambda function that looks like ContactLookupLambda.
- Modify the Get customer input module to point to the ConnectBot in the account.
- Modify the second Invoke AWS Lambda function to ensure it is calling a lambda function that looks like PutContactinQueueLambda. Modify the OutboundContactFlowId parameter to be the contact flow ID of the survey contact flow.
- Modify the Transfer to flow module at the end of the contact flow to point to the InboundLexRouter contact flow.
- Save, Publish, and Test.
This library is licensed under the MIT-0 License. See the LICENSE file.