Amazon Connect Participant Service

2019/11/21 - Amazon Connect Participant Service - 5 new api methods

Changes  Update connectparticipant client to latest version

GetTranscript (new) Link ¶

Retrieves a transcript of the session. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.

See also: AWS API Documentation

Request Syntax

client.get_transcript(
    ContactId='string',
    MaxResults=123,
    NextToken='string',
    ScanDirection='FORWARD'|'BACKWARD',
    SortOrder='DESCENDING'|'ASCENDING',
    StartPosition={
        'Id': 'string',
        'AbsoluteTime': 'string',
        'MostRecent': 123
    },
    ConnectionToken='string'
)
type ContactId:

string

param ContactId:

The contactId from the current contact chain for which transcript is needed.

type MaxResults:

integer

param MaxResults:

The maximum number of results to return in the page. Default: 10.

type NextToken:

string

param NextToken:

The pagination token. Use the value returned previously in the next subsequent request to retrieve the next set of results.

type ScanDirection:

string

param ScanDirection:

The direction from StartPosition from which to retrieve message. Default: BACKWARD when no StartPosition is provided, FORWARD with StartPosition.

type SortOrder:

string

param SortOrder:

The sort order for the records. Default: DESCENDING.

type StartPosition:

dict

param StartPosition:

A filtering option for where to start.

  • Id (string) --

    The ID of the message or event where to start.

  • AbsoluteTime (string) --

    The time in ISO format where to start.

    It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

  • MostRecent (integer) --

    The start position of the most recent message where you want to start.

type ConnectionToken:

string

param ConnectionToken:

[REQUIRED]

The authentication token associated with the participant's connection.

rtype:

dict

returns:

Response Syntax

{
    'InitialContactId': 'string',
    'Transcript': [
        {
            'AbsoluteTime': 'string',
            'Content': 'string',
            'ContentType': 'string',
            'Id': 'string',
            'Type': 'MESSAGE'|'EVENT'|'CONNECTION_ACK',
            'ParticipantId': 'string',
            'DisplayName': 'string',
            'ParticipantRole': 'AGENT'|'CUSTOMER'|'SYSTEM'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • InitialContactId (string) --

      The initial contact ID for the contact.

    • Transcript (list) --

      The list of messages in the session.

      • (dict) --

        An item - message or event - that has been sent.

        • AbsoluteTime (string) --

          The time when the message or event was sent.

          It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

        • Content (string) --

          The content of the message or event.

        • ContentType (string) --

          The type of content of the item.

        • Id (string) --

          The ID of the item.

        • Type (string) --

          Type of the item: message or event.

        • ParticipantId (string) --

          The ID of the sender in the session.

        • DisplayName (string) --

          The chat display name of the sender.

        • ParticipantRole (string) --

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

    • NextToken (string) --

      The pagination token. Use the value returned previously in the next subsequent request to retrieve the next set of results.

CreateParticipantConnection (new) Link ¶

Creates the participant's connection. Note that ParticipantToken is used for invoking this API instead of ConnectionToken.

The participant token is valid for the lifetime of the participant – until the they are part of a contact.

The response URL for WEBSOCKET Type has a connect expiry timeout of 100s. Clients must manually connect to the returned websocket URL and subscribe to the desired topic.

For chat, you need to publish the following on the established websocket connection:

{"topic":"aws/subscribe","content":{"topics":["aws/chat"]}}

Upon websocket URL expiry, as specified in the response ConnectionExpiry parameter, clients need to call this API again to obtain a new websocket URL and perform the same steps as before.

See also: AWS API Documentation

Request Syntax

client.create_participant_connection(
    Type=[
        'WEBSOCKET'|'CONNECTION_CREDENTIALS',
    ],
    ParticipantToken='string'
)
type Type:

list

param Type:

[REQUIRED]

Type of connection information required.

  • (string) --

type ParticipantToken:

string

param ParticipantToken:

[REQUIRED]

Participant Token as obtained from StartChatContact API response.

rtype:

dict

returns:

Response Syntax

{
    'Websocket': {
        'Url': 'string',
        'ConnectionExpiry': 'string'
    },
    'ConnectionCredentials': {
        'ConnectionToken': 'string',
        'Expiry': 'string'
    }
}

Response Structure

  • (dict) --

    • Websocket (dict) --

      Creates the participant's websocket connection.

      • Url (string) --

        The URL of the websocket.

      • ConnectionExpiry (string) --

        The URL expiration timestamp in ISO date format.

        It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

    • ConnectionCredentials (dict) --

      Creates the participant's connection credentials. The authentication token associated with the participant's connection.

      • ConnectionToken (string) --

        The connection token.

      • Expiry (string) --

        The expiration of the token.

        It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

SendMessage (new) Link ¶

Sends a message. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.

See also: AWS API Documentation

Request Syntax

client.send_message(
    ContentType='string',
    Content='string',
    ClientToken='string',
    ConnectionToken='string'
)
type ContentType:

string

param ContentType:

[REQUIRED]

The type of the content. Supported types are text/plain.

type Content:

string

param Content:

[REQUIRED]

The content of the message.

type ClientToken:

string

param ClientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type ConnectionToken:

string

param ConnectionToken:

[REQUIRED]

The authentication token associated with the connection.

rtype:

dict

returns:

Response Syntax

{
    'Id': 'string',
    'AbsoluteTime': 'string'
}

Response Structure

  • (dict) --

    • Id (string) --

      The ID of the message.

    • AbsoluteTime (string) --

      The time when the message was sent.

      It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

SendEvent (new) Link ¶

Sends an event. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.

See also: AWS API Documentation

Request Syntax

client.send_event(
    ContentType='string',
    Content='string',
    ClientToken='string',
    ConnectionToken='string'
)
type ContentType:

string

param ContentType:

[REQUIRED]

The content type of the request. Supported types are:

  • application/vnd.amazonaws.connect.event.typing

  • application/vnd.amazonaws.connect.event.connection.acknowledged

type Content:

string

param Content:

The content of the event to be sent (for example, message text). This is not yet supported.

type ClientToken:

string

param ClientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type ConnectionToken:

string

param ConnectionToken:

[REQUIRED]

The authentication token associated with the participant's connection.

rtype:

dict

returns:

Response Syntax

{
    'Id': 'string',
    'AbsoluteTime': 'string'
}

Response Structure

  • (dict) --

    • Id (string) --

      The ID of the response.

    • AbsoluteTime (string) --

      The time when the event was sent.

      It's specified in ISO 8601 format: yyyy-MM-ddThh:mm:ss.SSSZ. For example, 2019-11-08T02:41:28.172Z.

DisconnectParticipant (new) Link ¶

Disconnects a participant. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.

See also: AWS API Documentation

Request Syntax

client.disconnect_participant(
    ClientToken='string',
    ConnectionToken='string'
)
type ClientToken:

string

param ClientToken:

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type ConnectionToken:

string

param ConnectionToken:

[REQUIRED]

The authentication token associated with the participant's connection.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --