Skip to content

verify_sms_sandbox_phone_number async

verify_sms_sandbox_phone_number(
    phone_number: PhoneNumberString,
    one_time_password: OTPCode,
    *,
    config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> VerifySMSSandboxPhoneNumberResult

Verifies a destination phone number with a one-time password (OTP) for the calling Amazon Web Services account.

When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the SMS sandbox. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more information, including how to move out of the sandbox to send messages without restrictions, see SMS sandbox in the Amazon SNS Developer Guide.

Parameters:

  • phone_number (PhoneNumberString) –

    The destination phone number to verify.

  • one_time_password (OTPCode) –

    The OTP sent to the destination number from the CreateSMSSandBoxPhoneNumber call.

Raises:

Source code in docs_src/capo_sns/_services/async_sns.py
async def verify_sms_sandbox_phone_number(
    self,
    phone_number: "capo_sns.types.phone_number_string.PhoneNumberString",
    one_time_password: "capo_sns.types.otp_code.OTPCode",
    *,
    config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> "capo_sns.types.verify_sms_sandbox_phone_number_result.VerifySMSSandboxPhoneNumberResult":
    """<p>Verifies a destination phone number with a one-time password (OTP) for the calling Amazon Web Services account.</p> <p>When you start using Amazon SNS to send SMS messages, your Amazon Web Services account is in the <i>SMS sandbox</i>. The SMS sandbox provides a safe environment for you to try Amazon SNS features without risking your reputation as an SMS sender. While your Amazon Web Services account is in the SMS sandbox, you can use all of the features of Amazon SNS. However, you can send SMS messages only to verified destination phone numbers. For more information, including how to move out of the sandbox to send messages without restrictions, see <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html">SMS sandbox</a> in the <i>Amazon SNS Developer Guide</i>.</p>

    Args:
        phone_number: <p>The destination phone number to verify.</p>
        one_time_password: <p>The OTP sent to the destination number from the <code>CreateSMSSandBoxPhoneNumber</code> call.</p>

    Raises:
        capo_sns.errors.authorization_error_exception.AuthorizationErrorException: <p>Indicates that the user has been denied access to the requested resource.</p>
        capo_sns.errors.internal_error_exception.InternalErrorException: <p>Indicates an internal service error.</p>
        capo_sns.errors.invalid_parameter_exception.InvalidParameterException: <p>Indicates that a request parameter does not comply with the associated constraints.</p>
        capo_sns.errors.resource_not_found_exception.ResourceNotFoundException: <p>Can’t perform the action on the specified resource. Make sure that the resource exists.</p>
        capo_sns.errors.throttled_exception.ThrottledException: <p>Indicates that the rate at which requests have been submitted for this action exceeds the limit for your Amazon Web Services account.</p>
        capo_sns.errors.verification_exception.VerificationException: <p>Indicates that the one-time password (OTP) used for verification is invalid.</p>
        capo_sns.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sns.types.verify_sms_sandbox_phone_number_input.VerifySMSSandboxPhoneNumberInput]",
    ) -> AsyncOperationResponse[
        "capo_sns.types.verify_sms_sandbox_phone_number_result.VerifySMSSandboxPhoneNumberResult"
    ]:
        import capo_sns._operations.amazon_simple_notification_service.verify_sms_sandbox_phone_number

        (
            output,
            http_response,
        ) = await capo_sns._operations.amazon_simple_notification_service.verify_sms_sandbox_phone_number.async_verify_sms_sandbox_phone_number(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_sns.types.verify_sms_sandbox_phone_number_input.VerifySMSSandboxPhoneNumberInput",
    ) -> dict[str, Any]:
        import capo_sns.types.verify_sms_sandbox_phone_number_input

        return (
            capo_sns.types.verify_sms_sandbox_phone_number_input.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("VerifySMSSandboxPhoneNumber", redact_input=_redact_input),
    )
    input_: capo_sns.types.verify_sms_sandbox_phone_number_input.VerifySMSSandboxPhoneNumberInput = {
        "phone_number": phone_number,
        "one_time_password": one_time_password,
    }

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