createUser method

Future<CreateUserResponse> createUser({
  1. required String instanceId,
  2. required String routingProfileId,
  3. required List<String> securityProfileIds,
  4. required String username,
  5. List<AfterContactWorkConfigPerChannel>? afterContactWorkConfigs,
  6. List<AutoAcceptConfig>? autoAcceptConfigs,
  7. String? directoryUserId,
  8. String? hierarchyGroupId,
  9. UserIdentityInfo? identityInfo,
  10. String? password,
  11. List<PersistentConnectionConfig>? persistentConnectionConfigs,
  12. UserPhoneConfig? phoneConfig,
  13. List<PhoneNumberConfig>? phoneNumberConfigs,
  14. Map<String, String>? tags,
  15. List<VoiceEnhancementConfig>? voiceEnhancementConfigs,
})

Creates a user account for the specified Connect Customer instance.

  • PhoneConfig.AutoAccept conflicts with AutoAcceptConfigs
  • PhoneConfig.AfterContactWorkTimeLimit conflicts with AfterContactWorkConfigs
  • PhoneConfig.PhoneType and PhoneConfig.PhoneNumber conflict with PhoneNumberConfigs
  • PhoneConfig.PersistentConnection conflicts with PersistentConnectionConfigs
We recommend using channel-specific parameters such as AutoAcceptConfigs, AfterContactWorkConfigs, PhoneNumberConfigs, PersistentConnectionConfigs, and VoiceEnhancementConfigs for per-channel configuration. For information about how to create users using the Connect Customer admin website, see Add Users in the Connect Customer Administrator Guide.

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

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 routingProfileId : The identifier of the routing profile for the user.

Parameter securityProfileIds : The identifier of the security profile for the user.

Parameter username : The user name for the account. For instances not using SAML for identity management, the user name can include up to 20 characters. If you are using SAML for identity management, the user name can include up to 64 characters from [a-zA-Z0-9_-.@]+.

Username can include @ only if used in an email format. For example:

  • Correct: testuser
  • Correct: testuser@example.com
  • Incorrect: testuser@example

Parameter afterContactWorkConfigs : The list of after contact work (ACW) timeout configuration settings for each channel.

Parameter autoAcceptConfigs : The list of auto-accept configuration settings for each channel.

Parameter directoryUserId : The identifier of the user account in the directory used for identity management. If Connect Customer cannot access the directory, you can specify this identifier to authenticate users. If you include the identifier, we assume that Connect Customer cannot access the directory. Otherwise, the identity information is used to authenticate users from your directory.

This parameter is required if you are using an existing directory for identity management in Connect Customer when Connect Customer cannot access your directory to authenticate users. If you are using SAML for identity management and include this parameter, an error is returned.

Parameter hierarchyGroupId : The identifier of the hierarchy group for the user.

Parameter identityInfo : The information about the identity of the user.

Parameter password : The password for the user account. A password is required if you are using Connect Customer for identity management. Otherwise, it is an error to include a password.

Parameter persistentConnectionConfigs : The list of persistent connection configuration settings for each channel.

Parameter phoneConfig : The phone settings for the user. This parameter is optional. If not provided, the user can be configured using channel-specific parameters such as AutoAcceptConfigs, AfterContactWorkConfigs, PhoneNumberConfigs, PersistentConnectionConfigs, and VoiceEnhancementConfigs.

Parameter phoneNumberConfigs : The list of phone number configuration settings for each channel.

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

Parameter voiceEnhancementConfigs : The list of voice enhancement configuration settings for each channel.

Implementation

Future<CreateUserResponse> createUser({
  required String instanceId,
  required String routingProfileId,
  required List<String> securityProfileIds,
  required String username,
  List<AfterContactWorkConfigPerChannel>? afterContactWorkConfigs,
  List<AutoAcceptConfig>? autoAcceptConfigs,
  String? directoryUserId,
  String? hierarchyGroupId,
  UserIdentityInfo? identityInfo,
  String? password,
  List<PersistentConnectionConfig>? persistentConnectionConfigs,
  UserPhoneConfig? phoneConfig,
  List<PhoneNumberConfig>? phoneNumberConfigs,
  Map<String, String>? tags,
  List<VoiceEnhancementConfig>? voiceEnhancementConfigs,
}) async {
  final $payload = <String, dynamic>{
    'RoutingProfileId': routingProfileId,
    'SecurityProfileIds': securityProfileIds,
    'Username': username,
    if (afterContactWorkConfigs != null)
      'AfterContactWorkConfigs': afterContactWorkConfigs,
    if (autoAcceptConfigs != null) 'AutoAcceptConfigs': autoAcceptConfigs,
    if (directoryUserId != null) 'DirectoryUserId': directoryUserId,
    if (hierarchyGroupId != null) 'HierarchyGroupId': hierarchyGroupId,
    if (identityInfo != null) 'IdentityInfo': identityInfo,
    if (password != null) 'Password': password,
    if (persistentConnectionConfigs != null)
      'PersistentConnectionConfigs': persistentConnectionConfigs,
    if (phoneConfig != null) 'PhoneConfig': phoneConfig,
    if (phoneNumberConfigs != null) 'PhoneNumberConfigs': phoneNumberConfigs,
    if (tags != null) 'Tags': tags,
    if (voiceEnhancementConfigs != null)
      'VoiceEnhancementConfigs': voiceEnhancementConfigs,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/users/${Uri.encodeComponent(instanceId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateUserResponse.fromJson(response);
}