ConnectContactLens

Client

class ConnectContactLens.Client

A low-level client representing Amazon Connect Contact Lens

Contact Lens for Amazon Connect enables you to analyze conversations between customer and agents, by using speech transcription, natural language processing, and intelligent search capabilities. It performs sentiment analysis, detects issues, and enables you to automatically categorize contacts.

Contact Lens for Amazon Connect provides both real-time and post-call analytics of customer-agent conversations. For more information, see Analyze conversations using Contact Lens in the Amazon Connect Administrator Guide .

client = session.create_client('connect-contact-lens')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_realtime_contact_analysis_segments(**kwargs)

Provides a list of analysis segments for a real-time analysis session.

See also: AWS API Documentation

Request Syntax

response = client.list_realtime_contact_analysis_segments(
    InstanceId='string',
    ContactId='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • InstanceId (string) --

    [REQUIRED]

    The identifier of the Amazon Connect instance.

  • ContactId (string) --

    [REQUIRED]

    The identifier of the contact.

  • MaxResults (integer) -- The maximimum number of results to return per page.
  • NextToken (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.
Return type

dict

Returns

Response Syntax

{
    'Segments': [
        {
            'Transcript': {
                'Id': 'string',
                'ParticipantId': 'string',
                'ParticipantRole': 'string',
                'Content': 'string',
                'BeginOffsetMillis': 123,
                'EndOffsetMillis': 123,
                'Sentiment': 'POSITIVE'|'NEUTRAL'|'NEGATIVE',
                'IssuesDetected': [
                    {
                        'CharacterOffsets': {
                            'BeginOffsetChar': 123,
                            'EndOffsetChar': 123
                        }
                    },
                ]
            },
            'Categories': {
                'MatchedCategories': [
                    'string',
                ],
                'MatchedDetails': {
                    'string': {
                        'PointsOfInterest': [
                            {
                                'BeginOffsetMillis': 123,
                                'EndOffsetMillis': 123
                            },
                        ]
                    }
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Segments (list) --

      An analyzed transcript or category.

      • (dict) --

        An analyzed segment for a real-time analysis session.

        • Transcript (dict) --

          The analyzed transcript.

          • Id (string) --

            The identifier of the transcript.

          • ParticipantId (string) --

            The identifier of the participant.

          • ParticipantRole (string) --

            The role of participant. For example, is it a customer, agent, or system.

          • Content (string) --

            The content of the transcript.

          • BeginOffsetMillis (integer) --

            The beginning offset in the contact for this transcript.

          • EndOffsetMillis (integer) --

            The end offset in the contact for this transcript.

          • Sentiment (string) --

            The sentiment of the detected for this piece of transcript.

          • IssuesDetected (list) --

            List of positions where issues were detected on the transcript.

            • (dict) --

              Potential issues that are detected based on an artificial intelligence analysis of each turn in the conversation.

              • CharacterOffsets (dict) --

                The offset for when the issue was detected in the segment.

                • BeginOffsetChar (integer) --

                  The beginning of the issue.

                • EndOffsetChar (integer) --

                  The end of the issue.

        • Categories (dict) --

          The matched category rules.

          • MatchedCategories (list) --

            The category rules that have been matched in the analyzed segment.

            • (string) --
          • MatchedDetails (dict) --

            The category rule that was matched and when it occurred in the transcript.

            • (string) --

              • (dict) --

                Provides information about the category rule that was matched.

                • PointsOfInterest (list) --

                  The section of audio where the category rule was detected.

                  • (dict) --

                    The section of the contact audio where that category rule was detected.

                    • BeginOffsetMillis (integer) --

                      The beginning offset in milliseconds where the category rule was detected.

                    • EndOffsetMillis (integer) --

                      The ending offset in milliseconds where the category rule was detected.

    • NextToken (string) --

      If there are additional results, this is the token for the next set of results. If response includes nextToken there are two possible scenarios:

      • There are more segments so another call is required to get them.
      • There are no more segments at this time, but more may be available later (real-time analysis is in progress) so the client should call the operation again to get new segments.

      If response does not include nextToken , the analysis is completed (successfully or failed) and there are no more segments to retrieve.

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class ConnectContactLens.Client.exceptions.AccessDeniedException

You do not have sufficient access to perform this action.

Example

try:
  ...
except client.exceptions.AccessDeniedException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    You do not have sufficient access to perform this action.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class ConnectContactLens.Client.exceptions.InternalServiceException

Request processing failed due to an error or failure with the service.

Example

try:
  ...
except client.exceptions.InternalServiceException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    Request processing failed due to an error or failure with the service.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class ConnectContactLens.Client.exceptions.InvalidRequestException

The request is not valid.

Example

try:
  ...
except client.exceptions.InvalidRequestException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    The request is not valid.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class ConnectContactLens.Client.exceptions.ResourceNotFoundException

The specified resource was not found.

Example

try:
  ...
except client.exceptions.ResourceNotFoundException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    The specified resource was not found.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class ConnectContactLens.Client.exceptions.ThrottlingException

The throttling limit has been exceeded.

Example

try:
  ...
except client.exceptions.ThrottlingException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'Message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    The throttling limit has been exceeded.

    • Message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.

Paginators

The available paginators are: