startWebRTCContact method

Future<StartWebRTCContactResponse> startWebRTCContact({
  1. required String contactFlowId,
  2. required String instanceId,
  3. required ParticipantDetails participantDetails,
  4. AllowedCapabilities? allowedCapabilities,
  5. Map<String, String>? attributes,
  6. String? clientToken,
  7. String? description,
  8. Map<String, Reference>? references,
  9. String? relatedContactId,
})

Places an inbound in-app, web, or video call to a contact, and then initiates the flow. It performs the actions in the flow that are specified (in ContactFlowId) and present in the Connect Customer instance (specified as InstanceId).

May throw InternalServiceException. May throw InvalidParameterException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException.

Parameter contactFlowId : The identifier of the flow for the call. To see the ContactFlowId in the Connect Customer admin website, on the navigation menu go to Routing, Flows. Choose the flow. On the flow page, under the name of the 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 Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

Parameter allowedCapabilities : Information about the video sharing capabilities of the participants (customer, agent).

Parameter attributes : A custom key-value pair using an attribute map. The attributes are standard Connect Customer attributes, and can be accessed in 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, -, and _ characters.

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.

The token is valid for 7 days after creation. If a contact is already started, the contact ID is returned.

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

Parameter references : A formatted URL that is shown to an agent in the Contact Control Panel (CCP). Tasks can have the following reference types at the time of creation: URL | NUMBER | STRING | DATE | EMAIL. ATTACHMENT is not a supported reference type during task creation.

Parameter relatedContactId : The unique identifier for an Connect Customer contact. This identifier is related to the contact starting.

Implementation

Future<StartWebRTCContactResponse> startWebRTCContact({
  required String contactFlowId,
  required String instanceId,
  required ParticipantDetails participantDetails,
  AllowedCapabilities? allowedCapabilities,
  Map<String, String>? attributes,
  String? clientToken,
  String? description,
  Map<String, Reference>? references,
  String? relatedContactId,
}) async {
  final $payload = <String, dynamic>{
    'ContactFlowId': contactFlowId,
    'InstanceId': instanceId,
    'ParticipantDetails': participantDetails,
    if (allowedCapabilities != null)
      'AllowedCapabilities': allowedCapabilities,
    if (attributes != null) 'Attributes': attributes,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
    if (references != null) 'References': references,
    if (relatedContactId != null) 'RelatedContactId': relatedContactId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/contact/webrtc',
    exceptionFnMap: _exceptionFns,
  );
  return StartWebRTCContactResponse.fromJson(response);
}