prelude-sdk 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -0
  3. data/README.md +1 -1
  4. data/lib/prelude_sdk/internal/transport/base_client.rb +5 -0
  5. data/lib/prelude_sdk/models/notify_send_batch_params.rb +13 -1
  6. data/lib/prelude_sdk/models/notify_send_params.rb +13 -1
  7. data/lib/prelude_sdk/models/transactional_send_params.rb +11 -1
  8. data/lib/prelude_sdk/models/verification_check_params.rb +44 -1
  9. data/lib/prelude_sdk/models/verification_check_response.rb +12 -3
  10. data/lib/prelude_sdk/models/verification_create_params.rb +95 -5
  11. data/lib/prelude_sdk/models/watch_predict_params.rb +16 -4
  12. data/lib/prelude_sdk/models/watch_predict_response.rb +4 -0
  13. data/lib/prelude_sdk/models/watch_send_events_params.rb +22 -3
  14. data/lib/prelude_sdk/resources/notify.rb +16 -2
  15. data/lib/prelude_sdk/resources/transactional.rb +3 -1
  16. data/lib/prelude_sdk/resources/verification.rb +3 -1
  17. data/lib/prelude_sdk/resources/watch.rb +19 -6
  18. data/lib/prelude_sdk/version.rb +1 -1
  19. data/rbi/prelude_sdk/models/notify_send_batch_params.rbi +19 -0
  20. data/rbi/prelude_sdk/models/notify_send_params.rbi +19 -0
  21. data/rbi/prelude_sdk/models/transactional_send_params.rbi +15 -0
  22. data/rbi/prelude_sdk/models/verification_check_params.rbi +68 -0
  23. data/rbi/prelude_sdk/models/verification_check_response.rbi +19 -3
  24. data/rbi/prelude_sdk/models/verification_create_params.rbi +203 -3
  25. data/rbi/prelude_sdk/models/watch_predict_params.rbi +22 -3
  26. data/rbi/prelude_sdk/models/watch_predict_response.rbi +11 -0
  27. data/rbi/prelude_sdk/models/watch_send_events_params.rbi +27 -3
  28. data/rbi/prelude_sdk/resources/notify.rbi +24 -0
  29. data/rbi/prelude_sdk/resources/transactional.rbi +5 -0
  30. data/rbi/prelude_sdk/resources/verification.rbi +6 -0
  31. data/rbi/prelude_sdk/resources/watch.rbi +19 -6
  32. data/sig/prelude_sdk/models/notify_send_batch_params.rbs +7 -0
  33. data/sig/prelude_sdk/models/notify_send_params.rbs +7 -0
  34. data/sig/prelude_sdk/models/transactional_send_params.rbs +7 -0
  35. data/sig/prelude_sdk/models/verification_check_params.rbs +31 -1
  36. data/sig/prelude_sdk/models/verification_check_response.rbs +8 -1
  37. data/sig/prelude_sdk/models/verification_create_params.rbs +45 -0
  38. data/sig/prelude_sdk/models/watch_predict_params.rbs +7 -0
  39. data/sig/prelude_sdk/models/watch_predict_response.rbs +3 -1
  40. data/sig/prelude_sdk/resources/notify.rbs +2 -0
  41. data/sig/prelude_sdk/resources/transactional.rbs +1 -0
  42. data/sig/prelude_sdk/resources/verification.rbs +1 -0
  43. metadata +2 -2
@@ -258,6 +258,37 @@ module PreludeSDK
258
258
  sig { params(callback_url: String).void }
259
259
  attr_writer :callback_url
260
260
 
261
+ # The channels this verification may use, in the order they are tried. Channels
262
+ # you omit are never used, including on retries. This option can only be set when
263
+ # the verification is created. The list is recorded on the verification and
264
+ # applies for its whole lifecycle, so `channels` sent while retrying an existing
265
+ # verification is ignored — unlike `preferred_channel`, which is honored on every
266
+ # retry. Every channel you list must be enabled on your account and active in the
267
+ # destination country, otherwise the request fails with
268
+ # `channel_not_enabled_in_region`. Prelude still picks the best provider within
269
+ # each channel. Cannot be combined with `preferred_channel`. Voice is requested
270
+ # through `method` instead. Disabled by default — contact support to enable it.
271
+ sig do
272
+ returns(
273
+ T.nilable(
274
+ T::Array[
275
+ PreludeSDK::VerificationCreateParams::Options::Channel::OrSymbol
276
+ ]
277
+ )
278
+ )
279
+ end
280
+ attr_reader :channels
281
+
282
+ sig do
283
+ params(
284
+ channels:
285
+ T::Array[
286
+ PreludeSDK::VerificationCreateParams::Options::Channel::OrSymbol
287
+ ]
288
+ ).void
289
+ end
290
+ attr_writer :channels
291
+
261
292
  # The size of the code generated. It should be between 4 and 8. Defaults to the
