Skip to content

list_phone_numbers async

list_phone_numbers(
    instance_id: InstanceId,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    phone_number_types: Optional[PhoneNumberTypes] = None,
    phone_number_country_codes: Optional[PhoneNumberCountryCodes] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResult1000] = None,
) -> ListPhoneNumbersResponse

Provides information about the phone numbers for the specified Connect Customer instance.

For more information about phone numbers, see Set Up Phone Numbers for Your Contact Center in the Connect Customer Administrator Guide.

  • We recommend using ListPhoneNumbersV2 to return phone number types. ListPhoneNumbers doesn't support number types UIFN, SHARED, THIRD_PARTY_TF, and THIRD_PARTY_DID. While it returns numbers of those types, it incorrectly lists them as TOLL_FREE or DID.

  • The phone number Arn value that is returned from each of the items in the PhoneNumberSummaryList cannot be used to tag phone number resources. It will fail with a ResourceNotFoundException. Instead, use the ListPhoneNumbersV2 API. It returns the new phone number ARN that can be used to tag phone number resources.

Parameters:

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

  • phone_number_types (Optional[PhoneNumberTypes], default: None ) –

    The type of phone number.

    We recommend using ListPhoneNumbersV2 to return phone number types. While ListPhoneNumbers returns number types UIFN, SHARED, THIRD_PARTY_TF, and THIRD_PARTY_DID, it incorrectly lists them as TOLL_FREE or DID.

  • phone_number_country_codes (Optional[PhoneNumberCountryCodes], default: None ) –

    The ISO country code.

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

  • max_results (Optional[MaxResult1000], default: None ) –

    The maximum number of results to return per page. The default MaxResult size is 100.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def list_phone_numbers(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    phone_number_types: Optional[
        "capo_connect.types.phone_number_types.PhoneNumberTypes"
    ] = None,
    phone_number_country_codes: Optional[
        "capo_connect.types.phone_number_country_codes.PhoneNumberCountryCodes"
    ] = None,
    next_token: Optional["capo_connect.types.next_token.NextToken"] = None,
    max_results: Optional["capo_connect.types.max_result1000.MaxResult1000"] = None,
) -> "capo_connect.types.list_phone_numbers_response.ListPhoneNumbersResponse":
    """<p>Provides information about the phone numbers for the specified Connect Customer instance. </p> <p>For more information about phone numbers, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/contact-center-phone-number.html">Set Up Phone Numbers for Your Contact Center</a> in the <i>Connect Customer Administrator Guide</i>.</p> <important> <ul> <li> <p>We recommend using <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_ListPhoneNumbersV2.html">ListPhoneNumbersV2</a> to return phone number types. ListPhoneNumbers doesn't support number types <code>UIFN</code>, <code>SHARED</code>, <code>THIRD_PARTY_TF</code>, and <code>THIRD_PARTY_DID</code>. While it returns numbers of those types, it incorrectly lists them as <code>TOLL_FREE</code> or <code>DID</code>. </p> </li> <li> <p>The phone number <code>Arn</code> value that is returned from each of the items in the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_ListPhoneNumbers.html#connect-ListPhoneNumbers-response-PhoneNumberSummaryList">PhoneNumberSummaryList</a> cannot be used to tag phone number resources. It will fail with a <code>ResourceNotFoundException</code>. Instead, use the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_ListPhoneNumbersV2.html">ListPhoneNumbersV2</a> API. It returns the new phone number ARN that can be used to tag phone number resources.</p> </li> </ul> </important>

    Args:
        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>
        phone_number_types: <p>The type of phone number.</p> <note> <p>We recommend using <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_ListPhoneNumbersV2.html">ListPhoneNumbersV2</a> to return phone number types. While ListPhoneNumbers returns number types <code>UIFN</code>, <code>SHARED</code>, <code>THIRD_PARTY_TF</code>, and <code>THIRD_PARTY_DID</code>, it incorrectly lists them as <code>TOLL_FREE</code> or <code>DID</code>. </p> </note>
        phone_number_country_codes: <p>The ISO country code.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
        max_results: <p>The maximum number of results to return per page. The default MaxResult size is 100.</p>

    Raises:
        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.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.list_phone_numbers_request.ListPhoneNumbersRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.list_phone_numbers_response.ListPhoneNumbersResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.list_phone_numbers

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPhoneNumbers")
    )
    input_: capo_connect.types.list_phone_numbers_request.ListPhoneNumbersRequest = {
        "instance_id": instance_id
    }
    if phone_number_types is not None:
        input_["phone_number_types"] = phone_number_types
    if phone_number_country_codes is not None:
        input_["phone_number_country_codes"] = phone_number_country_codes
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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