Skip to content

send_notify_code_verification

send_notify_code_verification(
    channel: NotifyChannel,
    destination_identity: DestinationIdentity,
    origination_identity: OriginationIdentity,
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
    notify_code_configuration: Optional[NotifyCodeConfigurationIdOrArn] = None,
    override_channel_parameters: Optional[ChannelParameters] = None,
    override_code_configuration_parameters: Optional[
        CodeConfigurationParameters
    ] = None,
    configuration_set_name: Optional[ConfigurationSetName] = None,
    context: Optional[ContextMap] = None,
    reference_id: Optional[ReferenceId] = None,
) -> SendNotifyCodeVerificationOutput

Generates a one-time passcode and delivers it to a recipient over the requested channel. The passcode policy is captured from the referenced notify code configuration at the time of the request, so later updates to the configuration do not affect verifications that are already in progress.

Parameters:

  • channel (NotifyChannel) –

    The channel used to deliver the one-time passcode to the recipient.

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

  • origination_identity (OriginationIdentity) –

    The identity used to send the message, such as a phone number, sender ID, or pool that is owned by your account.

  • notify_code_configuration (Optional[NotifyCodeConfigurationIdOrArn], default: None ) –

    The identifier or Amazon Resource Name (ARN) of the notify code configuration that supplies the passcode policy and template defaults. When you do not specify a configuration, you must supply the template in the request.

  • override_channel_parameters (Optional[ChannelParameters], default: None ) –

    The channel-specific parameters used to render and deliver the one-time passcode for this request. The route that is derived from the channel and the origination identity selects the matching channel. When you do not specify channel parameters, the service uses the parameters from the referenced notify code configuration.

  • override_code_configuration_parameters (Optional[CodeConfigurationParameters], default: None ) –

    The per-send overrides for the passcode policy parameters, including the code type, length, validity period, and maximum number of attempts. These values override the values from the referenced notify code configuration. When you do not specify a value, the value from the configuration is used, and if neither is set, the service default applies.

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

    The name of the configuration set used to control how delivery events for the message are handled.

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

    A map of custom key and value pairs that are propagated to the delivery events for this verification.

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

    A caller-supplied reference identifier that binds a send request to a later validate request. Specify the same value in both requests.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request conflicts with the current state of the resource.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ResourceNotFoundException –

    The request references a resource that does not exist. Verify that the resource identifier is correct and try your request again.

  • ServiceQuotaExceededException –

    The request would exceed a service quota for your account.

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

Send a one-time passcode over SMS

>>> client.send_notify_code_verification(channel='TEXT', destination_identity='+14255550100', origination_identity='arn:aws:sms-voice:us-east-1:123456789012:phone-number/pn-abc123', notify_code_configuration='ncc-abc12345678901234', reference_id='signup-flow-42')
Source code in docs_src/capo_endusermessaging/_services/end_user_messaging.py
def send_notify_code_verification(
    self,
    channel: "capo_endusermessaging.types.notify_channel.NotifyChannel",
    destination_identity: "capo_endusermessaging.types.destination_identity.DestinationIdentity",
    origination_identity: "capo_endusermessaging.types.origination_identity.OriginationIdentity",
    *,
    config_overrides: Optional[EndUserMessagingClientConfig] = None,
    notify_code_configuration: Optional[
        "capo_endusermessaging.types.notify_code_configuration_id_or_arn.NotifyCodeConfigurationIdOrArn"
    ] = None,
    override_channel_parameters: Optional[
        "capo_endusermessaging.types.channel_parameters.ChannelParameters"
    ] = None,
    override_code_configuration_parameters: Optional[
        "capo_endusermessaging.types.code_configuration_parameters.CodeConfigurationParameters"
    ] = None,
    configuration_set_name: Optional[
        "capo_endusermessaging.types.configuration_set_name.ConfigurationSetName"
    ] = None,
    context: Optional["capo_endusermessaging.types.context_map.ContextMap"] = None,
    reference_id: Optional[
        "capo_endusermessaging.types.reference_id.ReferenceId"
    ] = None,
) -> "capo_endusermessaging.types.send_notify_code_verification_output.SendNotifyCodeVerificationOutput":
    """<p>Generates a one-time passcode and delivers it to a recipient over the requested channel. The passcode policy is captured from the referenced notify code configuration at the time of the request, so later updates to the configuration do not affect verifications that are already in progress.</p>

    Args:
        channel: <p>The channel used to deliver the one-time passcode to the recipient.</p>
        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>
        origination_identity: <p>The identity used to send the message, such as a phone number, sender ID, or pool that is owned by your account.</p>
        notify_code_configuration: <p>The identifier or Amazon Resource Name (ARN) of the notify code configuration that supplies the passcode policy and template defaults. When you do not specify a configuration, you must supply the template in the request.</p>
        override_channel_parameters: <p>The channel-specific parameters used to render and deliver the one-time passcode for this request. The route that is derived from the channel and the origination identity selects the matching channel. When you do not specify channel parameters, the service uses the parameters from the referenced notify code configuration.</p>
        override_code_configuration_parameters: <p>The per-send overrides for the passcode policy parameters, including the code type, length, validity period, and maximum number of attempts. These values override the values from the referenced notify code configuration. When you do not specify a value, the value from the configuration is used, and if neither is set, the service default applies.</p>
        configuration_set_name: <p>The name of the configuration set used to control how delivery events for the message are handled.</p>
        context: <p>A map of custom key and value pairs that are propagated to the delivery events for this verification.</p>
        reference_id: <p>A caller-supplied reference identifier that binds a send request to a later validate request. Specify the same value in both requests.</p>

    Raises:
        capo_endusermessaging.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_endusermessaging.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource.</p>
        capo_endusermessaging.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_endusermessaging.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist. Verify that the resource identifier is correct and try your request again.</p>
        capo_endusermessaging.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota for your account.</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:
        Send a one-time passcode over SMS

        >>> client.send_notify_code_verification(channel='TEXT', destination_identity='+14255550100', origination_identity='arn:aws:sms-voice:us-east-1:123456789012:phone-number/pn-abc123', notify_code_configuration='ncc-abc12345678901234', reference_id='signup-flow-42')
    """

    def _handler(
        req: "OperationRequest[capo_endusermessaging.types.send_notify_code_verification_input.SendNotifyCodeVerificationInput]",
    ) -> OperationResponse[
        "capo_endusermessaging.types.send_notify_code_verification_output.SendNotifyCodeVerificationOutput"
    ]:
        import capo_endusermessaging._operations.end_user_messaging.send_notify_code_verification

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

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

        return capo_endusermessaging.types.send_notify_code_verification_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("SendNotifyCodeVerification", redact_input=_redact_input),
    )
    input_: capo_endusermessaging.types.send_notify_code_verification_input.SendNotifyCodeVerificationInput = {
        "channel": channel,
        "destination_identity": destination_identity,
        "origination_identity": origination_identity,
    }
    if notify_code_configuration is not None:
        input_["notify_code_configuration"] = notify_code_configuration
    if override_channel_parameters is not None:
        input_["override_channel_parameters"] = override_channel_parameters
    if override_code_configuration_parameters is not None:
        input_["override_code_configuration_parameters"] = (
            override_code_configuration_parameters
        )
    if configuration_set_name is not None:
        input_["configuration_set_name"] = configuration_set_name
    if context is not None:
        input_["context"] = context
    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