sendChatIntegrationEvent method

Future<SendChatIntegrationEventResponse> sendChatIntegrationEvent({
  1. required String destinationId,
  2. required ChatEvent event,
  3. required String sourceId,
  4. NewSessionDetails? newSessionDetails,
  5. String? subtype,
})

Processes chat integration events from Amazon Web Services or external integrations to Connect Customer. A chat integration event includes:

  • SourceId, DestinationId, and Subtype: a set of identifiers, uniquely representing a chat
  • ChatEvent: details of the chat action to perform such as sending a message, event, or disconnecting from a chat
When a chat integration event is sent with chat identifiers that do not map to an active chat contact, a new chat contact is also created before handling chat action.

Access to this API is currently restricted to Amazon Web Services End User Messaging for supporting SMS integration.

May throw AccessDeniedException. May throw InternalServiceException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter destinationId : Chat system identifier, used in part to uniquely identify chat. This is associated with the Connect Customer instance and flow to be used to start chats. For Server Migration Service, this is the phone number destination of inbound Server Migration Service messages represented by an Amazon Web Services End User Messaging phone number ARN.

Parameter event : Chat integration event payload

Parameter sourceId : External identifier of chat customer participant, used in part to uniquely identify a chat. For SMS, this is the E164 phone number of the chat customer participant.

Parameter newSessionDetails : Contact properties to apply when starting a new chat. If the integration event is handled with an existing chat, this is ignored.

Parameter subtype : Classification of a channel. This is used in part to uniquely identify chat.

Valid value: ["connect:sms", connect:"WhatsApp"]

Implementation

Future<SendChatIntegrationEventResponse> sendChatIntegrationEvent({
  required String destinationId,
  required ChatEvent event,
  required String sourceId,
  NewSessionDetails? newSessionDetails,
  String? subtype,
}) async {
  final $payload = <String, dynamic>{
    'DestinationId': destinationId,
    'Event': event,
    'SourceId': sourceId,
    if (newSessionDetails != null) 'NewSessionDetails': newSessionDetails,
    if (subtype != null) 'Subtype': subtype,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/chat-integration-event',
    exceptionFnMap: _exceptionFns,
  );
  return SendChatIntegrationEventResponse.fromJson(response);
}