startTaskContact method

Future<StartTaskContactResponse> startTaskContact({
  1. required String contactFlowId,
  2. required String instanceId,
  3. required String name,
  4. Map<String, String>? attributes,
  5. String? clientToken,
  6. String? description,
  7. String? previousContactId,
  8. Map<String, Reference>? references,
})

Initiates a contact flow to start a new task.

May throw InvalidRequestException. May throw InvalidParameterException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ServiceQuotaExceededException. May throw InternalServiceException.

Parameter contactFlowId : The identifier of the contact flow for initiating the tasks. To see the ContactFlowId in the Amazon Connect console user interface, on the navigation menu go to Routing, Contact Flows. Choose the contact flow. On the contact flow page, under the name of the contact flow, choose Show additional flow information. The ContactFlowId is the last part of the ARN, shown here in bold:

arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx

Parameter instanceId : The identifier of the Amazon Connect instance.

Parameter name : The name of a task that is shown to an agent in the Contact Control Panel (CCP).

Parameter attributes : A custom key-value pair using an attribute map. The attributes are standard Amazon Connect attributes, and can be accessed in contact flows just like any other contact attributes.

There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only alphanumeric, dash, and underscore characters.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Parameter description : A description of the task that is shown to an agent in the Contact Control Panel (CCP).

Parameter previousContactId : The identifier of the previous chat, voice, or task contact.

Parameter references : A formatted URL that is shown to an agent in the Contact Control Panel (CCP).

Implementation

Future<StartTaskContactResponse> startTaskContact({
  required String contactFlowId,
  required String instanceId,
  required String name,
  Map<String, String>? attributes,
  String? clientToken,
  String? description,
  String? previousContactId,
  Map<String, Reference>? references,
}) async {
  ArgumentError.checkNotNull(contactFlowId, 'contactFlowId');
  _s.validateStringLength(
    'contactFlowId',
    contactFlowId,
    0,
    500,
    isRequired: true,
  );
  ArgumentError.checkNotNull(instanceId, 'instanceId');
  _s.validateStringLength(
    'instanceId',
    instanceId,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    0,
    512,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientToken',
    clientToken,
    0,
    500,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    4096,
  );
  _s.validateStringLength(
    'previousContactId',
    previousContactId,
    1,
    256,
  );
  final $payload = <String, dynamic>{
    'ContactFlowId': contactFlowId,
    'InstanceId': instanceId,
    'Name': name,
    if (attributes != null) 'Attributes': attributes,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
    if (previousContactId != null) 'PreviousContactId': previousContactId,
    if (references != null) 'References': references,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/contact/task',
    exceptionFnMap: _exceptionFns,
  );
  return StartTaskContactResponse.fromJson(response);
}