sendly 4.5.0 → 4.5.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +17 -14
- data/lib/sendly/version.rb +1 -1
- data/lib/sendly/whatsapp_resource.rb +28 -24
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e684d2e1e6cb9addd168326d6874152b070b68ab599ba9370eca565a8a70d3ce
|
|
4
|
+
data.tar.gz: 13ddbe1ae8aed4e2683515a8a7de05f135c037dd12984974a92e173158cf2843
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dab32a1714f5fbe937f3d109d03b4e634311ac890c7f3126dc98653eaa88631ddb2ba6591697f5be9b59595530e5e85d1932b951e645675b79e89b677adbc2db
|
|
7
|
+
data.tar.gz: 53bf4c50b966f79ca3221292ffd2095e6d21007e50421fbd0aa6e7f4c3067060c63ec6ff0524fe87ceeee62690cd83aaafd0bceb83534658d5243677e44d91b1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1153,11 +1153,13 @@ puts status.disabled?
|
|
|
1153
1153
|
|
|
1154
1154
|
Connect a number you own to WhatsApp, create Meta-reviewed message
|
|
1155
1155
|
templates, and send via `client.messages.send(channel: "whatsapp", ...)`.
|
|
1156
|
-
Connecting
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1156
|
+
Connecting costs a one-time $9.99 fee per number (no monthly fee), charged to
|
|
1157
|
+
your card when you start connecting it, refunded automatically if the
|
|
1158
|
+
connection fails, and not refundable once the number is connected. The first
|
|
1159
|
+
number always ends with a human step: the signup returns a connect URL a person
|
|
1160
|
+
must open in a browser and log in with Facebook to link their WhatsApp Business
|
|
1161
|
+
Account. More numbers can then be added to that account with a 6-digit code Meta sends
|
|
1162
|
+
to the number, with no Facebook step (same $9.99 fee, refunded if it fails).
|
|
1161
1163
|
|
|
1162
1164
|
Sends go through `messages.send(channel: "whatsapp")` and need `sms:send`,
|
|
1163
1165
|
not `whatsapp:write`. Reads (`signup.get`, templates, the window, senders and
|
|
@@ -1191,14 +1193,16 @@ gives its slot back. Note: Meta
|
|
|
1191
1193
|
has paused marketing template delivery to US (+1) numbers.
|
|
1192
1194
|
|
|
1193
1195
|
```ruby
|
|
1194
|
-
# 1. Connect a number (
|
|
1196
|
+
# 1. Connect a number ($9.99 one-time; a human must open the connect URL)
|
|
1195
1197
|
signup = client.whatsapp.signup.create(phone_number: "+15125550123")
|
|
1196
1198
|
puts "Have your user open: #{signup.connect_url}"
|
|
1197
1199
|
|
|
1198
1200
|
# 2. Poll until active. After the Facebook step the signup is "registering"
|
|
1199
1201
|
# while WhatsApp activates the number. Activation usually takes a few minutes
|
|
1200
1202
|
# but can take hours. If it hasn't finished about 6 hours after the session
|
|
1201
|
-
# began, the session fails with registration_timeout.
|
|
1203
|
+
# began, the session fails with registration_timeout and the fee is refunded.
|
|
1204
|
+
# If the connection fails, the $9.99 fee is refunded automatically; once a
|
|
1205
|
+
# number has connected, a later disconnect gets nothing back.
|
|
1202
1206
|
status = client.whatsapp.signup.get(signup.id)
|
|
1203
1207
|
puts status.failure_reasons if status.failed? # e.g. ["waba_mismatch"]
|
|
1204
1208
|
|
|
@@ -1322,7 +1326,7 @@ WhatsApp errors map onto the usual classes:
|
|
|
1322
1326
|
while WhatsApp connections are unavailable. Only signup returns it; no send
|
|
1323
1327
|
does. Nothing is charged, the response carries a `Retry-After: 3600` header,
|
|
1324
1328
|
and `e.response_body["retryAfter"]` (3600) says how many seconds to wait; the client
|
|
1325
|
-
retries it like any 5xx before raising. After 5 failed signups in
|
|
1329
|
+
retries it like any 5xx before raising. After 5 failed, charged signups in
|
|
1326
1330
|
24 hours it raises `Sendly::RateLimitError` for 429
|
|
1327
1331
|
`whatsapp_signup_limit_reached`, which is not retried: try again the next
|
|
1328
1332
|
day.
|
|
@@ -1366,18 +1370,17 @@ WhatsApp errors map onto the usual classes:
|
|
|
1366
1370
|
`whatsapp_signup_in_progress` and `whatsapp_already_enabled`, and
|
|
1367
1371
|
`Sendly::ServerError` for 503 `whatsapp_verification_start_failed` (WhatsApp
|
|
1368
1372
|
couldn't start verifying the number; start again). Either failure fails the
|
|
1369
|
-
session. With `business_account_id:` the client never
|
|
1370
|
-
timeout or a dropped connection, because each retry would
|
|
1371
|
-
session. A
|
|
1372
|
-
Facebook signup for a number
|
|
1373
|
+
session and refunds its fee. With `business_account_id:` the client never
|
|
1374
|
+
retries a 5xx, a timeout or a dropped connection, because each retry would
|
|
1375
|
+
start a new charged session. A Facebook signup for a number
|
|
1373
1376
|
that is being added by code gets 409 `whatsapp_verification_in_progress`,
|
|
1374
1377
|
with that session's id in `e.response_body["id"]`.
|
|
1375
1378
|
- `signup.verify` raises `Sendly::ValidationError` for 400
|
|
1376
1379
|
`invalid_verification_code` (not 6 digits) and 422
|
|
1377
1380
|
`whatsapp_verification_code_invalid` (a wrong code, with
|
|
1378
1381
|
`e.response_body["attemptsRemaining"]`); `Sendly::APIError` (409) for
|
|
1379
|
-
`whatsapp_verification_failed` (after 5 wrong codes the session fails
|
|
1380
|
-
`whatsapp_verification_busy` (try again) and
|
|
1382
|
+
`whatsapp_verification_failed` (after 5 wrong codes the session fails and
|
|
1383
|
+
the fee is refunded), `whatsapp_verification_busy` (try again) and
|
|
1381
1384
|
`signup_not_active`; and `Sendly::ServerError` for 503
|
|
1382
1385
|
`whatsapp_verification_unavailable` (the attempt isn't counted) and
|
|
1383
1386
|
`whatsapp_activation_pending` (the code was accepted but connecting didn't
|
data/lib/sendly/version.rb
CHANGED
|
@@ -63,8 +63,8 @@ module Sendly
|
|
|
63
63
|
# The status of a WhatsApp signup. +status+ is +"initiated"+,
|
|
64
64
|
# +"registering"+ (WhatsApp is activating the number; activation usually
|
|
65
65
|
# takes a few minutes but can take hours, and a session that hasn't
|
|
66
|
-
# finished about 6 hours after it began fails with +registration_timeout+
|
|
67
|
-
# +"verifying"+ (a number being added to an
|
|
66
|
+
# finished about 6 hours after it began fails with +registration_timeout+
|
|
67
|
+
# and the fee is refunded), +"verifying"+ (a number being added to an
|
|
68
68
|
# already-connected account, waiting for its code), +"active"+ or
|
|
69
69
|
# +"failed"+. The API does not send +"expired"+,
|
|
70
70
|
# so {#expired?} is never true; it stays for compatibility.
|
|
@@ -72,8 +72,7 @@ module Sendly
|
|
|
72
72
|
# +"active"+ (from the start for a number added by code); it is nil while
|
|
73
73
|
# +"initiated"+ or +"registering"+ and after a failure.
|
|
74
74
|
# +failure_reasons+ is set when the status is +"failed"+, with one code:
|
|
75
|
-
# +setup_fee_payment_failed+
|
|
76
|
-
# +signup_abandoned+, +meta_exchange_failed+,
|
|
75
|
+
# +setup_fee_payment_failed+, +signup_abandoned+, +meta_exchange_failed+,
|
|
77
76
|
# +registration_failed+, +waba_already_connected+, +waba_mismatch+ (the
|
|
78
77
|
# WhatsApp Business Account chosen in the Facebook step doesn't hold the
|
|
79
78
|
# verified number), +registration_timeout+ (activation hadn't finished
|
|
@@ -81,6 +80,7 @@ module Sendly
|
|
|
81
80
|
# +verification_start_failed+ (WhatsApp couldn't start verifying an added
|
|
82
81
|
# number), +verification_failed+ (too many wrong codes) or
|
|
83
82
|
# +verification_expired+ (a verifying session left untouched for an hour).
|
|
83
|
+
# If the connection fails, the $9.99 fee is refunded automatically.
|
|
84
84
|
#
|
|
85
85
|
# While the status is +"verifying"+, +verification_method+ (+"sms"+ or
|
|
86
86
|
# +"voice"+) and +verification_attempts_remaining+ are set, and on
|
|
@@ -533,31 +533,35 @@ module Sendly
|
|
|
533
533
|
|
|
534
534
|
# Start connecting a number to WhatsApp.
|
|
535
535
|
#
|
|
536
|
-
#
|
|
536
|
+
# Charges a one-time $9.99 connection fee per number (no monthly fee) to
|
|
537
|
+
# your card when the connection starts, and returns a
|
|
537
538
|
# +connect_url+. Completing the connection requires a human: hand the
|
|
538
539
|
# URL to your user — they open it in a browser and log in with Facebook
|
|
539
540
|
# to link their WhatsApp Business Account. Then poll {#get} until the
|
|
540
541
|
# status is +"active"+.
|
|
541
542
|
#
|
|
542
543
|
# Calling again for a number with an in-flight signup returns the
|
|
543
|
-
# existing signup (same +connect_url+). Requires
|
|
544
|
+
# existing signup (same +connect_url+) without charging again. Requires
|
|
544
545
|
# a live API key with the +whatsapp:write+ scope (a test key gets 403
|
|
545
546
|
# +whatsapp_requires_live_key+) and, in a team workspace, an owner or
|
|
546
547
|
# admin (+settings:write+). After the Facebook step the signup stays
|
|
547
548
|
# +"registering"+ while WhatsApp activates the number. Activation usually
|
|
548
549
|
# takes a few minutes but can take hours. If it hasn't finished about 6
|
|
549
550
|
# hours after the session began, the session fails with
|
|
550
|
-
# +registration_timeout
|
|
551
|
+
# +registration_timeout+ and the fee is refunded. If the connection
|
|
552
|
+
# fails, the $9.99 fee is refunded automatically; once the number has
|
|
553
|
+
# connected it is not refundable, and a later disconnect gets nothing
|
|
554
|
+
# back.
|
|
551
555
|
#
|
|
552
556
|
# To add a number to a WhatsApp Business Account this workspace has
|
|
553
557
|
# already connected, pass its +business_account_id+ (as shown on
|
|
554
558
|
# {WhatsAppSender#business_account_id}). There is no Facebook step and no
|
|
555
|
-
# +connect_url+:
|
|
559
|
+
# +connect_url+: the same $9.99 fee is charged, Meta sends the number a
|
|
556
560
|
# 6-digit code by text or voice call, and the session is +"verifying"+
|
|
557
561
|
# until you submit the code with {#verify}. Calling again for a number
|
|
558
|
-
# that is verifying returns the same session without
|
|
559
|
-
# code; a verifying session older than 3 hours is
|
|
560
|
-
# is started.
|
|
562
|
+
# that is verifying returns the same session without charging again or
|
|
563
|
+
# sending a second code; a verifying session older than 3 hours is
|
|
564
|
+
# expired (and refunded) and a new one is started.
|
|
561
565
|
#
|
|
562
566
|
# @param phone_number [String] The number to connect, in E.164 format.
|
|
563
567
|
# Must be an active number in your workspace.
|
|
@@ -572,12 +576,12 @@ module Sendly
|
|
|
572
576
|
# +business_account_id+.
|
|
573
577
|
# @return [WhatsAppSignupSession]
|
|
574
578
|
# @raise [Sendly::ServerError] +whatsapp_unavailable+ (503) while
|
|
575
|
-
# WhatsApp connections are unavailable. Only
|
|
579
|
+
# WhatsApp connections are unavailable. Nothing is charged. Only
|
|
576
580
|
# signup returns it, with +retryAfter+ 3600 in the body
|
|
577
581
|
# (+e.response_body["retryAfter"]+) and a +Retry-After: 3600+ header.
|
|
578
582
|
# The client retries it like any 5xx before raising.
|
|
579
583
|
# @raise [Sendly::RateLimitError] +whatsapp_signup_limit_reached+ (429)
|
|
580
|
-
# after 5 failed signups (or 20 cancelled) in 24 hours. Not retried;
|
|
584
|
+
# after 5 failed, charged signups (or 20 cancelled) in 24 hours. Not retried;
|
|
581
585
|
# try again the next day.
|
|
582
586
|
# @raise [Sendly::NotFoundError] +whatsapp_business_account_not_found+
|
|
583
587
|
# (404) when +business_account_id+ isn't connected in this workspace
|
|
@@ -585,7 +589,7 @@ module Sendly
|
|
|
585
589
|
# @raise [Sendly::ValidationError] +display_name_required+ (400) when no
|
|
586
590
|
# display name is given and the account has none to reuse, and
|
|
587
591
|
# +whatsapp_verification_start_failed+ (422) when WhatsApp refused to
|
|
588
|
-
# verify the number: final, the session failed.
|
|
592
|
+
# verify the number: final, the session failed and the fee is refunded.
|
|
589
593
|
# @raise [Sendly::APIError] 409 +whatsapp_signup_in_progress+ (a Facebook
|
|
590
594
|
# connection for the number is in flight; +e.response_body["id"]+ is
|
|
591
595
|
# that session), 409 +whatsapp_verification_in_progress+ (a Facebook
|
|
@@ -594,14 +598,14 @@ module Sendly
|
|
|
594
598
|
# still being added, so try again in a moment) or 409
|
|
595
599
|
# +whatsapp_already_enabled+.
|
|
596
600
|
# @raise [Sendly::InsufficientCreditsError] 402 +payment_method_required+
|
|
597
|
-
# or +payment_failed
|
|
601
|
+
# or +payment_failed+ when the $9.99 fee can't be charged.
|
|
598
602
|
# @raise [Sendly::ServerError] +whatsapp_verification_start_failed+ (503)
|
|
599
|
-
# when WhatsApp couldn't start verifying the number: the session failed
|
|
600
|
-
# so start again. With +business_account_id+,
|
|
601
|
-
# and never retried by the client, because
|
|
602
|
-
# new session (a timeout or dropped
|
|
603
|
-
# either). Without it the client retries a
|
|
604
|
-
# before.
|
|
603
|
+
# when WhatsApp couldn't start verifying the number: the session failed
|
|
604
|
+
# and its fee is refunded, so start again. With +business_account_id+,
|
|
605
|
+
# a 5xx is raised at once and never retried by the client, because
|
|
606
|
+
# each retry would start a new charged session (a timeout or dropped
|
|
607
|
+
# connection is never retried either). Without it the client retries a
|
|
608
|
+
# 5xx before raising, as before.
|
|
605
609
|
#
|
|
606
610
|
# @example
|
|
607
611
|
# signup = client.whatsapp.signup.create(phone_number: "+15559876543")
|
|
@@ -646,7 +650,7 @@ module Sendly
|
|
|
646
650
|
# (422) for a wrong code, with the attempts left in
|
|
647
651
|
# +e.response_body["attemptsRemaining"]+
|
|
648
652
|
# @raise [Sendly::APIError] 409 +whatsapp_verification_failed+ after 5
|
|
649
|
-
# wrong codes (the session failed and
|
|
653
|
+
# wrong codes (the session failed, the fee is refunded and
|
|
650
654
|
# +whatsapp_account.failed+ fires), 409 +whatsapp_verification_busy+
|
|
651
655
|
# while another code for the number is being checked (try again), or
|
|
652
656
|
# 409 +signup_not_active+ when the signup isn't waiting for a code or is
|
|
@@ -1150,7 +1154,7 @@ module Sendly
|
|
|
1150
1154
|
# create Meta-reviewed message templates, and send via
|
|
1151
1155
|
# +client.messages.send(channel: "whatsapp", ...)+.
|
|
1152
1156
|
#
|
|
1153
|
-
# Connecting a number
|
|
1157
|
+
# Connecting a number costs a one-time $9.99 fee (no monthly fee). The first
|
|
1154
1158
|
# number always ends with a human step: {WhatsAppSignupResource#create}
|
|
1155
1159
|
# returns a +connect_url+ that a person must open in a browser and log in
|
|
1156
1160
|
# with Facebook to link their WhatsApp Business Account. More numbers can
|
|
@@ -1192,7 +1196,7 @@ module Sendly
|
|
|
1192
1196
|
# every method on this resource gets 404 +not_found+.
|
|
1193
1197
|
#
|
|
1194
1198
|
# @example Connect a number, create a template, then send
|
|
1195
|
-
# # 1. Connect (
|
|
1199
|
+
# # 1. Connect ($9.99 one-time; a human must open the connect URL)
|
|
1196
1200
|
# signup = client.whatsapp.signup.create(phone_number: "+15559876543")
|
|
1197
1201
|
# puts "Have your user open: #{signup.connect_url}"
|
|
1198
1202
|
#
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sendly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.5.
|
|
4
|
+
version: 4.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sendly
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|