For enhanced customer engagement and satisfaction, there are instances where agents require assistance during active calls or chats. This assistance can be automated using Connect Contact Lens, which can process voice streams and chat transcripts in real-time and respond to predefined scenarios set by contact centre managers.
For instance, if a customer expresses dissatisfaction about a delivery delay (the running example that we will use in this document), the system can swiftly detect this issue and provide agents with optimal instructions to placate the customer, reassuring them that the matter is being addressed. This capability can be extended to various specific requirements for notifying agents about Connect Contact Lens detections or suggestions.
In Engage, we support not only standard Connect Contact attributes but also Label/Panel/Button attributes. This document outlines the solution for applying these attributes along with Connect Contact Lens to automatically assist and notify agents.
Contact Attributes
Standard attributes are excellent for providing agents with context about the contact they are managing. Engage provides Label and Panel attributes, which are essentially the standard contact attributes but presented with a distinctive and noticeable appearance.
These attributes can be tailored to use a variety of colour themes and icons. Label attributes (shown in orange in the sample figure below) are excellent for concise pieces of information like status updates. Panel attributes (displayed in blue in the sample figure below) are ideal for longer pieces of information that extend across multiple lines and need extra formatting.

[.callout-primary--info]For comprehensive guidance on configuring label and panel attributes within Engage, we recommend consulting the following resources[.callout-primary--info]
- https://resources.localmeasure.com/topics/attributes
- https://resources.localmeasure.com/articles/label-attributes
- https://resources.localmeasure.com/articles/panel-attributes
Engage Button Attribute
As depicted in the below sample figure ("View Ticket" and "Some other action" buttons), Engage also enables the creation of buttons that link to external URLs in new browser tabs.
- You can have the freedom to create as many buttons as needed.
- These buttons will appear in Active Contacts and Historical.
- URLS are not validated by Engage.
- Clicking on links will open the link in a new tab.

[.callout-primary--info]For more information, please refer to the section "Button contact attributes" in : https://resources.localmeasure.com/articles/displaying-attributes-to-agents[.callout-primary--info]
Architecture
To react to events published by Connect Contact Lens Rules, we need to deploy this solution in AWS. The overall solution architecture is illustrated below:
The steps include:
- Create Connect Contact Lens Rule with an action type of publishing an EventBridge event. This rule is designed for real-time call/chat conditions, ensuring that contact attributes are promptly updated (near real-time) immediately after the rule is triggered by Connect Contact Lens.
- Create a Lambda function to handle the actions, specifically updating the contact's Standard/Label/Panel attributes. This ensures that agents will see these updates in real-time in the middle of Engage.
- Create an EventBridge rule with a target of the Lambda function.
By following these steps and deploying this architecture, updates to contact attributes will be handled swiftly and seamlessly, providing real-time insights for agents during engagement.

Create Connect Contact Lens Rule
- Navigate to the Rules section under Contact Lens, under the Analytics and Optimization Menu.
- Click on "Create a rule".
- Choose "Conversational analytics".
- In the "When" dropdown, choose "A contact lens real-time call (or chat) analysis is available". In this example, we select "Chat".
- Click "Add Condition" and select the condition you wish to apply to contacts. In our example, we choose "Words or Phrases - Exact Match" with the appropriate phrases. You can then select whether these phrases can be from the customer, agent, or both.
- Click "Add Action" and choose "Generate an EventBridge Event". Provide a name for this action; this name will be visible in the EventBridge event received in Lambda later.
- Review the rule and publish it.
[.callout-primary--info]For further information on setting up Contact Lens Rules in Connect please refer to this AWS document. [.callout-primary--info]
Create the Lambda Function
Create a lambda function to manage the events. In this instance, we name the function "_ConnectHandleRulesActions" and utilize Python 3.12.

Incorporate the provided sample code into the Lambda function. You can modify the code as needed to suit your requirements, such as adding new conditions or adjusting the text for custom attributes.
Ensure that the Lambda function has the necessary "connect:UpdateContactAttributes" permission. Refer to the sample policy below for guidance.
[.callout-primary--info]Replace all the placeholders with your relevant Amazon Connect and Account Information[.callout-primary--info]
Create EventBridge Rule
- Navigate to the Amazon EventBridge service.
- On the left side, click on "Rules", then select "Create rule".
- Choose "Rule with an event pattern" and proceed.
- Opt for "Use pattern form" and configure the AWS service to "Amazon Connect" with the Event type set to "Realtime Rules Matched".
- Specify the action by providing the name of the action set in the Connect Contact Lens Rule, or proceed by selecting "Any action type".
- For the Target, select the Lambda function you previously created.
- Review the details and create the rule.
Agent Experience
Using our "Delay in Delivery" example, the outcome of deploying the solution will resemble the figure below.
