Local Measure Engage provides full email routing capabilities for Amazon Connect. A key benefit is that all emails are routed via Amazon Connect - and not brought into the agent desktop on the side - which means that all queue and agents reports are also available for the email channel.
Prerequisites
- Amazon Simple Email Services (SES) being configured correctly
- The Local Measure Engage CloudFormation stack having been deployed with the required information specified
- A Distribution flow having been specified in Local Measure Engage
Processing email content for routing
Various aspects of the email can be used to make routing decisions. The simplest example of this is using the '_hidden_contact_origin' (From email address) or '_hidden_contact_destination' (To email address) to make routing decisions. The below image shows how the '_hidden_contact_destination' attributes can be used to route emails sent to different email addresses to different queues:

In addition, the email content can also be evaluated in order to further enhance routing. In such a scenario a Lambda function is used to load and evaluate the email and to return values to Amazon Connect.
First, create a Lambda function that can load and evaluate the email. The below Python snippet shows how to fetch and load the email using the default Python Email library:
Third-party open source libraries such as html2text or BeautifulSoup can be used to convert HTML based email bodies to text. Once the text has been extracted, the standard Python Regular Expression library can be used for e.g. keyword spotting. Other options include using Amazon Comprehend for language detection or topic modeling to more accurately route based on the content of the email.
To invoke the lambda function, add a Lambda block to the contact flow as shown below:

Ensure to change the 'Destination Key' name to match the name of the variable expected in your Lambda code. Specify the Value to be dynamic and set the key to '_hidden_key' as shown above. The '_hidden_key' attribute contains the required information of where the email is stored in S3.