Skip to content

send_destination_number_verification_code

send_destination_number_verification_code(
    verified_destination_number_id: VerifiedDestinationNumberIdOrArn,
    verification_channel: VerificationChannel,
    *,
    config_overrides: Optional[PinpointSMSVoiceV2ClientConfig] = None,
    language_code: Optional[LanguageCode] = None,
    origination_identity: Optional[VerificationMessageOriginationIdentity] = None,
    configuration_set_name: Optional[ConfigurationSetNameOrArn] = None,
    context: Optional[ContextMap] = None,
    destination_country_parameters: Optional[DestinationCountryParameters] = None,
) -> SendDestinationNumberVerificationCodeResult

Before you can send test messages to a verified destination phone number you need to opt-in the verified destination phone number. Creates a new text message with a verification code and send it to a verified destination phone number. Once you have the verification code use VerifyDestinationNumber to opt-in the verified destination phone number to receive messages.

Parameters:

  • verified_destination_number_id (VerifiedDestinationNumberIdOrArn) –

    The unique identifier for the verified destination phone number.

  • verification_channel (VerificationChannel) –

    Choose to send the verification code as an SMS or voice message.

  • language_code (Optional[LanguageCode], default: None ) –

    Choose the language to use for the message.

  • origination_identity (Optional[VerificationMessageOriginationIdentity], default: None ) –

    The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn.

    If you are using a shared End User Messaging SMS resource then you must use the full Amazon Resource Name(ARN).

  • configuration_set_name (Optional[ConfigurationSetNameOrArn], default: None ) –

    The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.

  • context (Optional[ContextMap], default: None ) –

    You can specify custom data in this field. If you do, that data is logged to the event destination.

  • destination_country_parameters (Optional[DestinationCountryParameters], default: None ) –

    This field is used for any country-specific registration requirements. Currently, this setting is only used when you send messages to recipients in India using a sender ID. For more information see Special requirements for sending SMS messages to recipients in India.

Raises:

  • AccessDeniedException –

    The request was denied because you don't have sufficient permissions to access the resource.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.

  • InternalServerException –

    The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.

  • ResourceNotFoundException –

    A requested resource couldn't be found.

  • ServiceQuotaExceededException –

    The request would cause a service quota to be exceeded.

  • ThrottlingException –

    An error that occurred because too many requests were sent during a certain amount of time.

  • ValidationException –

    A validation exception for a field.

  • UnknownServiceError –

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

Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/pinpoint_sms_voice_v2.py
def send_destination_number_verification_code(
    self,
    verified_destination_number_id: "capo_pinpoint_sms_voice_v2.types.verified_destination_number_id_or_arn.VerifiedDestinationNumberIdOrArn",
    verification_channel: "capo_pinpoint_sms_voice_v2.types.verification_channel.VerificationChannel",
    *,
    config_overrides: Optional[PinpointSMSVoiceV2ClientConfig] = None,
    language_code: Optional[
        "capo_pinpoint_sms_voice_v2.types.language_code.LanguageCode"
    ] = None,
    origination_identity: Optional[
        "capo_pinpoint_sms_voice_v2.types.verification_message_origination_identity.VerificationMessageOriginationIdentity"
    ] = None,
    configuration_set_name: Optional[
        "capo_pinpoint_sms_voice_v2.types.configuration_set_name_or_arn.ConfigurationSetNameOrArn"
    ] = None,
    context: Optional[
        "capo_pinpoint_sms_voice_v2.types.context_map.ContextMap"
    ] = None,
    destination_country_parameters: Optional[
        "capo_pinpoint_sms_voice_v2.types.destination_country_parameters.DestinationCountryParameters"
    ] = None,
) -> "capo_pinpoint_sms_voice_v2.types.send_destination_number_verification_code_result.SendDestinationNumberVerificationCodeResult":
    """<p>Before you can send test messages to a verified destination phone number you need to opt-in the verified destination phone number. Creates a new text message with a verification code and send it to a verified destination phone number. Once you have the verification code use <a>VerifyDestinationNumber</a> to opt-in the verified destination phone number to receive messages.</p>

    Args:
        verified_destination_number_id: <p>The unique identifier for the verified destination phone number.</p>
        verification_channel: <p>Choose to send the verification code as an SMS or voice message.</p>
        language_code: <p>Choose the language to use for the message.</p>
        origination_identity: <p>The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn.</p> <important> <p>If you are using a shared End User Messaging SMS resource then you must use the full Amazon Resource Name(ARN).</p> </important>
        configuration_set_name: <p>The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.</p>
        context: <p>You can specify custom data in this field. If you do, that data is logged to the event destination.</p>
        destination_country_parameters: <p>This field is used for any country-specific registration requirements. Currently, this setting is only used when you send messages to recipients in India using a sender ID. For more information see <a href="https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html">Special requirements for sending SMS messages to recipients in India</a>. </p>

    Raises:
        capo_pinpoint_sms_voice_v2.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because you don't have sufficient permissions to access the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.internal_server_exception.InternalServerException: <p>The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.</p>
        capo_pinpoint_sms_voice_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>A requested resource couldn't be found.</p>
        capo_pinpoint_sms_voice_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_pinpoint_sms_voice_v2.errors.throttling_exception.ThrottlingException: <p>An error that occurred because too many requests were sent during a certain amount of time.</p>
        capo_pinpoint_sms_voice_v2.errors.validation_exception.ValidationException: <p>A validation exception for a field.</p>
        capo_pinpoint_sms_voice_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_pinpoint_sms_voice_v2.types.send_destination_number_verification_code_request.SendDestinationNumberVerificationCodeRequest]",
    ) -> OperationResponse[
        "capo_pinpoint_sms_voice_v2.types.send_destination_number_verification_code_result.SendDestinationNumberVerificationCodeResult"
    ]:
        import capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.send_destination_number_verification_code

        output, http_response = (
            capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.send_destination_number_verification_code.send_destination_number_verification_code(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendDestinationNumberVerificationCode")
    )
    input_: capo_pinpoint_sms_voice_v2.types.send_destination_number_verification_code_request.SendDestinationNumberVerificationCodeRequest = {
        "verified_destination_number_id": verified_destination_number_id,
        "verification_channel": verification_channel,
    }
    if language_code is not None:
        input_["language_code"] = language_code
    if origination_identity is not None:
        input_["origination_identity"] = origination_identity
    if configuration_set_name is not None:
        input_["configuration_set_name"] = configuration_set_name
    if context is not None:
        input_["context"] = context
    if destination_country_parameters is not None:
        input_["destination_country_parameters"] = destination_country_parameters

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