sendly 3.5.2 → 3.5.4
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 +124 -6
- data/lib/sendly/version.rb +1 -1
- 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: acdd7d0e32f947707ee880aa448bf6d609fdf04b0276c3db3e13eb8d437981bb
|
|
4
|
+
data.tar.gz: 2c53e468cefc039756589b372c1e1f3ba521dd0785beae1ecfdc63278c852b90
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4089829bd5495482eab7d32e1ab3ffd4c8ab4ec6183eee5d865f8df12c5944d02cf47791e2403b50b44184bf8939dc47122378caaec9c5080475664523cf633
|
|
7
|
+
data.tar.gz: c6bc73e5563d6d91d3c6c13cefd5681cad855c1ba0781a60137dd5e442e77c6d12267a659f01181a360247b12ba588a1ded139352f957af02c0c0cd0624777c1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -86,9 +86,17 @@ client = Sendly::Client.new(
|
|
|
86
86
|
### Send an SMS
|
|
87
87
|
|
|
88
88
|
```ruby
|
|
89
|
+
# Marketing message (default)
|
|
89
90
|
message = client.messages.send(
|
|
90
91
|
to: "+15551234567",
|
|
91
|
-
text: "
|
|
92
|
+
text: "Check out our new features!"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Transactional message (bypasses quiet hours)
|
|
96
|
+
message = client.messages.send(
|
|
97
|
+
to: "+15551234567",
|
|
98
|
+
text: "Your verification code is: 123456",
|
|
99
|
+
message_type: "transactional"
|
|
92
100
|
)
|
|
93
101
|
|
|
94
102
|
puts message.id
|
|
@@ -127,6 +135,55 @@ puts message.status
|
|
|
127
135
|
puts message.delivered_at
|
|
128
136
|
```
|
|
129
137
|
|
|
138
|
+
### Scheduling Messages
|
|
139
|
+
|
|
140
|
+
```ruby
|
|
141
|
+
# Schedule a message for future delivery
|
|
142
|
+
scheduled = client.messages.schedule(
|
|
143
|
+
to: "+15551234567",
|
|
144
|
+
text: "Your appointment is tomorrow!",
|
|
145
|
+
scheduled_at: "2025-01-15T10:00:00Z"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
puts scheduled.id
|
|
149
|
+
puts scheduled.scheduled_at
|
|
150
|
+
|
|
151
|
+
# List scheduled messages
|
|
152
|
+
result = client.messages.list_scheduled
|
|
153
|
+
result.data.each { |msg| puts "#{msg.id}: #{msg.scheduled_at}" }
|
|
154
|
+
|
|
155
|
+
# Get a specific scheduled message
|
|
156
|
+
msg = client.messages.get_scheduled("sched_xxx")
|
|
157
|
+
|
|
158
|
+
# Cancel a scheduled message (refunds credits)
|
|
159
|
+
result = client.messages.cancel_scheduled("sched_xxx")
|
|
160
|
+
puts "Refunded: #{result.credits_refunded} credits"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Batch Messages
|
|
164
|
+
|
|
165
|
+
```ruby
|
|
166
|
+
# Send multiple messages in one API call (up to 1000)
|
|
167
|
+
batch = client.messages.send_batch(
|
|
168
|
+
messages: [
|
|
169
|
+
{ to: "+15551234567", text: "Hello User 1!" },
|
|
170
|
+
{ to: "+15559876543", text: "Hello User 2!" },
|
|
171
|
+
{ to: "+15551112222", text: "Hello User 3!" }
|
|
172
|
+
]
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
puts batch.batch_id
|
|
176
|
+
puts "Queued: #{batch.queued}"
|
|
177
|
+
puts "Failed: #{batch.failed}"
|
|
178
|
+
puts "Credits used: #{batch.credits_used}"
|
|
179
|
+
|
|
180
|
+
# Get batch status
|
|
181
|
+
status = client.messages.get_batch("batch_xxx")
|
|
182
|
+
|
|
183
|
+
# List all batches
|
|
184
|
+
batches = client.messages.list_batches
|
|
185
|
+
```
|
|
186
|
+
|
|
130
187
|
### Iterate All Messages
|
|
131
188
|
|
|
132
189
|
```ruby
|
|
@@ -141,6 +198,66 @@ client.messages.each(status: "delivered") do |message|
|
|
|
141
198
|
end
|
|
142
199
|
```
|
|
143
200
|
|
|
201
|
+
## Webhooks
|
|
202
|
+
|
|
203
|
+
```ruby
|
|
204
|
+
# Create a webhook endpoint
|
|
205
|
+
webhook = client.webhooks.create(
|
|
206
|
+
url: "https://example.com/webhooks/sendly",
|
|
207
|
+
events: ["message.delivered", "message.failed"]
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
puts webhook.id
|
|
211
|
+
puts webhook.secret # Store securely!
|
|
212
|
+
|
|
213
|
+
# List all webhooks
|
|
214
|
+
webhooks = client.webhooks.list
|
|
215
|
+
|
|
216
|
+
# Get a specific webhook
|
|
217
|
+
wh = client.webhooks.get("whk_xxx")
|
|
218
|
+
|
|
219
|
+
# Update a webhook
|
|
220
|
+
client.webhooks.update("whk_xxx",
|
|
221
|
+
url: "https://new-endpoint.example.com/webhook",
|
|
222
|
+
events: ["message.delivered", "message.failed", "message.sent"]
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
# Test a webhook
|
|
226
|
+
result = client.webhooks.test("whk_xxx")
|
|
227
|
+
|
|
228
|
+
# Rotate webhook secret
|
|
229
|
+
rotation = client.webhooks.rotate_secret("whk_xxx")
|
|
230
|
+
|
|
231
|
+
# Delete a webhook
|
|
232
|
+
client.webhooks.delete("whk_xxx")
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Account & Credits
|
|
236
|
+
|
|
237
|
+
```ruby
|
|
238
|
+
# Get account information
|
|
239
|
+
account = client.account.get
|
|
240
|
+
puts account.email
|
|
241
|
+
|
|
242
|
+
# Check credit balance
|
|
243
|
+
credits = client.account.get_credits
|
|
244
|
+
puts "Available: #{credits.available_balance} credits"
|
|
245
|
+
puts "Reserved: #{credits.reserved_balance} credits"
|
|
246
|
+
puts "Total: #{credits.balance} credits"
|
|
247
|
+
|
|
248
|
+
# View credit transaction history
|
|
249
|
+
result = client.account.get_credit_transactions
|
|
250
|
+
result.data.each do |tx|
|
|
251
|
+
puts "#{tx.type}: #{tx.amount} credits - #{tx.description}"
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# List API keys
|
|
255
|
+
result = client.account.list_api_keys
|
|
256
|
+
result.data.each do |key|
|
|
257
|
+
puts "#{key.name}: #{key.prefix}*** (#{key.type})"
|
|
258
|
+
end
|
|
259
|
+
```
|
|
260
|
+
|
|
144
261
|
## Error Handling
|
|
145
262
|
|
|
146
263
|
```ruby
|
|
@@ -211,11 +328,12 @@ Use test API keys (`sk_test_v1_xxx`) with these test numbers:
|
|
|
211
328
|
|
|
212
329
|
| Number | Behavior |
|
|
213
330
|
|--------|----------|
|
|
214
|
-
| +
|
|
215
|
-
| +
|
|
216
|
-
| +
|
|
217
|
-
| +
|
|
218
|
-
| +
|
|
331
|
+
| +15005550000 | Success (instant) |
|
|
332
|
+
| +15005550001 | Fails: invalid_number |
|
|
333
|
+
| +15005550002 | Fails: unroutable_destination |
|
|
334
|
+
| +15005550003 | Fails: queue_full |
|
|
335
|
+
| +15005550004 | Fails: rate_limit_exceeded |
|
|
336
|
+
| +15005550006 | Fails: carrier_violation |
|
|
219
337
|
|
|
220
338
|
## Requirements
|
|
221
339
|
|
data/lib/sendly/version.rb
CHANGED
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: 3.5.
|
|
4
|
+
version: 3.5.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sendly
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|