transferContact method

Future<TransferContactResponse> transferContact({
  1. required String contactFlowId,
  2. required String contactId,
  3. required String instanceId,
  4. String? clientToken,
  5. String? queueId,
  6. String? userId,
})

Transfers TASK or EMAIL contacts from one agent or queue to another agent or queue at any point after a contact is created. You can transfer a contact to another queue by providing the flow which orchestrates the contact to the destination queue. This gives you more control over contact handling and helps you adhere to the service level agreement (SLA) guaranteed to your customers.

Note the following requirements:

  • Transfer is only supported for TASK and EMAIL contacts.
  • Do not use both QueueId and UserId in the same call.
  • The following flow types are supported: Inbound flow, Transfer to agent flow, and Transfer to queue flow.
  • The TransferContact API can be called only on active contacts.
  • A contact cannot be transferred more than 11 times.

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

Parameter contactFlowId : The identifier of the flow.

Parameter contactId : The identifier of the contact in this instance of Connect Customer.

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 clientToken : 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.

Parameter queueId : The identifier for the queue.

Parameter userId : The identifier for the user. This can be the ID or the ARN of the user.

Implementation

Future<TransferContactResponse> transferContact({
  required String contactFlowId,
  required String contactId,
  required String instanceId,
  String? clientToken,
  String? queueId,
  String? userId,
}) async {
  final $payload = <String, dynamic>{
    'ContactFlowId': contactFlowId,
    'ContactId': contactId,
    'InstanceId': instanceId,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (queueId != null) 'QueueId': queueId,
    if (userId != null) 'UserId': userId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/contact/transfer',
    exceptionFnMap: _exceptionFns,
  );
  return TransferContactResponse.fromJson(response);
}