Skip to content

validate_notify_code_verification

validate_notify_code_verification(
    destination_identity: DestinationIdentity,
    code: VerificationCode,
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
    reference_id: Optional[ReferenceId] = None,
) -> ValidateNotifyCodeVerificationOutput

Validates a one-time passcode that a recipient submitted. Validation succeeds when the passcode matches, the validity period has not elapsed, and the maximum number of attempts has not been exceeded.

Parameters:

  • destination_identity (DestinationIdentity) –

    The recipient identifier. For the TEXT and VOICE channels, specify an E.164 phone number. For the WhatsApp channel, specify a WhatsApp address.

  • reference_id (Optional[ReferenceId], default: None ) –

    The caller-supplied reference identifier used to locate the verification. This value must match the value that you supplied to the SendNotifyCodeVerification operation.

  • code (VerificationCode) –

    The one-time passcode that the recipient submitted for validation.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ThrottlingException –

    The request was denied because it exceeded the allowed request rate.

  • ValidationException –

    A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.

  • UnknownServiceError –

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

Examples:

Validate a submitted one-time passcode

>>> client.validate_notify_code_verification(destination_identity='+14255550100', reference_id='signup-flow-42', code='123456')
Source code in docs_src/capo_endusermessaging/_services/end_user_messaging.py
def validate_notify_code_verification(
    self,
    destination_identity: "capo_endusermessaging.types.destination_identity.DestinationIdentity",
    code: "capo_endusermessaging.types.verification_code.VerificationCode",
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
    reference_id: Optional[
        "capo_endusermessaging.types.reference_id.ReferenceId"
    ] = None,
) -> "capo_endusermessaging.types.validate_notify_code_verification_output.ValidateNotifyCodeVerificationOutput":
    """<p>Validates a one-time passcode that a recipient submitted. Validation succeeds when the passcode matches, the validity period has not elapsed, and the maximum number of attempts has not been exceeded.</p>

    Args:
        destination_identity: <p>The recipient identifier. For the TEXT and VOICE channels, specify an E.164 phone number. For the WhatsApp channel, specify a WhatsApp address.</p>
        reference_id: <p>The caller-supplied reference identifier used to locate the verification. This value must match the value that you supplied to the SendNotifyCodeVerification operation.</p>
        code: <p>The one-time passcode that the recipient submitted for validation.</p>

    Raises:
        capo_endusermessaging.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_endusermessaging.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_endusermessaging.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded the allowed request rate.</p>
        capo_endusermessaging.errors.validation_exception.ValidationException: A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
        capo_endusermessaging.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Validate a submitted one-time passcode

        >>> client.validate_notify_code_verification(destination_identity='+14255550100', reference_id='signup-flow-42', code='123456')
    """

    def _handler(
        req: "OperationRequest[capo_endusermessaging.types.validate_notify_code_verification_input.ValidateNotifyCodeVerificationInput]",
    ) -> OperationResponse[
        "capo_endusermessaging.types.validate_notify_code_verification_output.ValidateNotifyCodeVerificationOutput"
    ]:
        import capo_endusermessaging._operations.end_user_messaging.validate_notify_code_verification

        output, http_response = (
            capo_endusermessaging._operations.end_user_messaging.validate_notify_code_verification.validate_notify_code_verification(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_endusermessaging.types.validate_notify_code_verification_input.ValidateNotifyCodeVerificationInput",
    ) -> dict[str, Any]:
        import capo_endusermessaging.types.validate_notify_code_verification_input

        return capo_endusermessaging.types.validate_notify_code_verification_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ValidateNotifyCodeVerification", redact_input=_redact_input
        ),
    )
    input_: capo_endusermessaging.types.validate_notify_code_verification_input.ValidateNotifyCodeVerificationInput = {
        "destination_identity": destination_identity,
        "code": code,
    }
    if reference_id is not None:
        input_["reference_id"] = reference_id

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