novu 0.1.0 → 1.0.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +8 -17
- data/README.md +763 -71
- data/Rakefile +2 -1
- data/lib/novu/api/blueprints.rb +29 -0
- data/lib/novu/api/changes.rb +4 -2
- data/lib/novu/api/integrations.rb +11 -0
- data/lib/novu/api/subscribers.rb +89 -1
- data/lib/novu/api/tenants.rb +82 -0
- data/lib/novu/api/topics.rb +23 -0
- data/lib/novu/client.rb +4 -0
- data/lib/novu/version.rb +1 -1
- metadata +21 -15
data/README.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
-
|
1
|
+
<div align="center">
|
2
|
+
<a href="https://novu.co" target="_blank">
|
3
|
+
<picture>
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/2233092/213641039-220ac15f-f367-4d13-9eaf-56e79433b8c1.png">
|
5
|
+
<img src="https://user-images.githubusercontent.com/2233092/213641043-3bbb3f21-3c53-4e67-afe5-755aeb222159.png" width="280" alt="Logo"/>
|
6
|
+
</picture>
|
7
|
+
</a>
|
8
|
+
</div>
|
2
9
|
|
3
|
-
|
10
|
+
# Novu Ruby client library
|
11
|
+
|
12
|
+
[](https://rubygems.org/gems/novu)
|
13
|
+
[](https://rubygems.org/gems/novu/)
|
14
|
+
|
15
|
+
> This is a Ruby client library for communicating with the [Novu API](https://api.novu.co/api).
|
4
16
|
|
5
17
|
## Installation
|
6
18
|
|
@@ -25,7 +37,7 @@ To use the library, first initialize the client with your API token:
|
|
25
37
|
```ruby
|
26
38
|
require 'novu'
|
27
39
|
|
28
|
-
client = Novu::Client.new('
|
40
|
+
client = Novu::Client.new('YOUR_NOVU_API_TOKEN')
|
29
41
|
```
|
30
42
|
|
31
43
|
You can then call methods on the client to interact with the Novu API:
|
@@ -38,119 +50,799 @@ client.notifications
|
|
38
50
|
|
39
51
|
The client methods map directly to the Novu API endpoints. Here's a list of all the available methods. Check [the API docs](https://docs.novu.co/api/overview) for list of available `methods`.
|
40
52
|
|
53
|
+
### Blueprints
|
54
|
+
|
55
|
+
- Get V1blueprints: `get_blueprint(template_id)`
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
client.get_blueprint('<insert-template-id>')
|
59
|
+
```
|
60
|
+
|
61
|
+
- Get V1blueprints by category: `group_blueprints_by_category()`
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
client.group_blueprints_by_category()
|
65
|
+
```
|
66
|
+
|
41
67
|
### Changes
|
42
68
|
|
43
|
-
- `changes(query = {})`
|
44
|
-
|
45
|
-
|
46
|
-
|
69
|
+
- Get changes: `changes(query = {})`
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
client.changes({
|
73
|
+
'page' => 1, # optional
|
74
|
+
'limit' => 10, # optional
|
75
|
+
'promoted' => 'hello'
|
76
|
+
})
|
77
|
+
```
|
78
|
+
|
79
|
+
- Get changes count: `count_changes()`
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
client.count_changes()
|
83
|
+
```
|
84
|
+
|
85
|
+
- Apply changes: `apply_bulk_changes()`
|
86
|
+
```ruby
|
87
|
+
client.apply_bulk_changes({
|
88
|
+
'changeIds' => ['<insert-all-the-change-ids>']
|
89
|
+
})
|
90
|
+
```
|
91
|
+
|
92
|
+
- Apply change: `apply_change(change_id)`
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
client.apply_change('7789')
|
96
|
+
```
|
47
97
|
|
48
98
|
### Environments
|
49
99
|
|
50
|
-
- `current_environment()`
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
- `
|
55
|
-
|
100
|
+
- Get current environment: `current_environment()`
|
101
|
+
```ruby
|
102
|
+
client.current_environment()
|
103
|
+
```
|
104
|
+
- Create environment: `create_environment(body)`
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
payload = {
|
108
|
+
'name' => 'Staging',
|
109
|
+
'parentId' => '7789' # optional
|
110
|
+
}
|
111
|
+
client.create_environment(payload)
|
112
|
+
```
|
113
|
+
|
114
|
+
- Get environments: `environments()`
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
client.environments()
|
118
|
+
```
|
119
|
+
|
120
|
+
- Update environment by id: `update_environment(environment_id, body)`
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
client.update_environment('64a713bdexxxxxx', {
|
124
|
+
'name' => 'Local', # optional
|
125
|
+
'identifier' => 'local', # optional
|
126
|
+
'parentId' => '7789', # optional
|
127
|
+
'dns' => { # optional
|
128
|
+
'inboundParseDomain' => 'dev.test' # optional
|
129
|
+
}
|
130
|
+
})
|
131
|
+
```
|
132
|
+
|
133
|
+
- Get api keys: `api_keys()`
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
client.api_keys()
|
137
|
+
```
|
138
|
+
|
139
|
+
- Regenerate api keys: `regenerate_api_keys()`
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
client.regenerate_api_keys()
|
143
|
+
```
|
144
|
+
|
56
145
|
- `update_widget_settings(body)`
|
57
146
|
|
147
|
+
```ruby
|
148
|
+
client.update_widget_settings({ 'notificationCenterEncryption' => true})
|
149
|
+
```
|
150
|
+
|
151
|
+
|
58
152
|
### Events
|
59
153
|
|
60
|
-
- `trigger_event(body)`
|
61
|
-
|
62
|
-
|
63
|
-
|
154
|
+
- Trigger event: `trigger_event(body)`
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
payload = {
|
158
|
+
'name' => 'Trigger1',
|
159
|
+
'payload' => { # optional
|
160
|
+
'first-name' => 'Adam' # optional
|
161
|
+
},
|
162
|
+
'to' => {
|
163
|
+
'subscriberId' => '7789'
|
164
|
+
},
|
165
|
+
'transactionId' => '89kjfke9893' #optional
|
166
|
+
}
|
167
|
+
client.trigger_event(payload)
|
168
|
+
```
|
169
|
+
|
170
|
+
- Bulk trigger event: `trigger_bulk_event(body)`
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
payload = {
|
174
|
+
'events' => [
|
175
|
+
{
|
176
|
+
'name' => 'Trigger1',
|
177
|
+
'payload' => { # optional
|
178
|
+
'first-name' => 'Adam' # optional
|
179
|
+
},
|
180
|
+
'to' => {
|
181
|
+
'subscriberId' => '7789'
|
182
|
+
},
|
183
|
+
'transactionId' => '89kjfke9893' #optional
|
184
|
+
},
|
185
|
+
{
|
186
|
+
'name' => 'Trigger2',
|
187
|
+
'payload' => { # optional
|
188
|
+
'last-name' => 'Eve' # optional
|
189
|
+
},
|
190
|
+
'to' => {
|
191
|
+
'subscriberId' => '7789'
|
192
|
+
},
|
193
|
+
'transactionId' => 'sw900999as' #optional
|
194
|
+
}
|
195
|
+
]
|
196
|
+
}
|
197
|
+
client.trigger_bulk_event(payload)
|
198
|
+
```
|
199
|
+
|
200
|
+
- Broadcast event to all: `broadcast_event(body)`
|
201
|
+
|
202
|
+
```ruby
|
203
|
+
payload = {
|
204
|
+
'name' => 'Trigger',
|
205
|
+
'payload' => {
|
206
|
+
'first-name' => 'Adam',
|
207
|
+
'last-name' => 'Eve'
|
208
|
+
},
|
209
|
+
'transactionId' => 'sw900999as' #optional
|
210
|
+
}
|
211
|
+
client.broadcast_event(payload)
|
212
|
+
```
|
213
|
+
|
214
|
+
- Cancel triggered event: `cancel_triggered_event(transaction_id)`
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
client.cancel_triggered_event('8fxxxee-xxx-4f2b-a0e8-xxxxx')
|
218
|
+
```
|
219
|
+
|
64
220
|
|
65
221
|
### Execution Details
|
66
222
|
|
67
|
-
- `execution_details(query = {})`
|
223
|
+
- Get execution details: `execution_details(query = {})`
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
client.execution_details({
|
227
|
+
'notificationId' => '8fxxx-xxx-ef9xxxxce66',
|
228
|
+
'subscriberId' => '7789'
|
229
|
+
})
|
230
|
+
```
|
68
231
|
|
69
232
|
### Feeds
|
70
233
|
|
71
|
-
- `create_feed(body)`
|
72
|
-
|
73
|
-
|
234
|
+
- Create feed: `create_feed(body)`
|
235
|
+
|
236
|
+
```ruby
|
237
|
+
client.create_feed({
|
238
|
+
'name' => 'New feed'
|
239
|
+
})
|
240
|
+
```
|
241
|
+
|
242
|
+
- Get feeds: `feeds()`
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
client.feeds()
|
246
|
+
```
|
247
|
+
|
248
|
+
- Delete feed: `delete_feed(feed_id)`
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
client.delete_feed('xxxx714xxa8cbxxxxx2d932')
|
252
|
+
```
|
253
|
+
|
74
254
|
|
75
255
|
### Inbound Parse
|
76
256
|
|
77
|
-
- `validate_mx_record_setup_for_inbound_parse()`
|
257
|
+
- Validate the mx record setup for the inbound parse functionality: `validate_mx_record_setup_for_inbound_parse()`
|
258
|
+
|
259
|
+
```ruby
|
260
|
+
client.validate_mx_record_setup_for_inbound_parse()
|
261
|
+
```
|
78
262
|
|
79
263
|
### Integrations
|
80
264
|
|
81
|
-
- `integrations()`
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
- `
|
88
|
-
|
265
|
+
- Get integrations: `integrations()`
|
266
|
+
|
267
|
+
```ruby
|
268
|
+
client.integrations()
|
269
|
+
```
|
270
|
+
|
271
|
+
- Create integration: `create_integration(body)`
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
body = {
|
275
|
+
'providerId' => '<insert-provider-id>',
|
276
|
+
'channel' => '<insert-channel>',
|
277
|
+
'credentials' => {
|
278
|
+
# insert all the fields
|
279
|
+
},
|
280
|
+
'active' => true,
|
281
|
+
'check' => true
|
282
|
+
}
|
283
|
+
client.create_integration(body)
|
284
|
+
```
|
285
|
+
|
286
|
+
- Get active integrations: `active_integrations()`
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
client.active_integrations()
|
290
|
+
```
|
291
|
+
|
292
|
+
- Get webhook support status for provider: `webhook_provider_status(provider_id)`
|
293
|
+
|
294
|
+
```ruby
|
295
|
+
client.webhook_provider_status('<insert-provider-id>')
|
296
|
+
```
|
297
|
+
|
298
|
+
- Update integration: `update_integration(integration_id, body)`
|
299
|
+
|
300
|
+
```ruby
|
301
|
+
body = {
|
302
|
+
'active' => true,
|
303
|
+
'check' => true
|
304
|
+
'credentials' => {
|
305
|
+
# insert all the fields
|
306
|
+
},
|
307
|
+
}
|
308
|
+
client.update_integration('<insert-provider-id>', body)
|
309
|
+
```
|
310
|
+
|
311
|
+
- Delete integration: `delete_integration(integration_id)`
|
312
|
+
|
313
|
+
```ruby
|
314
|
+
client.delete_integration('<insert-provider-id>')
|
315
|
+
```
|
316
|
+
|
317
|
+
- Get channel limit: `channel_limit(channel_type)`
|
318
|
+
|
319
|
+
```ruby
|
320
|
+
client.channel_limit('<insert-channel-type>')
|
321
|
+
```
|
322
|
+
|
323
|
+
- Get in-app status: `in_app_status()`
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
client.in_app_status()
|
327
|
+
```
|
328
|
+
|
329
|
+
- Set integration as primary: `set_integration_as_primary(integration_id)`
|
330
|
+
|
331
|
+
```ruby
|
332
|
+
client.set_integration_as_primary('<insert-integration-id>')
|
333
|
+
```
|
334
|
+
|
89
335
|
|
90
336
|
### Layouts
|
91
337
|
|
92
|
-
- `create_layout(body)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
338
|
+
- Layout creation: `create_layout(body)`
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
payload = {
|
342
|
+
'name' => 'New layout',
|
343
|
+
'content' => '{{{body}}}',
|
344
|
+
'variables' => ['<list-variables-here>'], # optional
|
345
|
+
'description' => 'This is a description for the new layout', # optional
|
346
|
+
'isDefault' => true # optional
|
347
|
+
}
|
348
|
+
client.create_layout(payload)
|
349
|
+
```
|
350
|
+
|
351
|
+
- Filter layouts: `layouts(query = {})`
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
client.layouts({
|
355
|
+
'page' => 1, # optional
|
356
|
+
'pageSize' => 10, # optional
|
357
|
+
'sortBy' => 'createdAt', # optional
|
358
|
+
'orderBy' => 1 # optional
|
359
|
+
})
|
360
|
+
```
|
361
|
+
|
362
|
+
- Get layout: `layout(layout_id)`
|
363
|
+
|
364
|
+
```ruby
|
365
|
+
client.layout('<insert-layout-id>')
|
366
|
+
```
|
367
|
+
|
368
|
+
- Delete layout: `delete_layout(layout_id)`
|
369
|
+
|
370
|
+
```ruby
|
371
|
+
client.delete_layout('<insert-layout-id>')
|
372
|
+
```
|
373
|
+
|
374
|
+
- Update a layout: `update_layout(layout_id, body)`
|
375
|
+
|
376
|
+
```ruby
|
377
|
+
payload = {
|
378
|
+
'name' => 'Update layout', # optional
|
379
|
+
'content' => '{{{body}}}', # optional
|
380
|
+
'description' => 'This is a description for the new layout', # optional
|
381
|
+
'isDefault' => true # optional
|
382
|
+
'variables' => ['<list-variables-here>'], # optional
|
383
|
+
}
|
384
|
+
client.update_layout('<insert-layout-id>', payload)
|
385
|
+
```
|
386
|
+
|
387
|
+
- Set default layout: `make_default_layout(layout_id)`
|
388
|
+
|
389
|
+
```ruby
|
390
|
+
client.make_default_layout('<insert-layout-id>')
|
391
|
+
```
|
392
|
+
|
98
393
|
|
99
394
|
### Messages
|
100
395
|
|
101
|
-
- `messages(query = {})`
|
102
|
-
|
396
|
+
- Get messages: `messages(query = {})`
|
397
|
+
|
398
|
+
```ruby
|
399
|
+
payload = {
|
400
|
+
'channel' => 'slack', # optional
|
401
|
+
'subscriberId' => '7789', # optional
|
402
|
+
'transactionId' =>'sw900999as', # optional
|
403
|
+
'page' => 4, # optional
|
404
|
+
'limit' => 10, # optional
|
405
|
+
}
|
406
|
+
client.messages(payload)
|
407
|
+
```
|
408
|
+
|
409
|
+
- Delete message: `delete_message(message_id)`
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
client.delete_message('<insert-message-id>')
|
413
|
+
```
|
103
414
|
|
104
415
|
### Notification Groups
|
105
416
|
|
106
|
-
- `create_notification_group(body)`
|
107
|
-
|
417
|
+
- Create Notification group: `create_notification_group(body)`
|
418
|
+
|
419
|
+
```ruby
|
420
|
+
client.create_notification_group({
|
421
|
+
'name' => '<insert-name>'
|
422
|
+
})
|
423
|
+
```
|
424
|
+
|
425
|
+
- Get Notification groups: `notification_groups()`
|
426
|
+
|
427
|
+
```ruby
|
428
|
+
client.notification_groups()
|
429
|
+
```
|
108
430
|
|
109
431
|
### Notification Templates
|
110
432
|
|
111
|
-
- `notification_templates(query = {})`
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
433
|
+
- Get notification templates: `notification_templates(query = {})`
|
434
|
+
|
435
|
+
```ruby
|
436
|
+
client.notification_templates({
|
437
|
+
'page' => 4, # optional
|
438
|
+
'limit' => 10, # optional
|
439
|
+
})
|
440
|
+
```
|
441
|
+
|
442
|
+
- Create notification template: `create_notification_template(body)`
|
443
|
+
|
444
|
+
```ruby
|
445
|
+
body = {
|
446
|
+
'name' => '<insert-name>',
|
447
|
+
'notificationGroupId' => 'notificationGroupId',
|
448
|
+
'tags' => ['tags'], # optional
|
449
|
+
'description' => 'description', # optional
|
450
|
+
'steps' => [ # optional
|
451
|
+
# insert all fields here
|
452
|
+
],
|
453
|
+
'active' => true, # optional
|
454
|
+
'draft' => true, # optional
|
455
|
+
'critical' => true, # optional
|
456
|
+
'preferenceSettings' => { # optional
|
457
|
+
# insert all fields here
|
458
|
+
},
|
459
|
+
'blueprintId' => 'blueprintId' # optional
|
460
|
+
}
|
461
|
+
client.create_notification_template(body)
|
462
|
+
```
|
463
|
+
|
464
|
+
- Update notification template: `update_notification_template(template_id, body)`
|
465
|
+
|
466
|
+
```ruby
|
467
|
+
body = {
|
468
|
+
'name' => '<insert-name>',
|
469
|
+
'notificationGroupId' => 'notificationGroupId',
|
470
|
+
'tags' => ['tags'], # optional
|
471
|
+
'description' => 'description', # optional
|
472
|
+
'steps' => [ # optional
|
473
|
+
# insert all fields here
|
474
|
+
],
|
475
|
+
'active' => true, # optional
|
476
|
+
'draft' => true, # optional
|
477
|
+
'critical' => true, # optional
|
478
|
+
'preferenceSettings' => { # optional
|
479
|
+
# insert all fields here
|
480
|
+
},
|
481
|
+
'blueprintId' => 'blueprintId' # optional
|
482
|
+
}
|
483
|
+
client.update_notification_template('<insert-template-id>', body)
|
484
|
+
```
|
485
|
+
|
486
|
+
- Delete notification template`delete_notification_template(template_id)`
|
487
|
+
|
488
|
+
```ruby
|
489
|
+
client.delete_notification_template('<insert-template-id>')
|
490
|
+
```
|
491
|
+
|
492
|
+
- Get a notification template: `notification_template(template_id)`
|
493
|
+
|
494
|
+
```ruby
|
495
|
+
client.notification_template('<insert-template-id>')
|
496
|
+
```
|
497
|
+
|
498
|
+
- Get a notification template blueprint: `notification_template_blueprint(template_id)`
|
499
|
+
|
500
|
+
```ruby
|
501
|
+
client.notification_template_blueprint('<insert-template-id>')
|
502
|
+
```
|
503
|
+
|
504
|
+
- Create a new notification template blueprint: `create_notification_template_blueprint(template_id)`
|
505
|
+
|
506
|
+
```ruby
|
507
|
+
client.create_notification_template_blueprint('<insert-template-id>')
|
508
|
+
```
|
509
|
+
|
510
|
+
- Update notification template status: `update_notification_template_status(template_id, body)`
|
511
|
+
|
512
|
+
```ruby
|
513
|
+
client.update_notification_template_status('<insert-template-id>', { 'active' => true })
|
514
|
+
```
|
119
515
|
|
120
516
|
### Notification
|
121
517
|
|
122
|
-
- `notifications(query = {})`
|
123
|
-
|
124
|
-
|
125
|
-
|
518
|
+
- Get notifications: `notifications(query = {})`
|
519
|
+
|
520
|
+
```ruby
|
521
|
+
body = {
|
522
|
+
'channels' => ['<insert-channels>'],
|
523
|
+
'templates' => ['<insert-templates>'],
|
524
|
+
'emails' => ['<insert-emails>'],
|
525
|
+
'search' => '<insert-search-string>'
|
526
|
+
'page' => 2 , # optional
|
527
|
+
'transactionId' =>'sw900999as', # optional
|
528
|
+
}
|
529
|
+
client.notifications(body)
|
530
|
+
```
|
531
|
+
|
532
|
+
- Get notification statistics: `notifications_stats()`
|
533
|
+
|
534
|
+
```ruby
|
535
|
+
client.notifications_stats()
|
536
|
+
```
|
537
|
+
|
538
|
+
- Get notification graph statistics: `notifications_graph_stats(query = {})`
|
539
|
+
|
540
|
+
```ruby
|
541
|
+
client.notifications_graph_stats({
|
542
|
+
'days' => 5 # optional
|
543
|
+
})
|
544
|
+
```
|
545
|
+
|
546
|
+
- Get notification: `notification(notification_id)`
|
547
|
+
|
548
|
+
```ruby
|
549
|
+
client.notification('<insert-notification-id>')
|
550
|
+
```
|
126
551
|
|
127
552
|
### Subscribers
|
128
553
|
|
129
|
-
- `subscribers(query = {}) `
|
130
|
-
|
554
|
+
- Get subscribers: `subscribers(query = {}) `
|
555
|
+
|
556
|
+
```ruby
|
557
|
+
client.subscribers({
|
558
|
+
'page' => 1, # optional
|
559
|
+
'limit' => 15, # optional
|
560
|
+
})
|
561
|
+
```
|
562
|
+
|
563
|
+
- Create subscriber: `create_subscriber(body)`
|
564
|
+
|
565
|
+
```ruby
|
566
|
+
payload = {
|
567
|
+
'subscriberId' => '7789',
|
568
|
+
'email' => '<insert-email>', # optional
|
569
|
+
'firstName' => '<insert-firstName>', # optional
|
570
|
+
'lastName' => '<insert-lastName>', # optional
|
571
|
+
'phone' => '<insert-phone>', # optional
|
572
|
+
'avatar' => '<insert-profile-avatar>' # optional
|
573
|
+
}
|
574
|
+
client.create_subscriber(payload)
|
575
|
+
```
|
576
|
+
|
131
577
|
- `subscriber(subscriber_id)`
|
132
|
-
|
133
|
-
|
134
|
-
-
|
135
|
-
|
136
|
-
|
137
|
-
- `
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
578
|
+
|
579
|
+
```ruby
|
580
|
+
client.subscriber('<insert-subscriber-id>')
|
581
|
+
```
|
582
|
+
|
583
|
+
- Update subscriber: `update_subscriber(subscriber_id, body)`
|
584
|
+
|
585
|
+
```ruby
|
586
|
+
payload = {
|
587
|
+
'email' => '<insert-email>', # optional
|
588
|
+
'firstName' => '<insert-firstName>', # optional
|
589
|
+
'lastName' => '<insert-lastName>', # optional
|
590
|
+
'phone' => '<insert-phone>', # optional
|
591
|
+
'avatar' => '<insert-profile-avatar>' # optional
|
592
|
+
}
|
593
|
+
client.update_subscriber('<insert-subscriber-id>', payload)
|
594
|
+
```
|
595
|
+
|
596
|
+
- Delete subscriber: `delete_subscriber(subscriber_id)`
|
597
|
+
|
598
|
+
```ruby
|
599
|
+
client.delete_subscriber('<insert-subscriber-id>')
|
600
|
+
```
|
601
|
+
|
602
|
+
- Update subscriber credentials: `update_subscriber_credentials(subscriber_id, body)`
|
603
|
+
|
604
|
+
```ruby
|
605
|
+
body = {
|
606
|
+
'providerId' => '<insert-provider-id>',
|
607
|
+
'credentials' => {
|
608
|
+
# Insert all fields here
|
609
|
+
}
|
610
|
+
}
|
611
|
+
client.update_subscriber_credentials('<insert-subscriber-id>', body)
|
612
|
+
```
|
613
|
+
|
614
|
+
- Delete subscriber credentials by providerId: `delete_subscriber_credentials(subscriberId, providerId)`
|
615
|
+
|
616
|
+
```ruby
|
617
|
+
client.delete_subscriber_credentials('<insert-subscriber-id>', '<insert-provider-id>')
|
618
|
+
```
|
619
|
+
|
620
|
+
- Update subscriber online status: `update_subscriber_online_status(subscriber_id, body)`
|
621
|
+
|
622
|
+
```ruby
|
623
|
+
client.update_subscriber_online_status('<insert-subscriber-id>', { 'isOnline' => true })
|
624
|
+
```
|
625
|
+
|
626
|
+
- Get subscriber preferences: `subscriber_preferences(subscriber_id)`
|
627
|
+
|
628
|
+
```ruby
|
629
|
+
client.subscriber_preferences('<insert-subscriber-id>')
|
630
|
+
```
|
631
|
+
|
632
|
+
- Update subscriber preference: `update_subscriber_preference(subscriber_id, template_id, body)`
|
633
|
+
|
634
|
+
```ruby
|
635
|
+
body = {
|
636
|
+
'channel' => {
|
637
|
+
# Insert all fields here
|
638
|
+
},
|
639
|
+
'enabled' => true
|
640
|
+
}
|
641
|
+
client.update_subscriber_preference('<insert-subscriber-id>', '<insert-template-id>', body)
|
642
|
+
```
|
643
|
+
|
644
|
+
- Create bulk subscribers: `bulk_create_subscribers(body)`
|
645
|
+
```ruby
|
646
|
+
payload = {
|
647
|
+
'subscribers' => [
|
648
|
+
{
|
649
|
+
'name' => 'subscriber-1',
|
650
|
+
'email' => 'user1@example.com',
|
651
|
+
'firstName' => 'test1',
|
652
|
+
'lastName' => 'test1',
|
653
|
+
'phone' => '08122442244',
|
654
|
+
'subscriberId' => 'subscriber-test-1221'
|
655
|
+
},
|
656
|
+
{
|
657
|
+
'name' => 'subscriber2',
|
658
|
+
'email' => 'user2@example.com',
|
659
|
+
'firstName' => 'test2',
|
660
|
+
'lastName' => 'test2',
|
661
|
+
'phone' => '0814422334',
|
662
|
+
'subscriberId' => 'subscriber-test-9090'
|
663
|
+
}
|
664
|
+
]
|
665
|
+
}
|
666
|
+
client.bulk_create_subscribers(payload)
|
667
|
+
```
|
668
|
+
|
669
|
+
|
670
|
+
- Get in-app notification feed for a particular subscriber: `subscriber_notification_feed(subscriber_id, query = {})`
|
671
|
+
|
672
|
+
```ruby
|
673
|
+
client.subscriber_notification_feed('<insert-subscriber-id>', {
|
674
|
+
'page' => 3, # optional
|
675
|
+
'limit' => 15, # optional
|
676
|
+
'read' => true, # optional
|
677
|
+
'seen' => true, # optional
|
678
|
+
})
|
679
|
+
```
|
680
|
+
|
681
|
+
- Get the unseen in-app notifications count for subscribers feed: `subscriber_unseen_notification_count(subscriber_id, query = {})`
|
682
|
+
|
683
|
+
```ruby
|
684
|
+
client.subscriber_unseen_notification_count('<insert-subscriber-id>', {
|
685
|
+
'limit' => 15, # optional
|
686
|
+
'seen' => false, # optional
|
687
|
+
})
|
688
|
+
```
|
689
|
+
|
690
|
+
- Mark a subscriber feed message as seen: `mark_subscriber_feed_seen(subscriber_id, body)`
|
691
|
+
|
692
|
+
```ruby
|
693
|
+
client.mark_subscriber_feed_seen('<insert-subscriber-id>', {
|
694
|
+
'messageId' => '<insert-message-id>',
|
695
|
+
'mark' => {
|
696
|
+
'seen' => true,
|
697
|
+
'read' => true
|
698
|
+
}
|
699
|
+
})
|
700
|
+
```
|
701
|
+
|
702
|
+
- Mark message action as seen: `mark_message_action_seen(subscriber_id, message_id, type)`
|
703
|
+
|
704
|
+
```ruby
|
705
|
+
client.mark_message_action_seen('<insert-subscriber-id>', '<insert-message-id>', '<insert-type>')
|
706
|
+
```
|
707
|
+
|
708
|
+
- Marks all the subscriber messages: `mark_all_subscriber_messages(subscriber_id, body)`
|
709
|
+
|
710
|
+
```ruby
|
711
|
+
body = {
|
712
|
+
'markAs' => 'seen'
|
713
|
+
}
|
714
|
+
client.mark_all_subscriber_messages('<insert-subscriber-id>', body)
|
715
|
+
```
|
716
|
+
|
717
|
+
- Handle providers OAUTH redirect: `provider_oauth_redirect(subscriber_id, provider_id, query)`
|
718
|
+
```ruby
|
719
|
+
query = {
|
720
|
+
'environmentId' => '<insert-environment-id>',
|
721
|
+
'code' => '<insert-code>',
|
722
|
+
'hmacHash' => '<insert-hmacHash>',
|
723
|
+
'integrationIdentifier' => '<insert-integration-identifier>'
|
724
|
+
}
|
725
|
+
client.provider_oauth_redirect('<insert-subscriber-id>', '<insert-provider-id>', query)
|
726
|
+
```
|
727
|
+
|
728
|
+
- Handle chat OAUTH: `chat_oauth(subscriber_id, provider_id, query)`
|
729
|
+
```ruby
|
730
|
+
query = {
|
731
|
+
'environmentId' => '<insert-environment-id>',
|
732
|
+
'hmacHash' => '<insert-hmacHash>',
|
733
|
+
'integrationIdentifier' => '<insert-integration-identifier>'
|
734
|
+
}
|
735
|
+
client.chat_oauth('<insert-subscriber-id>', '<insert-provider-id>', query)
|
736
|
+
```
|
737
|
+
|
738
|
+
### Tenants
|
739
|
+
|
740
|
+
- Tenant create: `create_tenant(body)`
|
741
|
+
|
742
|
+
```ruby
|
743
|
+
client.create_tenant({
|
744
|
+
'identifier' => '<a-unique-identifier>',
|
745
|
+
'name' => '<name-of-the-tenant>',
|
746
|
+
'data' => {
|
747
|
+
'company' => 'a company',
|
748
|
+
'date-registered' => '2023-0-15'
|
749
|
+
}
|
750
|
+
})
|
751
|
+
```
|
752
|
+
|
753
|
+
- Get tenants: `tenants(query = {})`
|
754
|
+
|
755
|
+
```ruby
|
756
|
+
client.tenants({
|
757
|
+
'page' => 1, # optional
|
758
|
+
'limit' => 10, # optional
|
759
|
+
})
|
760
|
+
```
|
761
|
+
|
762
|
+
- Get tenant: `tenant(identifier)`
|
763
|
+
|
764
|
+
```ruby
|
765
|
+
client.tenant('<a-unique-identifier>')
|
766
|
+
```
|
767
|
+
|
768
|
+
- Update tenant: `update_tenant(identifier, body)`
|
769
|
+
|
770
|
+
```ruby
|
771
|
+
client.update_tenant('<a-unique-identifier>', {
|
772
|
+
'identifier' => '<a-unique-identifier>',
|
773
|
+
'name' => '<name-of-the-tenant>',
|
774
|
+
})
|
775
|
+
```
|
776
|
+
|
777
|
+
- Delete tenant: `delete_tenant(identifier)`
|
778
|
+
|
779
|
+
```ruby
|
780
|
+
client.delete_tenant('<a-unique-identifier>')
|
781
|
+
```
|
142
782
|
|
143
783
|
### Topics
|
144
784
|
|
145
|
-
- `create_topic(body)`
|
146
|
-
|
147
|
-
|
785
|
+
- Topic creation: `create_topic(body)`
|
786
|
+
|
787
|
+
```ruby
|
788
|
+
client.create_topic({
|
789
|
+
'key' => 'key',
|
790
|
+
'name' => 'name'
|
791
|
+
})
|
792
|
+
```
|
793
|
+
|
794
|
+
- Filter topics: `topics(query = {})`
|
795
|
+
|
796
|
+
```ruby
|
797
|
+
client.topics({
|
798
|
+
'name' => 'name', # optional
|
799
|
+
'page' => 1, # optional
|
800
|
+
'pageSize' => 10, # optional
|
801
|
+
})
|
802
|
+
```
|
803
|
+
|
804
|
+
- Subscribers addition: `add_subscribers(topic_key, body)`
|
805
|
+
|
806
|
+
```ruby
|
807
|
+
client.add_subscribers('<insert-topic-key>', {
|
808
|
+
'subscribers' => ['<insert-list-of-subscribers>']
|
809
|
+
})
|
810
|
+
```
|
811
|
+
|
148
812
|
- `remove_subscribers(topic_key, body)`
|
149
|
-
- `topic(topic_key)`
|
150
|
-
- `rename_topic(topic_key, body)`
|
151
813
|
|
152
|
-
|
814
|
+
```ruby
|
815
|
+
client.
|
816
|
+
```
|
817
|
+
|
818
|
+
- Get topic: `topic(topic_key)`
|
819
|
+
|
820
|
+
```ruby
|
821
|
+
client.topic('<insert-topic-key>')
|
822
|
+
```
|
823
|
+
|
824
|
+
- Rename a topic: `rename_topic(topic_key, body)`
|
825
|
+
|
826
|
+
```ruby
|
827
|
+
client.rename_topic('<insert-topic-key>', {
|
828
|
+
'name' => 'new name'
|
829
|
+
})
|
830
|
+
```
|
831
|
+
|
832
|
+
- Delete topic: `delete_topic(topic_key)`
|
833
|
+
|
834
|
+
```ruby
|
835
|
+
client.delete_topic('<insert-topic-key>')
|
836
|
+
```
|
837
|
+
|
838
|
+
- Check topic subsriber: `subscriber_topic(topic_key, externalSubscriberId)`
|
839
|
+
|
840
|
+
```ruby
|
841
|
+
client.subscriber_topic('<insert-topic-key>', '<insert-externalSubscriberId>')
|
842
|
+
```
|
843
|
+
|
844
|
+
### For more information about these methods and their parameters, see the [API documentation](https://docs.novu.co/api-reference).
|
153
845
|
|
154
846
|
## Contributing
|
155
847
|
|
156
|
-
Bug reports and pull requests are welcome on GitHub at https://
|
848
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/novuhq/novu-ruby
|