262
293
  # code size specified from the Dashboard.
263
294
  sig { returns(T.nilable(Integer)) }
@@ -275,6 +306,19 @@ module PreludeSDK
275
306
  sig { params(custom_code: String).void }
276
307
  attr_writer :custom_code
277
308
 
309
+ # When `true`, the verification is routed through challenge-safe channels
310
+ # (non-SMS/Voice) regardless of country eligibility or any antispam outcome. The
311
+ # resulting verification has `status: "challenged"`. Use this when you have your
312
+ # own signal that the request is suspicious and want stricter routing — the
313
+ # verification is **not** classified as fraud and does not contribute to
314
+ # anti-fraud counters or risk factors. This feature is disabled by default —
315
+ # contact Prelude support to enable it on your account.
316
+ sig { returns(T.nilable(T::Boolean)) }
317
+ attr_reader :force_challenge
318
+
319
+ sig { params(force_challenge: T::Boolean).void }
320
+ attr_writer :force_challenge
321
+
278
322
  # A BCP-47 formatted locale string with the language the text message will be sent
279
323
  # to. If there's no locale set, the language will be determined by the country
280
324
  # code of the phone number. If the language specified doesn't exist, it defaults
@@ -285,6 +329,27 @@ module PreludeSDK
285
329
  sig { params(locale: String).void }
286
330
  attr_writer :locale
287
331
 
332
+ # Maximum number of delivery attempts Prelude may add on its own after the one you
333
+ # requested. `0` means a single attempt: if it cannot be delivered, Prelude
334
+ # neither tries another provider nor another channel, and does not retry
335
+ # automatically. `1` allows one additional attempt, and so on — a value larger
336
+ # than the number of routes available for the destination simply behaves like the
337
+ # default. When omitted, Prelude retries as your account is configured, across as
338
+ # many channels as the route offers.
339
+ #
340
+ # This option can only be set when the verification is created. The value is
341
+ # recorded on the verification and applies for its whole lifecycle, so a
342
+ # `max_auto_fallbacks` sent while retrying an existing verification is ignored —
343
+ # the limit cannot be raised or lowered after the fact. A retry you ask for is not
344
+ # an automatic attempt, so it gets a fresh allowance of the same limit. This
345
+ # option is disabled by default — contact Prelude support to enable it on your
346
+ # account.
347
+ sig { returns(T.nilable(Integer)) }
348
+ attr_reader :max_auto_fallbacks
349
+
350
+ sig { params(max_auto_fallbacks: Integer).void }
351
+ attr_writer :max_auto_fallbacks
352
+
288
353
  # The method used for verifying this phone number. The 'voice' option provides an
289
354
  # accessible alternative for visually impaired users by delivering the
290
355
  # verification code through a phone call rather than a text message. It also
@@ -309,7 +374,12 @@ module PreludeSDK
309
374
  end
310
375
  attr_writer :verification_method
311
376
 
312
- # The preferred channel to be used in priority for verification.
377
+ # The channel to prioritize when delivering the verification. Prelude prioritizes
378
+ # this channel on the first attempt and continues to prefer it on retries while an
379
+ # untried route on that channel remains; once those are exhausted, retries fall
380
+ # back to the next best available route. If the channel is unavailable (for
381
+ # example, when a verification is challenged), Prelude uses the best available
382
+ # route instead. Cannot be combined with `channels`.
313
383
  sig do
