Skip to content

create_participant_connection async

create_participant_connection(
    participant_token: ParticipantToken,
    *,
    config_overrides: Optional[AsyncConnectParticipantClientConfig] = None,
    type: Optional[ConnectionTypeList] = None,
    connect_participant: Optional[Bool] = None,
) -> CreateParticipantConnectionResponse

Creates the participant's connection.

For security recommendations, see Connect Customer Chat security best practices.

For WebRTC security recommendations, see Connect Customer WebRTC security best practices.

ParticipantToken is used for invoking this API instead of ConnectionToken.

The participant token is valid for the lifetime of the participant – until they are part of a contact. For WebRTC participants, if they leave or are disconnected for 60 seconds, a new participant needs to be created using the CreateParticipant API.

For WEBSOCKET Type:

The response URL for 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.

The expiry time for the connection token is different than the ChatDurationInMinutes. Expiry time for the connection token is 1 day.

For WEBRTC_CONNECTION Type:

The response includes connection data required for the client application to join the call using the Amazon Chime SDK client libraries. The WebRTCConnection response contains Meeting and Attendee information needed to establish the media connection.

The attendee join token in WebRTCConnection response is valid for the lifetime of the participant in the call. If a participant leaves or is disconnected for 60 seconds, their participant credentials will no longer be valid, and a new participant will need to be created to rejoin the call.

Message streaming support: This API can also be used together with the StartContactStreaming API to create a participant connection for chat contacts that are not using a websocket. For more information about message streaming, Enable real-time chat message streaming in the Amazon Connect Administrator Guide.

Multi-user web, in-app, video calling support:

For WebRTC calls, this API is used in conjunction with the CreateParticipant API to enable multi-party calling. The StartWebRTCContact API creates the initial contact and routes it to an agent, while CreateParticipant adds additional participants to the ongoing call. For more information about multi-party WebRTC calls, see Enable multi-user web, in-app, and video calling in the Amazon Connect Administrator Guide.

Feature specifications: For information about feature specifications, such as the allowed number of open websocket connections per participant or maximum number of WebRTC participants, see Feature specifications in the Amazon Connect Administrator Guide.

The Amazon Connect Participant Service APIs do not use Signature Version 4 authentication.

Parameters:

  • type (Optional[ConnectionTypeList], default: None ) –

    Type of connection information required. If you need CONNECTION_CREDENTIALS along with marking participant as connected, pass CONNECTION_CREDENTIALS in Type.

  • participant_token (ParticipantToken) –

    This is a header parameter.

    The ParticipantToken as obtained from StartChatContact API response.

  • connect_participant (Optional[Bool], default: None ) –

    Amazon Connect Participant is used to mark the participant as connected for customer participant in message streaming, as well as for agent or manager participant in non-streaming chats.

Raises:

