AWS Contact Center

Simplify contact flow management by leveraging modules in Amazon Connect

Customers often have repeatable logic that is needed throughout the customer journey in contact center experiences. We’re going to take a look at how to simplify contact flow management by leveraging modules in Amazon Connect. The ability to build contact flow logic once, and reference it from other contact flows has been a customer request to make it easier to implement things like holiday checks, authentication, custom repeatable business logic, and more. In order to meet this customer request, we’ve introduced a new security role, a Contact flow module editor. This will allow users to create, update, and publish contact flow modules that can be called from inside both existing and new contact flows. This allows users to create and publish a piece of logic as a contact flow module once, and then reuse it in many contact flows without needing to manage that logic each time it’s implemented. Changes to the contact flow module affect all flows that call it. Imagine having a module that handles all company holiday checks, instead of managing this logic multiple times in every flow that needs to check it. You build it once and call it similar to a subroutine in programming. Let’s dive in.

Overview of solution

This solution demonstrates how logic can be encapsulated in a module and called from a separate contact flow. In the Amazon Connect admin console, you will create a contact flow that makes use of a new block, “Invoke module”, which will allow you to transfer a call to a module and continue the contact flow logic when the call returns from this module. The initial contact flow determines if the caller is calling for “sales” or “support” and then calls a module that handles authenticating the caller before the call is transferred. Since this is for demonstration purposes only we simply collect the account number and zip code in the mode and return “AuthStatus = true” if the zip code was set to “12345”. “AccountNumber” and “AuthStatus” are stored as contact attributes that can be referenced once the call has returned to the calling contact flow.

You can see the details of how the module is invoked and how the control is sent back to the calling flow by reviewing in Amazon CloudWatch logs.

Prerequisites

For this blog post, you should have the following prerequisites:

Setting up the solution

These instructions assume a working knowledge of Amazon Connect and Amazon CloudWatch. For details on how to perform basic administration tasks with these services, see the following:

Step 1 : Add permissions to Security profile in Amazon Connect for managing contact flow modules

  1. Sign into your Amazon Connect instance
  2. Navigate to the “Users” tab within your Amazon Connect instance.
  3. Choose “Security profiles”.
  4. Choose a security profile that needs to manage contact flow modules from the list.
  5. Choose “Numbers and flows”.
  6. Choose the check box under “All” for “Contact flow modules”.
  7. Choose “Save” button at the bottom left.

Security profile settings

Step 2: Importing and configuring the contact flow module into your Amazon Connect instance

  1. Download a pre-built contact flow module.
  2. Sign into your Amazon Connect instance
  3. Navigate to the “Routing” tab within your Amazon Connect instance.
  4. Choose “Contact flows”.
  5. Choose “Modules”
  6. Choose “Create flow module” button at the top-right.
  7. Select drop down next to Save, choose “Import flow” at the top right./li>
  8. Choose “Select”, and select the mod-Authentication file that you download.
  9. Choose “Import” button.
  10. Save and publish your contact flow module, you should see the module flow details as shown below.

Step 3: Importing and configuring the contact flow into your Amazon Connect instance

    1. Download a pre-built contact flow.
    2. Sign into your Amazon Connect instance
    3. Navigate to the “Routing” tab within your Amazon Connect instance.
    4. Choose “Contact flows”.
    5. Choose “Contact flows” tab.

Contact flow tab

  1. Choose “Create contact flow” button at the top-right.
  2. Select drop down next to Save, choose “Import flow” at the top right.
  3. Choose “Select”, and select the A-Main-Flow file that you download.
  4. Choose “Import” button.
  5. Save and publish your contact flow, you should see the flow details as shown below.

Step 4: Associate a contact flow on a DID/Toll Free Number and testing the modules

  1. Claim a phone number and load the contact flow “A-Main-Flow” that you imported in Step 3 and move to Step 5.
  2. If you plan to use an existing phone number, navigate to the “Routing” tab within your Amazon Connect instance.
  3. Choose “Phone numbers”.
  4. Choose the phone number that you want to assign to the contact flow.
  5. Choose “A-Main-Flow” from the “Contact flow / IVR” list box.
  6. Choose “Save” button.
  7. Make a call to the number that you assigned to the “A-Main-Flow” contact flow.
  8. Follow the prompts and enter the account number and zip code. For successful authentication, enter “12345” as zip code. For failed authentication, enter any random 5-digit number. This experience is captured in the new module that you created, contact attributes are updated with the authentication results.
  9. You will hear the authentication results from the contact flow that called the module, which will demonstrate how the data can be shared/passed between contact flows and modules.

Step 5: Tracking Amazon Connect modules in Amazon CloudWatch Logs

    1. Sign in to your AWS Management Console and go to CloudWatch.
    2. Choose “Log groups” at left navigation bar.
    3. Choose “/aws/connect/{your-instance-alias}” from the list.
    4. Choose latest the log group from the list.
    5. Below is an excerpt from the CloudWatch logs that shows the execution of the flow module:

		{
		  "ContactId": "4f4ef161-00bd-4398-a89b-c727dff71259",
		  "ContactFlowId": "arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/contact-flow/2604bf25-3ac3-4a19-b224-bcc258e117f9",
		  "ContactFlowName": "A-Welcome-Flow",
		  "ContactFlowModuleType": "InvokeFlowModule",
		  "Timestamp": "2021-11-14T21:09:48.279Z",
		  "Parameters": {
			"FlowModuleId": "752ce8ff-8e0c-4cd9-85b0-5f8a7a2b2b67"
		  }
		}		
		
    1. Below is an excerpt from the CloudWatch logs that shows the entry of the flow module, that indicates the calling contact flow and the module:

		{
		  "ContactId": "4f4ef161-00bd-4398-a89b-c727dff71259",
		  "ContactFlowId": "arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/flow-module/752ce8ff-8e0c-4cd9-85b0-5f8a7a2b2b67",
		  "ContactFlowName": "mod-Authentication",
		  "ContactFlowModuleType": "SetLoggingBehavior",
		  "Timestamp": "2021-11-14T21:09:48.527Z",
		  "Parameters": {
			"LoggingBehavior": "Enable"
		  },
		  "ModuleExecutionStack": [
			"arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/flow-module/752ce8ff-8e0c-4cd9-85b0-5f8a7a2b2b67",
			"arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/contact-flow/2604bf25-3ac3-4a19-b224-bcc258e117f9"
		  ]
		}		
		
    1. Below is an excerpt from the CloudWatch logs that shows the exit of the flow module, back to the calling contact flow:

		{
		  "ContactId": "4f4ef161-00bd-4398-a89b-c727dff71259",
		  "ContactFlowId": "arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/flow-module/752ce8ff-8e0c-4cd9-85b0-5f8a7a2b2b67",
		  "ContactFlowName": "mod-Authentication",
		  "ContactFlowModuleType": "ReturnFromFlowModule",
		  "Timestamp": "2021-11-14T21:10:17.660Z",
		  "Parameters": {},
		  "ModuleExecutionStack": [
			"arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/flow-module/752ce8ff-8e0c-4cd9-85b0-5f8a7a2b2b67",
			"arn:aws:connect:us-west-2:5930xxxxxxxx:instance/193f1b67-3fea-46ff-abf7-8a25ca45866f/contact-flow/2604bf25-3ac3-4a19-b224-bcc258e117f9"
		  ]
		}
		

Cleaning up

To avoid incurring future charges, release the phone number that was claimed for testing purpose in the step 4.

Conclusion

This post demonstrates how to leverage Amazon Connect contact flow modules to modularize your contact flows and re-use them for identifying and authenticating the customer. The same framework can be used for different use cases, for example sending SMS, checking bank balance, resetting password etc.

Related links

To learn more about the technologies or features used to create this solution, see the following: