2025/08/08 - Amazon Connect Service - 1 new2 updated api methods
Changes This release adds a new API GetContactMetrics for Amazon Connect.
Gets the real-time metrics of the specified contact.
Use cases
Following are common uses cases for this API:
You can use this API to retrieve the position of the contact in the queue.
Endpoints: See Amazon Connect endpoints and quotas.
See also: AWS API Documentation
Request Syntax
client.get_contact_metrics( InstanceId='string', ContactId='string', Metrics=[ { 'Name': 'POSITION_IN_QUEUE' }, ] )
string
[REQUIRED]
The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.
string
[REQUIRED]
The identifier of the contact in this instance of Amazon Connect.
list
[REQUIRED]
A list of contact-level metrics to retrieve.
(dict) --
The object that contains information about metric being requested.
Name (string) -- [REQUIRED]
The name of the metric being retrieved in type String.
dict
Response Syntax
{ 'MetricResults': [ { 'Name': 'POSITION_IN_QUEUE', 'Value': { 'Number': 123.0 } }, ], 'Id': 'string', 'Arn': 'string' }
Response Structure
(dict) --
MetricResults (list) --
A list of metric results containing the calculated values for each requested metric. Each result includes the metric name and its corresponding calculated value.
(dict) --
Object containing information about metric requested for the contact.
Name (string) --
The name of the metric being retrieved in type String.
Value (dict) --
Object result associated with the metric received.
Number (float) --
The number of type Double. This number is the contact's position in queue.
Id (string) --
The unique identifier of the contact for which metrics were retrieved.
Arn (string) --
The ARN of the contact for which metrics were retrieved.
{'SearchFilter': {'AttributeFilter': {'AndCondition': {'HierarchyGroupCondition': {'HierarchyGroupMatchType': 'EXACT ' '| ' 'WITH_CHILD_GROUPS', 'Value': 'string'}}, 'OrConditions': {'HierarchyGroupCondition': {'HierarchyGroupMatchType': 'EXACT ' '| ' 'WITH_CHILD_GROUPS', 'Value': 'string'}}}}}
Searches AgentStatuses in an Amazon Connect instance, with optional filtering.
See also: AWS API Documentation
Request Syntax
client.search_agent_statuses( InstanceId='string', NextToken='string', MaxResults=123, SearchFilter={ 'AttributeFilter': { 'OrConditions': [ { 'TagConditions': [ { 'TagKey': 'string', 'TagValue': 'string' }, ], 'HierarchyGroupCondition': { 'Value': 'string', 'HierarchyGroupMatchType': 'EXACT'|'WITH_CHILD_GROUPS' } }, ], 'AndCondition': { 'TagConditions': [ { 'TagKey': 'string', 'TagValue': 'string' }, ], 'HierarchyGroupCondition': { 'Value': 'string', 'HierarchyGroupMatchType': 'EXACT'|'WITH_CHILD_GROUPS' } }, 'TagCondition': { 'TagKey': 'string', 'TagValue': 'string' } } }, SearchCriteria={ 'OrConditions': [ {'... recursive ...'}, ], 'AndConditions': [ {'... recursive ...'}, ], 'StringCondition': { 'FieldName': 'string', 'Value': 'string', 'ComparisonType': 'STARTS_WITH'|'CONTAINS'|'EXACT' } } )
string
[REQUIRED]
The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance.
string
The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
integer
The maximum number of results to return per page.
dict
Filters to be applied to search results.
AttributeFilter (dict) --
An object that can be used to specify Tag conditions inside the SearchFilter. This accepts an OR of AND (List of List) input where:
The top level list specifies conditions that need to be applied with OR operator.
The inner list specifies conditions that need to be applied with AND operator.
OrConditions (list) --
A list of conditions which would be applied together with an OR condition.
(dict) --
A list of conditions which would be applied together with an AND condition.
TagConditions (list) --
A leaf node condition which can be used to specify a tag condition.
(dict) --
A leaf node condition which can be used to specify a tag condition, for example, HAVE BPO = 123.
TagKey (string) --
The tag key in the tag condition.
TagValue (string) --
The tag value in the tag condition.
HierarchyGroupCondition (dict) --
A leaf node condition which can be used to specify a hierarchy group condition.
Value (string) --
The value in the hierarchy group condition.
HierarchyGroupMatchType (string) --
The type of hierarchy group match.
AndCondition (dict) --
A list of conditions which would be applied together with an AND condition.
TagConditions (list) --
A leaf node condition which can be used to specify a tag condition.
(dict) --
A leaf node condition which can be used to specify a tag condition, for example, HAVE BPO = 123.
TagKey (string) --
The tag key in the tag condition.
TagValue (string) --
The tag value in the tag condition.
HierarchyGroupCondition (dict) --
A leaf node condition which can be used to specify a hierarchy group condition.
Value (string) --
The value in the hierarchy group condition.
HierarchyGroupMatchType (string) --
The type of hierarchy group match.
TagCondition (dict) --
A leaf node condition which can be used to specify a tag condition, for example, HAVE BPO = 123.
TagKey (string) --
The tag key in the tag condition.
TagValue (string) --
The tag value in the tag condition.
dict
The search criteria to be used to return agent statuses.
OrConditions (list) --
A list of conditions which would be applied together with an OR condition.
(dict) --
The search criteria to be used to return agent statuses.
AndConditions (list) --
A leaf node condition which can be used to specify a string condition.
description, state, type, displayOrder, and resourceID.
(dict) --
The search criteria to be used to return agent statuses.
StringCondition (dict) --
A leaf node condition which can be used to specify a string condition.
description, state, type, displayOrder, and resourceID.
FieldName (string) --
The name of the field in the string condition.
Value (string) --
The value of the string.
ComparisonType (string) --
The type of comparison to be made when evaluating the string condition.
dict
Response Syntax
{ 'AgentStatuses': [ { 'AgentStatusARN': 'string', 'AgentStatusId': 'string', 'Name': 'string', 'Description': 'string', 'Type': 'ROUTABLE'|'CUSTOM'|'OFFLINE', 'DisplayOrder': 123, 'State': 'ENABLED'|'DISABLED', 'Tags': { 'string': 'string' }, 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' }, ], 'NextToken': 'string', 'ApproximateTotalCount': 123 }
Response Structure
(dict) --
AgentStatuses (list) --
The search criteria to be used to return agent statuses.
(dict) --
Contains information about an agent status.
AgentStatusARN (string) --
The Amazon Resource Name (ARN) of the agent status.
AgentStatusId (string) --
The identifier of the agent status.
Name (string) --
The name of the agent status.
Description (string) --
The description of the agent status.
Type (string) --
The type of agent status.
DisplayOrder (integer) --
The display order of the agent status.
State (string) --
The state of the agent status.
Tags (dict) --
The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.
(string) --
(string) --
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
NextToken (string) --
If there are additional results, this is the token for the next set of results.
ApproximateTotalCount (integer) --
The total number of agent statuses which matched your search query.
{'SearchCriteria': {'HierarchyGroupCondition': {'HierarchyGroupMatchType': 'EXACT ' '| ' 'WITH_CHILD_GROUPS', 'Value': 'string'}}, 'SearchFilter': {'AttributeFilter': {'AndCondition': {'HierarchyGroupCondition': {'HierarchyGroupMatchType': 'EXACT ' '| ' 'WITH_CHILD_GROUPS', 'Value': 'string'}}, 'OrConditions': {'HierarchyGroupCondition': {'HierarchyGroupMatchType': 'EXACT ' '| ' 'WITH_CHILD_GROUPS', 'Value': 'string'}}}}}
Searches UserHierarchyGroups in an Amazon Connect instance, with optional filtering.
See also: AWS API Documentation
Request Syntax
client.search_user_hierarchy_groups( InstanceId='string', NextToken='string', MaxResults=123, SearchFilter={ 'AttributeFilter': { 'OrConditions': [ { 'TagConditions': [ { 'TagKey': 'string', 'TagValue': 'string' }, ], 'HierarchyGroupCondition': { 'Value': 'string', 'HierarchyGroupMatchType': 'EXACT'|'WITH_CHILD_GROUPS' } }, ], 'AndCondition': { 'TagConditions': [ { 'TagKey': 'string', 'TagValue': 'string' }, ], 'HierarchyGroupCondition': { 'Value': 'string', 'HierarchyGroupMatchType': 'EXACT'|'WITH_CHILD_GROUPS' } }, 'TagCondition': { 'TagKey': 'string', 'TagValue': 'string' } } }, SearchCriteria={ 'OrConditions': [ {'... recursive ...'}, ], 'AndConditions': [ {'... recursive ...'}, ], 'StringCondition': { 'FieldName': 'string', 'Value': 'string', 'ComparisonType': 'STARTS_WITH'|'CONTAINS'|'EXACT' }, 'HierarchyGroupCondition': { 'Value': 'string', 'HierarchyGroupMatchType': 'EXACT'|'WITH_CHILD_GROUPS' } } )
string
[REQUIRED]
The identifier of the Amazon Connect instance. You can find the instanceId in the ARN of the instance.
string
The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
integer
The maximum number of results to return per page.
dict
Filters to be applied to search results.
AttributeFilter (dict) --
An object that can be used to specify Tag conditions inside the SearchFilter. This accepts an OR or AND (List of List) input where:
The top level list specifies conditions that need to be applied with OR operator.
The inner list specifies conditions that need to be applied with AND operator.
OrConditions (list) --
A list of conditions which would be applied together with an OR condition.
(dict) --
A list of conditions which would be applied together with an AND condition.
TagConditions (list) --
A leaf node condition which can be used to specify a tag condition.
(dict) --
A leaf node condition which can be used to specify a tag condition, for example, HAVE BPO = 123.
TagKey (string) --
The tag key in the tag condition.
TagValue (string) --
The tag value in the tag condition.
HierarchyGroupCondition (dict) --
A leaf node condition which can be used to specify a hierarchy group condition.
Value (string) --
The value in the hierarchy group condition.
HierarchyGroupMatchType (string) --
The type of hierarchy group match.
AndCondition (dict) --
A list of conditions which would be applied together with an AND condition.
TagConditions (list) --
A leaf node condition which can be used to specify a tag condition.
(dict) --
A leaf node condition which can be used to specify a tag condition, for example, HAVE BPO = 123.
TagKey (string) --
The tag key in the tag condition.
TagValue (string) --
The tag value in the tag condition.
HierarchyGroupCondition (dict) --
A leaf node condition which can be used to specify a hierarchy group condition.
Value (string) --
The value in the hierarchy group condition.
HierarchyGroupMatchType (string) --
The type of hierarchy group match.
TagCondition (dict) --
A leaf node condition which can be used to specify a tag condition, for example, HAVE BPO = 123.
TagKey (string) --
The tag key in the tag condition.
TagValue (string) --
The tag value in the tag condition.
dict
The search criteria to be used to return UserHierarchyGroups.
OrConditions (list) --
A list of conditions which would be applied together with an OR condition.
(dict) --
The search criteria to be used to return userHierarchyGroup.
AndConditions (list) --
A list of conditions which would be applied together with an AND condition.
(dict) --
The search criteria to be used to return userHierarchyGroup.
StringCondition (dict) --
A leaf node condition which can be used to specify a string condition.
parentId, levelId, and resourceID.
FieldName (string) --
The name of the field in the string condition.
Value (string) --
The value of the string.
ComparisonType (string) --
The type of comparison to be made when evaluating the string condition.
HierarchyGroupCondition (dict) --
A leaf node condition which can be used to specify a hierarchy group condition.
Value (string) --
The value in the hierarchy group condition.
HierarchyGroupMatchType (string) --
The type of hierarchy group match.
dict
Response Syntax
{ 'UserHierarchyGroups': [ { 'Id': 'string', 'Arn': 'string', 'Name': 'string', 'LevelId': 'string', 'HierarchyPath': { 'LevelOne': { 'Id': 'string', 'Arn': 'string', 'Name': 'string', 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' }, 'LevelTwo': { 'Id': 'string', 'Arn': 'string', 'Name': 'string', 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' }, 'LevelThree': { 'Id': 'string', 'Arn': 'string', 'Name': 'string', 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' }, 'LevelFour': { 'Id': 'string', 'Arn': 'string', 'Name': 'string', 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' }, 'LevelFive': { 'Id': 'string', 'Arn': 'string', 'Name': 'string', 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' } }, 'Tags': { 'string': 'string' }, 'LastModifiedTime': datetime(2015, 1, 1), 'LastModifiedRegion': 'string' }, ], 'NextToken': 'string', 'ApproximateTotalCount': 123 }
Response Structure
(dict) --
UserHierarchyGroups (list) --
Information about the userHierarchyGroups.
(dict) --
Contains information about a hierarchy group.
Id (string) --
The identifier of the hierarchy group.
Arn (string) --
The Amazon Resource Name (ARN) of the hierarchy group.
Name (string) --
The name of the hierarchy group.
LevelId (string) --
The identifier of the level in the hierarchy group.
HierarchyPath (dict) --
Information about the levels in the hierarchy group.
LevelOne (dict) --
Information about level one.
Id (string) --
The identifier of the hierarchy group.
Arn (string) --
The Amazon Resource Name (ARN) of the hierarchy group.
Name (string) --
The name of the hierarchy group.
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
LevelTwo (dict) --
Information about level two.
Id (string) --
The identifier of the hierarchy group.
Arn (string) --
The Amazon Resource Name (ARN) of the hierarchy group.
Name (string) --
The name of the hierarchy group.
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
LevelThree (dict) --
Information about level three.
Id (string) --
The identifier of the hierarchy group.
Arn (string) --
The Amazon Resource Name (ARN) of the hierarchy group.
Name (string) --
The name of the hierarchy group.
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
LevelFour (dict) --
Information about level four.
Id (string) --
The identifier of the hierarchy group.
Arn (string) --
The Amazon Resource Name (ARN) of the hierarchy group.
Name (string) --
The name of the hierarchy group.
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
LevelFive (dict) --
Information about level five.
Id (string) --
The identifier of the hierarchy group.
Arn (string) --
The Amazon Resource Name (ARN) of the hierarchy group.
Name (string) --
The name of the hierarchy group.
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
Tags (dict) --
The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.
(string) --
(string) --
LastModifiedTime (datetime) --
The timestamp when this resource was last modified.
LastModifiedRegion (string) --
The Amazon Web Services Region where this resource was last modified.
NextToken (string) --
If there are additional results, this is the token for the next set of results.
ApproximateTotalCount (integer) --
The total number of userHierarchyGroups which matched your search query.