stopContact method

Future<void> stopContact({
  1. required String contactId,
  2. required String instanceId,
  3. DisconnectReason? disconnectReason,
})

Ends the specified contact. Use this API to stop queued callbacks. It does not work for voice contacts that use the following initiation methods:

  • DISCONNECT
  • TRANSFER
  • QUEUE_TRANSFER
  • EXTERNAL_OUTBOUND
  • MONITOR
Chat and task contacts can be terminated in any state, regardless of initiation method.

May throw ContactNotFoundException. May throw InternalServiceException. May throw InvalidActiveRegionException. May throw InvalidParameterException. May throw InvalidRequestException. May throw ResourceNotFoundException.

Parameter contactId : The ID of the contact.

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

Parameter disconnectReason : The reason a contact can be disconnected. Only Connect Customer outbound campaigns can provide this field. For a list and description of all the possible disconnect reasons by channel (including outbound campaign voice contacts) see DisconnectReason under ContactTraceRecord in the Connect Customer Administrator Guide.

Implementation

Future<void> stopContact({
  required String contactId,
  required String instanceId,
  DisconnectReason? disconnectReason,
}) async {
  final $payload = <String, dynamic>{
    'ContactId': contactId,
    'InstanceId': instanceId,
    if (disconnectReason != null) 'DisconnectReason': disconnectReason,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/contact/stop',
    exceptionFnMap: _exceptionFns,
  );
}