Connect / Client / start_assistant_contact

start_assistant_contact

Connect.Client.start_assistant_contact(**kwargs)

Starts a chat contact with an AI agent.

Use the returned ParticipantToken to call the CreateParticipantConnection API.

For more information about chat, see the following topics in the Connect Customer Administrator Guide:

See also: AWS API Documentation

Request Syntax

response = client.start_assistant_contact(
    InstanceId='string',
    AiAgent={
        'AiAgentId': 'string'
    },
    ParticipantDetails={
        'DisplayName': 'string'
    },
    InitialMessage={
        'ContentType': 'string',
        'Content': 'string'
    },
    Attributes={
        'string': 'string'
    },
    ClientToken='string',
    PersistentChat={
        'RehydrationType': 'ENTIRE_PAST_SESSION'|'FROM_SEGMENT',
        'SourceContactId': 'string'
    },
    RelatedContactId='string'
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • AiAgent (dict) –

    [REQUIRED]

    The AI agent that participates in the contact.

    • AiAgentId (string) – [REQUIRED]

      The identifier of the AI agent that participates in the contact.

  • ParticipantDetails (dict) –

    [REQUIRED]

    The display name and other details that identify the chat participant.

    • DisplayName (string) – [REQUIRED]

      Display name of the participant.

  • InitialMessage (dict) –

    The initial message to send to the newly created chat.

    • ContentType (string) – [REQUIRED]

      The type of the content. Supported types are text/plain, text/markdown, application/json, and application/vnd.amazonaws.connect.message.interactive.response.

    • Content (string) – [REQUIRED]

      The content of the chat message. Maximum of 16,384 bytes for all content types ( text/plain, text/markdown, application/json, and application/vnd.amazonaws.connect.message.interactive.response).

      Some messaging channels enforce lower limits. For channel-specific message size limits, see Chat message size limits by channel in the Amazon Connect Customer Administrator Guide.

  • Attributes (dict) –

    A map of key-value pairs to associate with the contact. Amazon Connect makes these attributes available to flows as standard contact attributes.

    You can provide up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can contain only alphanumeric characters, dashes, and underscores.

    • (string) –

      • (string) –

  • ClientToken (string) –

    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.

    This field is autopopulated if not provided.

  • PersistentChat (dict) –

    The configuration that enables persistent chat. For more information about persistent chat and its use cases, see Enable persistent chat.

    • RehydrationType (string) –

      The contactId that is used for rehydration depends on the rehydration type. RehydrationType is required for persistent chat.

      • ENTIRE_PAST_SESSION: Rehydrates a chat from the most recently terminated past chat contact of the specified past ended chat session. To use this type, provide the initialContactId of the past ended chat session in the sourceContactId field. In this type, Connect Customer determines the most recent chat contact on the specified chat session that has ended, and uses it to start a persistent chat.

      • FROM_SEGMENT: Rehydrates a chat from the past chat contact that is specified in the sourceContactId field.

      The actual contactId used for rehydration is provided in the response of this API.

    • SourceContactId (string) –

      The contactId from which a persistent chat session must be started.

  • RelatedContactId (string) –

    The identifier of an Connect Customer contact related to the new assistant contact.

    Note

    You cannot provide both RelatedContactId and PersistentChat.

Return type:

dict

Returns:

Response Syntax

{
    'ContactId': 'string',
    'ParticipantId': 'string',
    'ParticipantToken': 'string',
    'ContinuedFromContactId': 'string'
}

Response Structure

  • (dict) –

    • ContactId (string) –

      The identifier of the contact within the Connect Customer instance.

    • ParticipantId (string) –

      The identifier of the chat participant. The participant identifier remains the same throughout the chat lifecycle.

    • ParticipantToken (string) –

      The token that the chat participant uses to call the CreateParticipantConnection API. The token remains valid for the lifetime of the chat participant.

    • ContinuedFromContactId (string) –

      For a persistent chat, the identifier of the contact from which the chat continues. Amazon Connect returns this field only for persistent chats.

Exceptions

  • Connect.Client.exceptions.InvalidRequestException

  • Connect.Client.exceptions.InvalidParameterException

  • Connect.Client.exceptions.ResourceNotFoundException

  • Connect.Client.exceptions.AccessDeniedException

  • Connect.Client.exceptions.InternalServiceException

  • Connect.Client.exceptions.LimitExceededException