Skip to content

update_phone_number async

update_phone_number(
    phone_number_id: PhoneNumberId,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    target_arn: Optional[ARN] = None,
    instance_id: Optional[InstanceId] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdatePhoneNumberResponse

Updates your claimed phone number from its current Connect Customer instance or traffic distribution group to another Connect Customer instance or traffic distribution group in the same Amazon Web Services Region.

After using this API, you must verify that the phone number is attached to the correct flow in the target instance or traffic distribution group. You need to do this because the API switches only the phone number to a new instance or traffic distribution group. It doesn't migrate the flow configuration of the phone number, too.

You can call DescribePhoneNumber API to verify the status of a previous UpdatePhoneNumber operation.

Parameters:

  • phone_number_id (PhoneNumberId) –

    A unique identifier for the phone number.

  • target_arn (Optional[ARN], default: None ) –

    The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter InstanceId or TargetArn.

  • instance_id (Optional[InstanceId], default: None ) –

    The identifier of the Connect Customer instance that phone numbers are claimed to. You can find the instance ID in the Amazon Resource Name (ARN) of the instance. You must enter InstanceId or TargetArn.

  • client_token (Optional[ClientToken], default: None ) –

    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.

Raises:

  • AccessDeniedException –

    You do not have sufficient permissions to perform this action.

  • IdempotencyException –

    An entity with the same name already exists.

  • InternalServiceException –

    Request processing failed because of an error or failure with the service.

  • InvalidParameterException –

    One or more of the specified parameters are not valid.

  • ResourceInUseException –

    That resource is already in use (for example, you're trying to add a record with the same name as an existing record). If you are trying to delete a resource (for example, DeleteHoursOfOperation or DeletePredefinedAttribute), remove its reference from related resources and then try again.

  • ResourceNotFoundException –

    The specified resource was not found.

  • ThrottlingException –

    The throttling limit has been exceeded.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_connect/_services/async_connect.py
async def update_phone_number(
    self,
    phone_number_id: "capo_connect.types.phone_number_id.PhoneNumberId",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    target_arn: Optional["capo_connect.types.arn.ARN"] = None,
    instance_id: Optional["capo_connect.types.instance_id.InstanceId"] = None,
    client_token: Optional["capo_connect.types.client_token.ClientToken"] = None,
) -> "capo_connect.types.update_phone_number_response.UpdatePhoneNumberResponse":
    """<p>Updates your claimed phone number from its current Connect Customer instance or traffic distribution group to another Connect Customer instance or traffic distribution group in the same Amazon Web Services Region.</p> <important> <p>After using this API, you must verify that the phone number is attached to the correct flow in the target instance or traffic distribution group. You need to do this because the API switches only the phone number to a new instance or traffic distribution group. It doesn't migrate the flow configuration of the phone number, too.</p> <p>You can call <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribePhoneNumber.html">DescribePhoneNumber</a> API to verify the status of a previous <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_UpdatePhoneNumber.html">UpdatePhoneNumber</a> operation.</p> </important>

    Args:
        phone_number_id: <p>A unique identifier for the phone number.</p>
        target_arn: <p>The Amazon Resource Name (ARN) for Connect Customer instances or traffic distribution groups that phone number inbound traffic is routed through. You must enter <code>InstanceId</code> or <code>TargetArn</code>. </p>
        instance_id: <p>The identifier of the Connect Customer instance that phone numbers are claimed to. 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. You must enter <code>InstanceId</code> or <code>TargetArn</code>. </p>
        client_token: <p>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 <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.idempotency_exception.IdempotencyException: <p>An entity with the same 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.resource_in_use_exception.ResourceInUseException: <p>That resource is already in use (for example, you're trying to add a record with the same name as an existing record). If you are trying to delete a resource (for example, DeleteHoursOfOperation or DeletePredefinedAttribute), remove its reference from related resources and then try again.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.update_phone_number_request.UpdatePhoneNumberRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.update_phone_number_response.UpdatePhoneNumberResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.update_phone_number

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.update_phone_number.async_update_phone_number(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePhoneNumber")
    )
    input_: capo_connect.types.update_phone_number_request.UpdatePhoneNumberRequest = {
        "phone_number_id": phone_number_id
    }
    if target_arn is not None:
        input_["target_arn"] = target_arn
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output