314
384
  returns(
315
385
  T.nilable(
@@ -356,9 +426,15 @@ module PreludeSDK
356
426
  app_realm:
357
427
  PreludeSDK::VerificationCreateParams::Options::AppRealm::OrHash,
358
428
  callback_url: String,
429
+ channels:
430
+ T::Array[
431
+ PreludeSDK::VerificationCreateParams::Options::Channel::OrSymbol
432
+ ],
359
433
  code_size: Integer,
360
434
  custom_code: String,
435
+ force_challenge: T::Boolean,
361
436
  locale: String,
437
+ max_auto_fallbacks: Integer,
362
438
  verification_method:
363
439
  PreludeSDK::VerificationCreateParams::Options::Method::OrSymbol,
364
440
  preferred_channel:
@@ -376,6 +452,17 @@ module PreludeSDK
376
452
  # verification creation, attempt creation, and delivery status changes. For more
377
453
  # details, refer to [Webhook](/verify/v2/documentation/webhook).
378
454
  callback_url: nil,
455
+ # The channels this verification may use, in the order they are tried. Channels
456
+ # you omit are never used, including on retries. This option can only be set when
457
+ # the verification is created. The list is recorded on the verification and
458
+ # applies for its whole lifecycle, so `channels` sent while retrying an existing
459
+ # verification is ignored — unlike `preferred_channel`, which is honored on every
460
+ # retry. Every channel you list must be enabled on your account and active in the
461
+ # destination country, otherwise the request fails with
462
+ # `channel_not_enabled_in_region`. Prelude still picks the best provider within
463
+ # each channel. Cannot be combined with `preferred_channel`. Voice is requested
464
+ # through `method` instead. Disabled by default — contact support to enable it.
465
+ channels: nil,
379
466
  # The size of the code generated. It should be between 4 and 8. Defaults to the
380
467
  # code size specified from the Dashboard.
381
468
  code_size: nil,
@@ -383,11 +470,35 @@ module PreludeSDK
383
470
  # contact us to enable it for your account. For more details, refer to
384
471
  # [Custom Code](/verify/v2/documentation/custom-codes).
385
472
  custom_code: nil,
473
+ # When `true`, the verification is routed through challenge-safe channels
474
+ # (non-SMS/Voice) regardless of country eligibility or any antispam outcome. The
475
+ # resulting verification has `status: "challenged"`. Use this when you have your
476
+ # own signal that the request is suspicious and want stricter routing — the
477
+ # verification is **not** classified as fraud and does not contribute to
478
+ # anti-fraud counters or risk factors. This feature is disabled by default —
479
+ # contact Prelude support to enable it on your account.
480
+ force_challenge: nil,
386
481
  # A BCP-47 formatted locale string with the language the text message will be sent
387
482
  # to. If there's no locale set, the language will be determined by the country
388
483
  # code of the phone number. If the language specified doesn't exist, it defaults
389
484
  # to US English.
390
485
  locale: nil,
486
+ # Maximum number of delivery attempts Prelude may add on its own after the one you
487
+ # requested. `0` means a single attempt: if it cannot be delivered, Prelude
488
+ # neither tries another provider nor another channel, and does not retry
489
+ # automatically. `1` allows one additional attempt, and so on — a value larger
490
+ # than the number of routes available for the destination simply behaves like the
491
+ # default. When omitted, Prelude retries as your account is configured, across as
492
+ # many channels as the route offers.
493
+ #
494
+ # This option can only be set when the verification is created. The value is
495
+ # recorded on the verification and applies for its whole lifecycle, so a
496
+ # `max_auto_fallbacks` sent while retrying an existing verification is ignored —
497
+ # the limit cannot be raised or lowered after the fact. A retry you ask for is not
498
+ # an automatic attempt, so it gets a fresh allowance of the same limit. This
499
+ # option is disabled by default — contact Prelude support to enable it on your
500
+ # account.
501
+ max_auto_fallbacks: nil,
391
502
  # The method used for verifying this phone number. The 'voice' option provides an
392
503
  # accessible alternative for visually impaired users by delivering the
393
504
  # verification code through a phone call rather than a text message. It also
@@ -396,7 +507,12 @@ module PreludeSDK
396
507
  # skips silent verification, useful for scenarios requiring direct user
397
508
  # interaction.
398
509
  verification_method: nil,
399
- # The preferred channel to be used in priority for verification.
510
+ # The channel to prioritize when delivering the verification. Prelude prioritizes
511
+ # this channel on the first attempt and continues to prefer it on retries while an
512
+ # untried route on that channel remains; once those are exhausted, retries fall
513
+ # back to the next best available route. If the channel is unavailable (for
514
+ # example, when a verification is challenged), Prelude uses the best available
515
+ # route instead. Cannot be combined with `channels`.
400
516
  preferred_channel: nil,
401
517
  # The Sender ID to use for this message. The Sender ID needs to be enabled by
402
518
  # Prelude.
@@ -415,9 +531,15 @@ module PreludeSDK
415
531
  app_realm:
416
532
  PreludeSDK::VerificationCreateParams::Options::AppRealm,
417
533
  callback_url: String,
534
+ channels:
535
+ T::Array[
536
+ PreludeSDK::VerificationCreateParams::Options::Channel::OrSymbol
537
+ ],
418
538
  code_size: Integer,
419
539
  custom_code: String,
540
+ force_challenge: T::Boolean,
420
541
  locale: String,
542
+ max_auto_fallbacks: Integer,
421
543
  verification_method:
422
544
  PreludeSDK::VerificationCreateParams::Options::Method::OrSymbol,
423
545
  preferred_channel:
@@ -530,6 +652,60 @@ module PreludeSDK
530
652
  end
531
653
  end
532
654
 
655
+ module Channel
656
+ extend PreludeSDK::Internal::Type::Enum
657
+
658
+ TaggedSymbol =
659
+ T.type_alias do
660
+ T.all(
661
+ Symbol,
662
+ PreludeSDK::VerificationCreateParams::Options::Channel
663
+ )
664
+ end
665
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
666
+
667
+ SMS =
668
+ T.let(
669
+ :sms,
670
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
671
+ )
672
+ RCS =
673
+ T.let(
674
+ :rcs,
675
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
676
+ )
677
+ WHATSAPP =
678
+ T.let(
679
+ :whatsapp,
680
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
681
+ )
682
+ VIBER =
683
+ T.let(
684
+ :viber,
685
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
686
+ )
687
+ ZALO =
688
+ T.let(
689
+ :zalo,
690
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
691
+ )
692
+ TELEGRAM =
693
+ T.let(
694
+ :telegram,
695
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
696
+ )
697
+
698
+ sig do
699
+ override.returns(
700
+ T::Array[
701
+ PreludeSDK::VerificationCreateParams::Options::Channel::TaggedSymbol
702
+ ]
703
+ )
704
+ end
705
+ def self.values
706
+ end
707
+ end
708
+
533
709
  # The method used for verifying this phone number. The 'voice' option provides an
534
710
  # accessible alternative for visually impaired users by delivering the
535
711
  # verification code through a phone call rather than a text message. It also
@@ -576,7 +752,12 @@ module PreludeSDK
576
752
  end
577
753
  end
578
754
 
579
- # The preferred channel to be used in priority for verification.
755
+ # The channel to prioritize when delivering the verification. Prelude prioritizes
756
+ # this channel on the first attempt and continues to prefer it on retries while an
757
+ # untried route on that channel remains; once those are exhausted, retries fall
758
+ # back to the next best available route. If the channel is unavailable (for
759
+ # example, when a verification is challenged), Prelude uses the best available
760
+ # route instead. Cannot be combined with `channels`.
580
761
  module PreferredChannel
581
762
  extend PreludeSDK::Internal::Type::Enum
582
763
 
@@ -682,6 +863,17 @@ module PreludeSDK
682
863
  end
683
864
  attr_writer :device_platform
684
865
 
866
+ # Whether the end-user already exists in your system, for example an existing
867
+ # account signing in again rather than a first-time signup. Unlike
868
+ # `is_trusted_user`, this signal does not bypass fraud checks; it is taken into
869
+ # account as one additional anti-fraud signal. For more details, refer to
870
+ # [Signals](/verify/v2/documentation/prevent-fraud#signals).
871
+ sig { returns(T.nilable(T::Boolean)) }
872
+ attr_reader :existing_user
873
+
874
+ sig { params(existing_user: T::Boolean).void }
875
+ attr_writer :existing_user
876
+
685
877
  # The public IP v4 or v6 address of the end-user's device. You should collect this
686
878
  # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
687
879
  # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
@@ -735,6 +927,7 @@ module PreludeSDK
735
927
  device_model: String,
736
928
  device_platform:
737
929
  PreludeSDK::VerificationCreateParams::Signals::DevicePlatform::OrSymbol,
930
+ existing_user: T::Boolean,
738
931
  ip: String,
739
932
  is_trusted_user: T::Boolean,
740
933
  ja4_fingerprint: String,
@@ -753,6 +946,12 @@ module PreludeSDK
753
946
  device_model: nil,
754
947
  # The type of the user's device.
755
948
  device_platform: nil,
949
+ # Whether the end-user already exists in your system, for example an existing
950
+ # account signing in again rather than a first-time signup. Unlike
951
+ # `is_trusted_user`, this signal does not bypass fraud checks; it is taken into
952
+ # account as one additional anti-fraud signal. For more details, refer to
953
+ # [Signals](/verify/v2/documentation/prevent-fraud#signals).
954
+ existing_user: nil,
756
955
  # The public IP v4 or v6 address of the end-user's device. You should collect this
757
956
  # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
758
957
  # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
@@ -783,6 +982,7 @@ module PreludeSDK
783
982
  device_model: String,
784
983
  device_platform:
785
984
  PreludeSDK::VerificationCreateParams::Signals::DevicePlatform::OrSymbol,
985
+ existing_user: T::Boolean,
786
986
  ip: String,
787
987
  is_trusted_user: T::Boolean,
788
988
  ja4_fingerprint: String,
@@ -11,7 +11,7 @@ module PreludeSDK
11
11
  T.any(PreludeSDK::WatchPredictParams, PreludeSDK::Internal::AnyHash)
12
12
  end
13
13
 
14
- # The prediction target. Only supports phone numbers for now.
14
+ # The signup identifier to score — a phone number or email address.
15
15
  sig { returns(PreludeSDK::WatchPredictParams::Target) }
16
16
  attr_reader :target
17
17
 
@@ -56,7 +56,7 @@ module PreludeSDK
56
56
  ).returns(T.attached_class)
57
57
  end
58
58
  def self.new(
59
- # The prediction target. Only supports phone numbers for now.
59
+ # The signup identifier to score — a phone number or email address.
60
60
  target:,
61
61
  # The identifier of the dispatch that came from the front-end SDK.
62
62
  dispatch_id: nil,
@@ -100,7 +100,7 @@ module PreludeSDK
100
100
  sig { returns(String) }
101
101
  attr_accessor :value
102
102
 
103
- # The prediction target. Only supports phone numbers for now.
103
+ # The signup identifier to score — a phone number or email address.
104
104
  sig do
105
105
  params(
106
106
  type: PreludeSDK::WatchPredictParams::Target::Type::OrSymbol,
@@ -240,6 +240,17 @@ module PreludeSDK
240
240
  end
241
241
  attr_writer :device_platform
242
242
 
243
+ # Whether the end-user already exists in your system, for example an existing
244
+ # account signing in again rather than a first-time signup. Unlike
245
+ # `is_trusted_user`, this signal does not bypass fraud checks; it is taken into
246
+ # account as one additional anti-fraud signal. For more details, refer to
247
+ # [Signals](/verify/v2/documentation/prevent-fraud#signals).
248
+ sig { returns(T.nilable(T::Boolean)) }
249
+ attr_reader :existing_user
250
+
251
+ sig { params(existing_user: T::Boolean).void }
252
+ attr_writer :existing_user
253
+
243
254
  # The public IP v4 or v6 address of the end-user's device. You should collect this
244
255
  # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
245
256
  # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
@@ -293,6 +304,7 @@ module PreludeSDK
293
304
  device_model: String,
294
305
  device_platform:
295
306
  PreludeSDK::WatchPredictParams::Signals::DevicePlatform::OrSymbol,
307
+ existing_user: T::Boolean,
296
308
  ip: String,
297
309
  is_trusted_user: T::Boolean,
298
310
  ja4_fingerprint: String,
@@ -311,6 +323,12 @@ module PreludeSDK
311
323
  device_model: nil,
312
324
  # The type of the user's device.
313
325
  device_platform: nil,
326
+ # Whether the end-user already exists in your system, for example an existing
327
+ # account signing in again rather than a first-time signup. Unlike
328
+ # `is_trusted_user`, this signal does not bypass fraud checks; it is taken into
329
+ # account as one additional anti-fraud signal. For more details, refer to
330
+ # [Signals](/verify/v2/documentation/prevent-fraud#signals).
331
+ existing_user: nil,
314
332
  # The public IP v4 or v6 address of the end-user's device. You should collect this
315
333
  # from your backend. If your backend is behind a proxy, use the `X-Forwarded-For`,
316
334
  # `Forwarded`, `True-Client-IP`, `CF-Connecting-IP` or an equivalent header to get
@@ -341,6 +359,7 @@ module PreludeSDK
341
359
  device_model: String,
342
360
  device_platform:
343
361
  PreludeSDK::WatchPredictParams::Signals::DevicePlatform::OrSymbol,
362
+ existing_user: T::Boolean,
344
363
  ip: String,
345
364
  is_trusted_user: T::Boolean,
346
365
  ja4_fingerprint: String,
@@ -32,6 +32,9 @@ module PreludeSDK
32
32
  # when prediction is "suspicious" and the anti-fraud system detected specific risk
33
33
  # signals.
34
34
  #
35
+ # - `account_risk_profile` - The target matches a risk profile derived from the
36
+ # outcomes reported on your own account, rather than from a signal shared across
37
+ # accounts.
35
38
  # - `behavioral_pattern` - The phone number past behavior during verification
36
39
  # flows exhibits suspicious patterns.
37
40
  # - `device_attribute` - The device exhibits characteristics associated with
@@ -97,6 +100,9 @@ module PreludeSDK
97
100
  # when prediction is "suspicious" and the anti-fraud system detected specific risk
98
101
  # signals.
99
102
  #
103
+ # - `account_risk_profile` - The target matches a risk profile derived from the
104
+ # outcomes reported on your own account, rather than from a signal shared across
105
+ # accounts.
100
106
  # - `behavioral_pattern` - The phone number past behavior during verification
101
107
  # flows exhibits suspicious patterns.
102
108
  # - `device_attribute` - The device exhibits characteristics associated with
@@ -179,6 +185,11 @@ module PreludeSDK
179
185
  end
180
186
  OrSymbol = T.type_alias { T.any(Symbol, String) }
181
187
 
188
+ ACCOUNT_RISK_PROFILE =
189
+ T.let(
190
+ :account_risk_profile,
191
+ PreludeSDK::Models::WatchPredictResponse::RiskFactor::TaggedSymbol
192
+ )
182
193
  BEHAVIORAL_PATTERN =
183
194
  T.let(
184
195
  :behavioral_pattern,
@@ -53,7 +53,15 @@ module PreludeSDK
53
53
  )
54
54
  end
55
55
 
56
- # A confidence level you want to assign to the event.
56
+ # How much this event tells us to trust the end-user's legitimacy — not how
57
+ # certain you are that the event occurred. In increasing order of trust:
58
+ # `minimum`, `low`, `neutral`, `high`, `maximum`.
59
+ #
60
+ # Use `minimum` for an event tied to a user you trust the least to be legitimate
61
+ # (e.g. a `payment.chargeback`), and `maximum` for an event tied to a highly
62
+ # trustworthy user (e.g. a confirmed 3DS payment). Prelude weights these signals
63
+ # when scoring traffic: it filters out users tied to low-confidence events while
64
+ # preserving the experience for users tied to high-confidence ones.
57
65
  sig do
58
66
  returns(
59
67
  PreludeSDK::WatchSendEventsParams::Event::Confidence::OrSymbol
@@ -85,7 +93,15 @@ module PreludeSDK
85
93
  ).returns(T.attached_class)
86
94
  end
87
95
  def self.new(
88
- # A confidence level you want to assign to the event.
96
+ # How much this event tells us to trust the end-user's legitimacy — not how
97
+ # certain you are that the event occurred. In increasing order of trust:
98
+ # `minimum`, `low`, `neutral`, `high`, `maximum`.
99
+ #
100
+ # Use `minimum` for an event tied to a user you trust the least to be legitimate
101
+ # (e.g. a `payment.chargeback`), and `maximum` for an event tied to a highly
102
+ # trustworthy user (e.g. a confirmed 3DS payment). Prelude weights these signals
103
+ # when scoring traffic: it filters out users tied to low-confidence events while
104
+ # preserving the experience for users tied to high-confidence ones.
89
105
  confidence:,
90
106
  # A label to describe what the event refers to.
91
107
  label:,
@@ -107,7 +123,15 @@ module PreludeSDK
107
123
  def to_hash
108
124
  end
109
125
 
110
- # A confidence level you want to assign to the event.
126
+ # How much this event tells us to trust the end-user's legitimacy — not how
127
+ # certain you are that the event occurred. In increasing order of trust:
128
+ # `minimum`, `low`, `neutral`, `high`, `maximum`.
129
+ #
130
+ # Use `minimum` for an event tied to a user you trust the least to be legitimate
131
+ # (e.g. a `payment.chargeback`), and `maximum` for an event tied to a highly
132
+ # trustworthy user (e.g. a confirmed 3DS payment). Prelude weights these signals
133
+ # when scoring traffic: it filters out users tied to low-confidence events while
134
+ # preserving the experience for users tied to high-confidence ones.
111
135
  module Confidence
112
136
  extend PreludeSDK::Internal::Type::Enum
113
137
 
@@ -5,6 +5,8 @@ module PreludeSDK
5
5
  # Send transactional and marketing messages with compliance enforcement.
6
6
  class Notify
7
7
  # Retrieve a specific subscription management configuration by its ID.
8
+ #
9
+ # In order to get access to this endpoint, contact our support team.
8
10
  sig do
9
11
  params(
10
12
  config_id: String,
@@ -20,6 +22,8 @@ module PreludeSDK
20
22
 
21
23
  # Retrieve the current subscription status for a specific phone number within a
22
24
  # subscription configuration.
25
+ #
26
+ # In order to get access to this endpoint, contact our support team.
23
27
  sig do
24
28
  params(
25
29
  phone_number: String,
@@ -41,6 +45,8 @@ module PreludeSDK
41
45
  #
42
46
  # Each configuration represents a subscription management setup with phone numbers
43
47
  # for receiving opt-out/opt-in requests and a callback URL for webhook events.
48
+ #
49
+ # In order to get access to this endpoint, contact our support team.
44
50
  sig do
45
51
  params(
46
52
  cursor: String,
@@ -61,6 +67,8 @@ module PreludeSDK
61
67
  # phone number within a subscription configuration.
62
68
  #
63
69
  # Events are ordered by timestamp in descending order (most recent first).
70
+ #
71
+ # In order to get access to this endpoint, contact our support team.
64
72
  sig do
65
73
  params(
66
74
  phone_number: String,
@@ -89,6 +97,8 @@ module PreludeSDK
89
97
  # specific subscription configuration.
90
98
  #
91
99
  # You can optionally filter by subscription state (SUB or UNSUB).
100
+ #
101
+ # In order to get access to this endpoint, contact our support team.
92
102
  sig do
93
103
  params(
94
104
  config_id: String,
@@ -126,6 +136,7 @@ module PreludeSDK
126
136
  expires_at: Time,
127
137
  from: String,
128
138
  locale: String,
139
+ max_auto_retries: Integer,
129
140
  preferred_channel:
130
141
  PreludeSDK::NotifySendParams::PreferredChannel::OrSymbol,
131
142
  schedule_at: Time,
@@ -165,6 +176,12 @@ module PreludeSDK
165
176
  # code of the phone number. If the language specified doesn't exist, the default
166
177
  # set on the template will be used.
167
178
  locale: nil,
179
+ # Maximum number of automatic retry attempts across channels for this send, in
180
+ # addition to the first attempt. For example, `2` allows up to 3 total delivery
181
+ # attempts. Lower values reduce delivery cost on hard-to-reach numbers at the
182
+ # expense of deliverability. When omitted, your account's configured default
183
+ # applies.
184
+ max_auto_retries: nil,
168
185
  # The preferred channel to be used in priority for message delivery. If the
169
186
  # channel is unavailable, the system will fallback to other available channels.
170
187
  preferred_channel: nil,
@@ -189,6 +206,7 @@ module PreludeSDK
189
206
  expires_at: Time,
190
207
  from: String,
191
208
  locale: String,
209
+ max_auto_retries: Integer,
192
210
  preferred_channel:
193
211
  PreludeSDK::NotifySendBatchParams::PreferredChannel::OrSymbol,
194
212
  schedule_at: Time,
@@ -223,6 +241,12 @@ module PreludeSDK
223
241
  from: nil,
224
242
  # A BCP-47 formatted locale string.
225
243
  locale: nil,
244
+ # Maximum number of automatic retry attempts across channels for each send in the
245
+ # batch, in addition to the first attempt. For example, `2` allows up to 3 total
246
+ # delivery attempts per recipient. Lower values reduce delivery cost on
247
+ # hard-to-reach numbers at the expense of deliverability. When omitted, your
248
+ # account's configured default applies.
249
+ max_auto_retries: nil,
226
250
  # Preferred channel for delivery. If unavailable, automatic fallback applies.
227
251
  preferred_channel: nil,
228
252
  # Schedule delivery in RFC3339 format. Marketing sends may be adjusted to comply
@@ -16,6 +16,7 @@ module PreludeSDK
16
16
  expires_at: String,
17
17
  from: String,
18
18
  locale: String,
19
+ max_auto_retries: Integer,
19
20
  preferred_channel:
20
21
  PreludeSDK::TransactionalSendParams::PreferredChannel::OrSymbol,
21
22
  variables: T::Hash[Symbol, String],
@@ -53,6 +54,10 @@ module PreludeSDK
53
54
  # code of the phone number. If the language specified doesn't exist, the default
54
55
  # set on the template will be used.
55
56
  locale: nil,
57
+ # Maximum number of automatic retry attempts across channels for this send, in
58
+ # addition to the first attempt. For example, `2` allows up to 3 total delivery
59
+ # attempts. When omitted, your account's configured default applies.
60
+ max_auto_retries: nil,
56
61
  # The preferred delivery channel for the message. When specified, the system will
57
62
  # prioritize sending via the requested channel if the template is configured for
58
63
  # it.
@@ -40,6 +40,7 @@ module PreludeSDK
40
40
  params(
41
41
  code: String,
42
42
  target: PreludeSDK::VerificationCheckParams::Target::OrHash,
43
+ psd2: PreludeSDK::VerificationCheckParams::Psd2::OrHash,
43
44
  request_options: PreludeSDK::RequestOptions::OrHash
44
45
  ).returns(PreludeSDK::Models::VerificationCheckResponse)
45
46
  end
@@ -49,6 +50,11 @@ module PreludeSDK
49
50
  # The verification target. Either a phone number or an email address. To use the
50
51
  # email verification feature contact us to discuss your use case.
51
52
  target:,
53
+ # Required when checking a code issued under the `prelude:psd2` template. The
54
+ # submitted variables must match those provided at issuance; any mismatch
55
+ # invalidates the code (PSD2 SCA RTS Article 5 dynamic linking). Ignored on
56
+ # non-PSD2 verifications.
57
+ psd2: nil,
52
58
  request_options: {}
53
59
  )
54
60
  end
@@ -4,7 +4,12 @@ module PreludeSDK
4
4
  module Resources
5
5
  # Evaluate email addresses and phone numbers for trustworthiness.
6
6
  class Watch
7
- # Predict the outcome of a verification based on Prelude’s anti-fraud system.
7
+ # At signup, score the user's phone number or email address (target) as legitimate
8
+ # or suspicious. Scoring-only — does not update counters by itself. When using
9
+ # Feedback, call predict before verification.started on the same target (and
10
+ # correlation_id when used) so feedback can warm Watch auth-start counters. Use
11
+ # Events for product fraud labels; use Feedback only if you run your own phone
12
+ # verification funnel outside Prelude Verify.
8
13
  sig do
9
14
  params(
10
15
  target: PreludeSDK::WatchPredictParams::Target::OrHash,
@@ -15,7 +20,7 @@ module PreludeSDK
15
20
  ).returns(PreludeSDK::Models::WatchPredictResponse)
16
21
  end
17
22
  def predict(
18
- # The prediction target. Only supports phone numbers for now.
23
+ # The signup identifier to score — a phone number or email address.
19
24
  target:,
20
25
  # The identifier of the dispatch that came from the front-end SDK.
21
26
  dispatch_id: nil,
@@ -28,8 +33,11 @@ module PreludeSDK
28
33
  )
29
34
  end
30
35
 
31
- # Send real-time event data from end-user interactions within your application.
32
- # Events will be analyzed for proactive fraud prevention and risk scoring.
36
+ # Send custom fraud signals from your application (labels and confidence levels).
37
+ # Events capture product-specific risk patterns and are weighted when scoring
38
+ # traffic. Use without Predict or Feedback if you only need to report product-side
39
+ # abuse (for example account.banned). Feedback is a separate, optional endpoint
40
+ # for self-hosted phone verification funnels.
33
41
  sig do
34
42
  params(
35
43
  events: T::Array[PreludeSDK::WatchSendEventsParams::Event::OrHash],
@@ -44,8 +52,13 @@ module PreludeSDK
44
52
  )
45
53
  end
46
54
 
47
- # Send feedback regarding your end-users verification funnel. Events will be
48
- # analyzed for proactive fraud prevention and risk scoring.
55
+ # Optional. Report verification-funnel steps (verification.started,
56
+ # verification.completed) when you run phone verification outside Prelude Verify.
57
+ # Feeds Watch abuse-rate counters for your own flow. Call Predict on the same
58
+ # target before verification.started and reuse metadata.correlation_id so
59
+ # auth-start counters receive predict signals; without a linked predict, only
60
+ # attempt-rate counters update on started. Not required if you only use Events
61
+ # and/or Predict, or if Verify already handles verification for that traffic.
49
62
  sig do
50
63
  params(
51
64
  feedbacks: