createContactFlow method

Future<CreateContactFlowResponse> createContactFlow({
  1. required String content,
  2. required String instanceId,
  3. required String name,
  4. required ContactFlowType type,
  5. String? description,
  6. ContactFlowStatus? status,
  7. Map<String, String>? tags,
})

Creates a flow for the specified Connect Customer instance.

You can also create and update flows using the Connect Customer Flow language.

May throw DuplicateResourceException. May throw InternalServiceException. May throw InvalidContactFlowException. May throw InvalidParameterException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter content : The JSON string that represents the content of the flow. For an example, see Example flow in Connect Customer Flow language.

Length Constraints: Minimum length of 1. Maximum length of 256000.

Parameter instanceId : The identifier of the Connect Customer instance.

Parameter name : The name of the flow.

Parameter type : The type of the flow. For descriptions of the available types, see Choose a flow type in the Connect Customer Administrator Guide.

Parameter description : The description of the flow.

Parameter status : Indicates the flow status as either SAVED or PUBLISHED. The PUBLISHED status will initiate validation on the content. the SAVED status does not initiate validation of the content. SAVED | PUBLISHED.

Parameter tags : The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.

Implementation

Future<CreateContactFlowResponse> createContactFlow({
  required String content,
  required String instanceId,
  required String name,
  required ContactFlowType type,
  String? description,
  ContactFlowStatus? status,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'Content': content,
    'Name': name,
    'Type': type.value,
    if (description != null) 'Description': description,
    if (status != null) 'Status': status.value,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/contact-flows/${Uri.encodeComponent(instanceId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateContactFlowResponse.fromJson(response);
}