Skip to content

send_event async

send_event(
    content_type: ChatContentType,
    connection_token: ParticipantToken,
    *,
    config_overrides: Optional[AsyncConnectParticipantClientConfig] = None,
    content: Optional[ChatContent] = None,
    client_token: Optional[ClientToken] = None,
) -> SendEventResponse

The application/vnd.amazonaws.connect.event.connection.acknowledged ContentType is no longer maintained since December 31, 2024. This event has been migrated to the CreateParticipantConnection API using the ConnectParticipant field.

Sends an event. Message receipts are not supported when there are more than two active participants in the chat. Using the SendEvent API for message receipts when a supervisor is barged-in will result in a conflict exception.

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

ConnectionToken is used for invoking this API instead of ParticipantToken.

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

Parameters:

  • content_type (ChatContentType) –

    The content type of the request. Supported types are:

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

    • application/vnd.amazonaws.connect.event.connection.acknowledged (is no longer maintained since December 31, 2024)

    • application/vnd.amazonaws.connect.event.message.delivered

    • application/vnd.amazonaws.connect.event.message.read

  • content (Optional[ChatContent], default: None ) –

    The content of the event to be sent (for example, message text). For content related to message receipts, this is supported in the form of a JSON string.

    Sample Content: "{\"messageId\":\"11111111-aaaa-bbbb-cccc-EXAMPLE01234\"}"

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs.

  • connection_token (ParticipantToken) –

    The authentication token associated with the participant's connection.

Raises:

Source code in docs_src/capo_connectparticipant/_services/async_connect_participant.py
async def send_event(
    self,
    content_type: "capo_connectparticipant.types.chat_content_type.ChatContentType",
    connection_token: "capo_connectparticipant.types.participant_token.ParticipantToken",
    *,
    config_overrides: Optional[AsyncConnectParticipantClientConfig] = None,
    content: Optional[
        "capo_connectparticipant.types.chat_content.ChatContent"
    ] = None,
    client_token: Optional[
        "capo_connectparticipant.types.client_token.ClientToken"
    ] = None,
) -> "capo_connectparticipant.types.send_event_response.SendEventResponse":
    r"""<note> <p>The <code>application/vnd.amazonaws.connect.event.connection.acknowledged</code> ContentType is no longer maintained since December 31, 2024. This event has been migrated to the <a href="https://docs.aws.amazon.com/connect-participant/latest/APIReference/API_CreateParticipantConnection.html">CreateParticipantConnection</a> API using the <code>ConnectParticipant</code> field.</p> </note> <p>Sends an event. Message receipts are not supported when there are more than two active participants in the chat. Using the SendEvent API for message receipts when a supervisor is barged-in will result in a conflict exception.</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> <note> <p> <code>ConnectionToken</code> is used for invoking this API instead of <code>ParticipantToken</code>.</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>

    Args:
        content_type: <p>The content type of the request. Supported types are:</p> <ul> <li> <p>application/vnd.amazonaws.connect.event.typing</p> </li> <li> <p>application/vnd.amazonaws.connect.event.connection.acknowledged (is no longer maintained since December 31, 2024) </p> </li> <li> <p>application/vnd.amazonaws.connect.event.message.delivered</p> </li> <li> <p>application/vnd.amazonaws.connect.event.message.read</p> </li> </ul>
        content: <p>The content of the event to be sent (for example, message text). For content related to message receipts, this is supported in the form of a JSON string.</p> <p>Sample Content: "{\"messageId\":\"11111111-aaaa-bbbb-cccc-EXAMPLE01234\"}"</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
        connection_token: <p>The authentication token associated with the participant's connection.</p>

    Raises:
        capo_connectparticipant.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_connectparticipant.errors.conflict_exception.ConflictException: <p>The requested operation conflicts with the current state of a service resource associated with the request. </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.send_event_request.SendEventRequest]",
    ) -> AsyncOperationResponse[
        "capo_connectparticipant.types.send_event_response.SendEventResponse"
    ]:
        import capo_connectparticipant._operations.amazon_connect_participant_service_lambda.send_event

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendEvent")
    )
    input_: capo_connectparticipant.types.send_event_request.SendEventRequest = {
        "content_type": content_type,
        "connection_token": connection_token,
    }
    if content is not None:
        input_["content"] = content
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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