Source code in docs_src/capo_connectparticipant/_services/async_connect_participant.py
async def create_participant_connection(
    self,
    participant_token: "capo_connectparticipant.types.participant_token.ParticipantToken",
    *,
    config_overrides: Optional[AsyncConnectParticipantClientConfig] = None,
    type: Optional[
        "capo_connectparticipant.types.connection_type_list.ConnectionTypeList"
    ] = None,
    connect_participant: Optional["capo_connectparticipant.types.bool.Bool"] = None,
) -> "capo_connectparticipant.types.create_participant_connection_response.CreateParticipantConnectionResponse":
    """<p>Creates the participant's connection. </p> <p>For security recommendations, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/security-best-practices.html#bp-security-chat">Connect Customer Chat security best practices</a>. </p> <p>For WebRTC security recommendations, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/security-best-practices.html#bp-webrtc-security">Connect Customer WebRTC security best practices</a>. </p> <note> <p> <code>ParticipantToken</code> is used for invoking this API instead of <code>ConnectionToken</code>.</p> </note> <p>The participant token is valid for the lifetime of the participant – until they are part of a contact. For WebRTC participants, if they leave or are disconnected for 60 seconds, a new participant needs to be created using the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_CreateParticipant.html">CreateParticipant</a> API. </p> <p> <b>For <code>WEBSOCKET</code> Type</b>: </p> <p>The response URL for has a connect expiry timeout of 100s. Clients must manually connect to the returned websocket URL and subscribe to the desired topic. </p> <p>For chat, you need to publish the following on the established websocket connection:</p> <p> <code>{"topic":"aws/subscribe","content":{"topics":["aws/chat"]}}</code> </p> <p>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.</p> <p>The expiry time for the connection token is different than the <code>ChatDurationInMinutes</code>. Expiry time for the connection token is 1 day.</p> <p> <b>For <code>WEBRTC_CONNECTION</code> Type</b>: </p> <p>The response includes connection data required for the client application to join the call using the Amazon Chime SDK client libraries. The WebRTCConnection response contains Meeting and Attendee information needed to establish the media connection. </p> <p>The attendee join token in WebRTCConnection response is valid for the lifetime of the participant in the call. If a participant leaves or is disconnected for 60 seconds, their participant credentials will no longer be valid, and a new participant will need to be created to rejoin the call. </p> <p> <b>Message streaming support</b>: This API can also be used together with the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartContactStreaming.html">StartContactStreaming</a> API to create a participant connection for chat contacts that are not using a websocket. For more information about message streaming, <a href="https://docs.aws.amazon.com/connect/latest/adminguide/chat-message-streaming.html">Enable real-time chat message streaming</a> in the <i>Amazon Connect Administrator Guide</i>.</p> <p> <b>Multi-user web, in-app, video calling support</b>: </p> <p>For WebRTC calls, this API is used in conjunction with the CreateParticipant API to enable multi-party calling. The StartWebRTCContact API creates the initial contact and routes it to an agent, while CreateParticipant adds additional participants to the ongoing call. For more information about multi-party WebRTC calls, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/enable-multiuser-inapp.html">Enable multi-user web, in-app, and video calling</a> in the <i>Amazon Connect Administrator Guide</i>. </p> <p> <b>Feature specifications</b>: For information about feature specifications, such as the allowed number of open websocket connections per participant or maximum number of WebRTC participants, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-service-limits.html#feature-limits">Feature specifications</a> in the <i>Amazon Connect Administrator Guide</i>. </p> <note> <p>The Amazon Connect Participant Service APIs do not use <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Signature Version 4 authentication</a>.</p> </note>

    Args:
        type: <p>Type of connection information required. If you need <code>CONNECTION_CREDENTIALS</code> along with marking participant as connected, pass <code>CONNECTION_CREDENTIALS</code> in <code>Type</code>.</p>
        participant_token: <p>This is a header parameter.</p> <p>The ParticipantToken as obtained from <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html">StartChatContact</a> API response.</p>
        connect_participant: <p>Amazon Connect Participant is used to mark the participant as connected for customer participant in message streaming, as well as for agent or manager participant in non-streaming chats.</p>

    Raises:
        capo_connectparticipant.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_connectparticipant.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Amazon Connect service.</p>
        capo_connectparticipant.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_connectparticipant.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by Amazon Connect.</p>
        capo_connectparticipant.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connectparticipant.types.create_participant_connection_request.CreateParticipantConnectionRequest]",
    ) -> AsyncOperationResponse[
        "capo_connectparticipant.types.create_participant_connection_response.CreateParticipantConnectionResponse"
    ]:
        import capo_connectparticipant._operations.amazon_connect_participant_service_lambda.create_participant_connection

        (
            output,
            http_response,
        ) = await capo_connectparticipant._operations.amazon_connect_participant_service_lambda.create_participant_connection.async_create_participant_connection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_connectparticipant.types.create_participant_connection_response.CreateParticipantConnectionResponse",
    ) -> dict[str, Any]:
        import capo_connectparticipant.types.create_participant_connection_response

        return capo_connectparticipant.types.create_participant_connection_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateParticipantConnection", redact_output=_redact_output
        ),
    )
    input_: capo_connectparticipant.types.create_participant_connection_request.CreateParticipantConnectionRequest = {
        "participant_token": participant_token
    }
    if type is not None:
        input_["type"] = type
    if connect_participant is not None:
        input_["connect_participant"] = connect_participant

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output