Skip to content

create_user

create_user(
    username: AgentUsername,
    security_profile_ids: SecurityProfileIds,
    routing_profile_id: RoutingProfileId,
    instance_id: InstanceId,
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    password: Optional[Password] = None,
    identity_info: Optional[UserIdentityInfo] = None,
    phone_config: Optional[UserPhoneConfig] = None,
    directory_user_id: Optional[DirectoryUserId] = None,
    hierarchy_group_id: Optional[HierarchyGroupId] = None,
    auto_accept_configs: Optional[AutoAcceptConfigs] = None,
    after_contact_work_configs: Optional[AfterContactWorkConfigs] = None,
    phone_number_configs: Optional[PhoneNumberConfigs] = None,
    persistent_connection_configs: Optional[PersistentConnectionConfigs] = None,
    voice_enhancement_configs: Optional[VoiceEnhancementConfigs] = None,
    tags: Optional[TagMap] = None,
) -> CreateUserResponse

Creates a user account for the specified Connect Customer instance.

Certain UserIdentityInfo parameters are required in some situations. For example, Email, FirstName and LastName are required if you are using Connect Customer or SAML for identity management.

Fields in PhoneConfig cannot be set simultaneously with their corresponding channel-specific configuration parameters. Specifically:

  • 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.

Parameters:

  • username (AgentUsername) –

    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:

  • password (Optional[Password], default: None ) –

    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.

  • identity_info (Optional[UserIdentityInfo], default: None ) –

    The information about the identity of the user.

  • phone_config (Optional[UserPhoneConfig], default: None ) –

    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.

  • directory_user_id (Optional[DirectoryUserId], default: None ) –

    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.

  • security_profile_ids (SecurityProfileIds) –

    The identifier of the security profile for the user.

  • routing_profile_id (RoutingProfileId) –

    The identifier of the routing profile for the user.

  • hierarchy_group_id (Optional[HierarchyGroupId], default: None ) –

    The identifier of the hierarchy group for the user.

  • instance_id (InstanceId) –

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • auto_accept_configs (Optional[AutoAcceptConfigs], default: None ) –

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

  • after_contact_work_configs (Optional[AfterContactWorkConfigs], default: None ) –

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

  • phone_number_configs (Optional[PhoneNumberConfigs], default: None ) –

    The list of phone number configuration settings for each channel.

  • persistent_connection_configs (Optional[PersistentConnectionConfigs], default: None ) –

    The list of persistent connection configuration settings for each channel.

  • voice_enhancement_configs (Optional[VoiceEnhancementConfigs], default: None ) –

    The list of voice enhancement configuration settings for each channel.

  • tags (Optional[TagMap], default: None ) –

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

Raises:

Source code in docs_src/capo_connect/_services/connect.py
def create_user(
    self,
    username: "capo_connect.types.agent_username.AgentUsername",
    security_profile_ids: "capo_connect.types.security_profile_ids.SecurityProfileIds",
    routing_profile_id: "capo_connect.types.routing_profile_id.RoutingProfileId",
    instance_id: "capo_connect.types.instance_id.InstanceId",
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    password: Optional["capo_connect.types.password.Password"] = None,
    identity_info: Optional[
        "capo_connect.types.user_identity_info.UserIdentityInfo"
    ] = None,
    phone_config: Optional[
        "capo_connect.types.user_phone_config.UserPhoneConfig"
    ] = None,
    directory_user_id: Optional[
        "capo_connect.types.directory_user_id.DirectoryUserId"
    ] = None,
    hierarchy_group_id: Optional[
        "capo_connect.types.hierarchy_group_id.HierarchyGroupId"
    ] = None,
    auto_accept_configs: Optional[
        "capo_connect.types.auto_accept_configs.AutoAcceptConfigs"
    ] = None,
    after_contact_work_configs: Optional[
        "capo_connect.types.after_contact_work_configs.AfterContactWorkConfigs"
    ] = None,
    phone_number_configs: Optional[
        "capo_connect.types.phone_number_configs.PhoneNumberConfigs"
    ] = None,
    persistent_connection_configs: Optional[
        "capo_connect.types.persistent_connection_configs.PersistentConnectionConfigs"
    ] = None,
    voice_enhancement_configs: Optional[
        "capo_connect.types.voice_enhancement_configs.VoiceEnhancementConfigs"
    ] = None,
    tags: Optional["capo_connect.types.tag_map.TagMap"] = None,
) -> "capo_connect.types.create_user_response.CreateUserResponse":
    r"""<p>Creates a user account for the specified Connect Customer instance.</p> <important> <p>Certain <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_UserIdentityInfo.html">UserIdentityInfo</a> parameters are required in some situations. For example, <code>Email</code>, <code>FirstName</code> and <code>LastName</code> are required if you are using Connect Customer or SAML for identity management.</p> </important> <note> <p>Fields in <code>PhoneConfig</code> cannot be set simultaneously with their corresponding channel-specific configuration parameters. Specifically:</p> <ul> <li> <p> <code>PhoneConfig.AutoAccept</code> conflicts with <code>AutoAcceptConfigs</code> </p> </li> <li> <p> <code>PhoneConfig.AfterContactWorkTimeLimit</code> conflicts with <code>AfterContactWorkConfigs</code> </p> </li> <li> <p> <code>PhoneConfig.PhoneType</code> and <code>PhoneConfig.PhoneNumber</code> conflict with <code>PhoneNumberConfigs</code> </p> </li> <li> <p> <code>PhoneConfig.PersistentConnection</code> conflicts with <code>PersistentConnectionConfigs</code> </p> </li> </ul> <p>We recommend using channel-specific parameters such as <code>AutoAcceptConfigs</code>, <code>AfterContactWorkConfigs</code>, <code>PhoneNumberConfigs</code>, <code>PersistentConnectionConfigs</code>, and <code>VoiceEnhancementConfigs</code> for per-channel configuration.</p> </note> <p>For information about how to create users using the Connect Customer admin website, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/user-management.html">Add Users</a> in the <i>Connect Customer Administrator Guide</i>.</p>

    Args:
        username: <p>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_-.\@]+.</p> <p>Username can include @ only if used in an email format. For example:</p> <ul> <li> <p>Correct: testuser</p> </li> <li> <p>Correct: [email protected]</p> </li> <li> <p>Incorrect: testuser@example</p> </li> </ul>
        password: <p>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.</p>
        identity_info: <p>The information about the identity of the user.</p>
        phone_config: <p>The phone settings for the user. This parameter is optional. If not provided, the user can be configured using channel-specific parameters such as <code>AutoAcceptConfigs</code>, <code>AfterContactWorkConfigs</code>, <code>PhoneNumberConfigs</code>, <code>PersistentConnectionConfigs</code>, and <code>VoiceEnhancementConfigs</code>.</p>
        directory_user_id: <p>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.</p> <p>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.</p>
        security_profile_ids: <p>The identifier of the security profile for the user.</p>
        routing_profile_id: <p>The identifier of the routing profile for the user.</p>
        hierarchy_group_id: <p>The identifier of the hierarchy group for the user.</p>
        instance_id: <p>The identifier of the Connect Customer instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        auto_accept_configs: <p>The list of auto-accept configuration settings for each channel.</p>
        after_contact_work_configs: <p>The list of after contact work (ACW) timeout configuration settings for each channel.</p>
        phone_number_configs: <p>The list of phone number configuration settings for each channel.</p>
        persistent_connection_configs: <p>The list of persistent connection configuration settings for each channel.</p>
        voice_enhancement_configs: <p>The list of voice enhancement configuration settings for each channel.</p>
        tags: <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>

    Raises:
        capo_connect.errors.duplicate_resource_exception.DuplicateResourceException: <p>A resource with the specified name already exists.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.limit_exceeded_exception.LimitExceededException: <p>The allowed limit for the resource has been exceeded.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connect.types.create_user_request.CreateUserRequest]",
    ) -> OperationResponse[
        "capo_connect.types.create_user_response.CreateUserResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.create_user

        output, http_response = (
            capo_connect._operations.amazon_connect_service.create_user.create_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_connect.types.create_user_request.CreateUserRequest",
    ) -> dict[str, Any]:
        import capo_connect.types.create_user_request

        return capo_connect.types.create_user_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateUser", redact_input=_redact_input)
    )
    input_: capo_connect.types.create_user_request.CreateUserRequest = {
        "username": username,
        "security_profile_ids": security_profile_ids,
        "routing_profile_id": routing_profile_id,
        "instance_id": instance_id,
    }
    if password is not None:
        input_["password"] = password
    if identity_info is not None:
        input_["identity_info"] = identity_info
    if phone_config is not None:
        input_["phone_config"] = phone_config
    if directory_user_id is not None:
        input_["directory_user_id"] = directory_user_id
    if hierarchy_group_id is not None:
        input_["hierarchy_group_id"] = hierarchy_group_id
    if auto_accept_configs is not None:
        input_["auto_accept_configs"] = auto_accept_configs
    if after_contact_work_configs is not None:
        input_["after_contact_work_configs"] = after_contact_work_configs
    if phone_number_configs is not None:
        input_["phone_number_configs"] = phone_number_configs
    if persistent_connection_configs is not None:
        input_["persistent_connection_configs"] = persistent_connection_configs
    if voice_enhancement_configs is not None:
        input_["voice_enhancement_configs"] = voice_enhancement_configs
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output