novu 0.1.0 → 1.1.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.
data/README.md CHANGED
@@ -1,6 +1,18 @@
1
- # Novu ruby client library
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
- This is a Ruby client library for communicating with the [Novu API](https://api.novu.co/api).
10
+ # Novu Ruby client library
11
+
12
+ [![Gem Version](https://img.shields.io/gem/v/novu.svg)](https://rubygems.org/gems/novu)
13
+ [![Gem](https://img.shields.io/gem/dt/novu.svg)](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('MY_API_TOKEN')
40
+ client = Novu::Client.new(access_token: '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,901 @@ 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
- - `count_changes()`
45
- - `apply_bulk_changes()`
46
- - `apply_change(change_id)`
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
- - `create_environment(body)`
52
- - `environments()`
53
- - `update_environment(environment_id, body)`
54
- - `api_keys()`
55
- - `regenerate_api_keys()`
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
- - `trigger_bulk_event(body)`
62
- - `broadcast_event(body)`
63
- - `cancel_triggered_event(transaction_id)`
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
- - `feeds()`
73
- - `delete_feed(feed_id)`
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
- - `create_integration(body)`
83
- - `active_integrations()`
84
- - `webhook_provider_status(provider_id)`
85
- - `update_integration(integration_id, body)`
86
- - `delete_integration(integration_id)`
87
- - `channel_limit(channel_type)`
88
- - `in_app_status()`
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
- - `layouts(query = {})`
94
- - `layout(layout_id)`
95
- - `delete_layout(layout_id)`
96
- - `update_layout(layout_id, body)`
97
- - `make_default_layout(layout_id)`
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
- - `delete_message(message_id)`
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
- - `notification_groups()`
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
- - `create_notification_template(body)`
113
- - `update_notification_template(template_id, body)`
114
- - `delete_notification_template(template_id)`
115
- - `notification_template(template_id)`
116
- - `notification_template_blueprint(template_id)`
117
- - `create_notification_template_blueprint(template_id)`
118
- - `update_notification_template_status(template_id, body)`
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
- - `notifications_stats()`
124
- - `notifications_graph_stats(query = {})`
125
- - `notification(notification_id)`
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
+ ```
551
+
552
+ ### Organizations
553
+
554
+ - Create an organization: `create_organization(body)`
555
+
556
+ ```ruby
557
+ client.create_organization({
558
+ 'logo' => '<insert-organization-logo>',
559
+ 'name' => '<insert-organization-name>',
560
+ })
561
+ ```
562
+
563
+ - Get all organizations: `organizations()`
564
+
565
+ ```ruby
566
+ client.organizations()
567
+ ```
568
+
569
+ - Get current organization: `current_organization()`
570
+
571
+ ```ruby
572
+ client.current_organization()
573
+ ```
574
+
575
+ - Get all members of current organization: `current_organization_members()`
576
+
577
+ ```ruby
578
+ client.current_organization_members()
579
+ ```
580
+
581
+ - Rename organization: `rename_organization(body)`
582
+
583
+ ```ruby
584
+ client.rename_organization({
585
+ name: '<insert-organization-name>'
586
+ })
587
+ ```
588
+
589
+ - Rename organization: `organization_branding(body)`
590
+
591
+ ```ruby
592
+ client.organization_branding({
593
+ logo: '<insert-organization-logo>',
594
+ color: '<insert-organization-color>',
595
+ fontColor: '<insert-organization-fontColor>',
596
+ contentBackground: '<insert-organization-contentBackground>',
597
+ fontFamily: '<insert-organization-fontFamily>'
598
+ })
599
+ ```
600
+
601
+ - Delete member from organization: `delete_organization_member(member_id)`
602
+
603
+ ```ruby
604
+ client.delete_organization_member('<insert-member-id>')
605
+ ```
126
606
 
127
607
  ### Subscribers
128
608
 
129
- - `subscribers(query = {}) `
130
- - `create_subscriber(body)`
609
+ - Get subscribers: `subscribers(query = {}) `
610
+
611
+ ```ruby
612
+ client.subscribers({
613
+ 'page' => 1, # optional
614
+ 'limit' => 15, # optional
615
+ })
616
+ ```
617
+
618
+ - Create subscriber: `create_subscriber(body)`
619
+
620
+ ```ruby
621
+ payload = {
622
+ 'subscriberId' => '7789',
623
+ 'email' => '<insert-email>', # optional
624
+ 'firstName' => '<insert-firstName>', # optional
625
+ 'lastName' => '<insert-lastName>', # optional
626
+ 'phone' => '<insert-phone>', # optional
627
+ 'avatar' => '<insert-profile-avatar>' # optional
628
+ }
629
+ client.create_subscriber(payload)
630
+ ```
631
+
131
632
  - `subscriber(subscriber_id)`
132
- - `update_subscriber(subscriber_id, body)`
133
- - `delete_subscriber(subscriber_id)`
134
- - `update_subscriber_credentials(subscriber_id, body)`
135
- - `update_subscriber_online_status(subscriber_id, body)`
136
- - `subscriber_preferences(subscriber_id)`
137
- - `update_subscriber_preference(subscriber_id, template_id, body)`
138
- - `subscriber_notification_feed(subscriber_id, query = {})`
139
- - `subscriber_unseen_notification_count(subscriber_id, query = {})`
140
- - `mark_subscriber_feed_seen(subscriber_id, body)`
141
- - `mark_message_action_seen(subscriber_id, message_id, type)`
633
+
634
+ ```ruby
635
+ client.subscriber('<insert-subscriber-id>')
636
+ ```
637
+
638
+ - Update subscriber: `update_subscriber(subscriber_id, body)`
639
+
640
+ ```ruby
641
+ payload = {
642
+ 'email' => '<insert-email>', # optional
643
+ 'firstName' => '<insert-firstName>', # optional
644
+ 'lastName' => '<insert-lastName>', # optional
645
+ 'phone' => '<insert-phone>', # optional
646
+ 'avatar' => '<insert-profile-avatar>' # optional
647
+ }
648
+ client.update_subscriber('<insert-subscriber-id>', payload)
649
+ ```
650
+
651
+ - Delete subscriber: `delete_subscriber(subscriber_id)`
652
+
653
+ ```ruby
654
+ client.delete_subscriber('<insert-subscriber-id>')
655
+ ```
656
+
657
+ - Update subscriber credentials: `update_subscriber_credentials(subscriber_id, body)`
658
+
659
+ ```ruby
660
+ body = {
661
+ 'providerId' => '<insert-provider-id>',
662
+ 'credentials' => {
663
+ # Insert all fields here
664
+ }
665
+ }
666
+ client.update_subscriber_credentials('<insert-subscriber-id>', body)
667
+ ```
668
+
669
+ - Delete subscriber credentials by providerId: `delete_subscriber_credentials(subscriberId, providerId)`
670
+
671
+ ```ruby
672
+ client.delete_subscriber_credentials('<insert-subscriber-id>', '<insert-provider-id>')
673
+ ```
674
+
675
+ - Update subscriber online status: `update_subscriber_online_status(subscriber_id, body)`
676
+
677
+ ```ruby
678
+ client.update_subscriber_online_status('<insert-subscriber-id>', { 'isOnline' => true })
679
+ ```
680
+
681
+ - Get subscriber preferences: `subscriber_preferences(subscriber_id)`
682
+
683
+ ```ruby
684
+ client.subscriber_preferences('<insert-subscriber-id>')
685
+ ```
686
+
687
+ - Update subscriber preference: `update_subscriber_preference(subscriber_id, template_id, body)`
688
+
689
+ ```ruby
690
+ body = {
691
+ 'channel' => {
692
+ # Insert all fields here
693
+ },
694
+ 'enabled' => true
695
+ }
696
+ client.update_subscriber_preference('<insert-subscriber-id>', '<insert-template-id>', body)
697
+ ```
698
+
699
+ - Create bulk subscribers: `bulk_create_subscribers(body)`
700
+ ```ruby
701
+ payload = {
702
+ 'subscribers' => [
703
+ {
704
+ 'name' => 'subscriber-1',
705
+ 'email' => 'user1@example.com',
706
+ 'firstName' => 'test1',
707
+ 'lastName' => 'test1',
708
+ 'phone' => '08122442244',
709
+ 'subscriberId' => 'subscriber-test-1221'
710
+ },
711
+ {
712
+ 'name' => 'subscriber2',
713
+ 'email' => 'user2@example.com',
714
+ 'firstName' => 'test2',
715
+ 'lastName' => 'test2',
716
+ 'phone' => '0814422334',
717
+ 'subscriberId' => 'subscriber-test-9090'
718
+ }
719
+ ]
720
+ }
721
+ client.bulk_create_subscribers(payload)
722
+ ```
723
+
724
+
725
+ - Get in-app notification feed for a particular subscriber: `subscriber_notification_feed(subscriber_id, query = {})`
726
+
727
+ ```ruby
728
+ client.subscriber_notification_feed('<insert-subscriber-id>', {
729
+ 'page' => 3, # optional
730
+ 'limit' => 15, # optional
731
+ 'read' => true, # optional
732
+ 'seen' => true, # optional
733
+ })
734
+ ```
735
+
736
+ - Get the unseen in-app notifications count for subscribers feed: `subscriber_unseen_notification_count(subscriber_id, query = {})`
737
+
738
+ ```ruby
739
+ client.subscriber_unseen_notification_count('<insert-subscriber-id>', {
740
+ 'limit' => 15, # optional
741
+ 'seen' => false, # optional
742
+ })
743
+ ```
744
+
745
+ - Mark a subscriber feed message as seen: `mark_subscriber_feed_seen(subscriber_id, body)`
746
+
747
+ ```ruby
748
+ client.mark_subscriber_feed_seen('<insert-subscriber-id>', {
749
+ 'messageId' => '<insert-message-id>',
750
+ 'mark' => {
751
+ 'seen' => true,
752
+ 'read' => true
753
+ }
754
+ })
755
+ ```
756
+
757
+ - Mark message action as seen: `mark_message_action_seen(subscriber_id, message_id, type)`
758
+
759
+ ```ruby
760
+ client.mark_message_action_seen('<insert-subscriber-id>', '<insert-message-id>', '<insert-type>')
761
+ ```
762
+
763
+ - Marks all the subscriber messages: `mark_all_subscriber_messages(subscriber_id, body)`
764
+
765
+ ```ruby
766
+ body = {
767
+ 'markAs' => 'seen'
768
+ }
769
+ client.mark_all_subscriber_messages('<insert-subscriber-id>', body)
770
+ ```
771
+
772
+ - Handle providers OAUTH redirect: `provider_oauth_redirect(subscriber_id, provider_id, query)`
773
+ ```ruby
774
+ query = {
775
+ 'environmentId' => '<insert-environment-id>',
776
+ 'code' => '<insert-code>',
777
+ 'hmacHash' => '<insert-hmacHash>',
778
+ 'integrationIdentifier' => '<insert-integration-identifier>'
779
+ }
780
+ client.provider_oauth_redirect('<insert-subscriber-id>', '<insert-provider-id>', query)
781
+ ```
782
+
783
+ - Handle chat OAUTH: `chat_oauth(subscriber_id, provider_id, query)`
784
+ ```ruby
785
+ query = {
786
+ 'environmentId' => '<insert-environment-id>',
787
+ 'hmacHash' => '<insert-hmacHash>',
788
+ 'integrationIdentifier' => '<insert-integration-identifier>'
789
+ }
790
+ client.chat_oauth('<insert-subscriber-id>', '<insert-provider-id>', query)
791
+ ```
792
+
793
+ ### Tenants
794
+
795
+ - Tenant create: `create_tenant(body)`
796
+
797
+ ```ruby
798
+ client.create_tenant({
799
+ 'identifier' => '<a-unique-identifier>',
800
+ 'name' => '<name-of-the-tenant>',
801
+ 'data' => {
802
+ 'company' => 'a company',
803
+ 'date-registered' => '2023-0-15'
804
+ }
805
+ })
806
+ ```
807
+
808
+ - Get tenants: `tenants(query = {})`
809
+
810
+ ```ruby
811
+ client.tenants({
812
+ 'page' => 1, # optional
813
+ 'limit' => 10, # optional
814
+ })
815
+ ```
816
+
817
+ - Get tenant: `tenant(identifier)`
818
+
819
+ ```ruby
820
+ client.tenant('<a-unique-identifier>')
821
+ ```
822
+
823
+ - Update tenant: `update_tenant(identifier, body)`
824
+
825
+ ```ruby
826
+ client.update_tenant('<a-unique-identifier>', {
827
+ 'identifier' => '<a-unique-identifier>',
828
+ 'name' => '<name-of-the-tenant>',
829
+ })
830
+ ```
831
+
832
+ - Delete tenant: `delete_tenant(identifier)`
833
+
834
+ ```ruby
835
+ client.delete_tenant('<a-unique-identifier>')
836
+ ```
142
837
 
143
838
  ### Topics
144
839
 
145
- - `create_topic(body)`
146
- - `topics(query = {})`
147
- - `add_subscribers(topic_key, body)`
840
+ - Topic creation: `create_topic(body)`
841
+
842
+ ```ruby
843
+ client.create_topic({
844
+ 'key' => 'key',
845
+ 'name' => 'name'
846
+ })
847
+ ```
848
+
849
+ - Filter topics: `topics(query = {})`
850
+
851
+ ```ruby
852
+ client.topics({
853
+ 'name' => 'name', # optional
854
+ 'page' => 1, # optional
855
+ 'pageSize' => 10, # optional
856
+ })
857
+ ```
858
+
859
+ - Subscribers addition: `add_subscribers(topic_key, body)`
860
+
861
+ ```ruby
862
+ client.add_subscribers('<insert-topic-key>', {
863
+ 'subscribers' => ['<insert-list-of-subscribers>']
864
+ })
865
+ ```
866
+
148
867
  - `remove_subscribers(topic_key, body)`
149
- - `topic(topic_key)`
150
- - `rename_topic(topic_key, body)`
151
868
 
152
- ### For more information about these methods and their parameters, see the [API documentation](https://docs.novu.co/api/overview).
869
+ ```ruby
870
+ client.
871
+ ```
872
+
873
+ - Get topic: `topic(topic_key)`
874
+
875
+ ```ruby
876
+ client.topic('<insert-topic-key>')
877
+ ```
878
+
879
+ - Rename a topic: `rename_topic(topic_key, body)`
880
+
881
+ ```ruby
882
+ client.rename_topic('<insert-topic-key>', {
883
+ 'name' => 'new name'
884
+ })
885
+ ```
886
+
887
+ - Delete topic: `delete_topic(topic_key)`
888
+
889
+ ```ruby
890
+ client.delete_topic('<insert-topic-key>')
891
+ ```
892
+
893
+ - Check topic subsriber: `subscriber_topic(topic_key, externalSubscriberId)`
894
+
895
+ ```ruby
896
+ client.subscriber_topic('<insert-topic-key>', '<insert-externalSubscriberId>')
897
+ ```
898
+
899
+ ### Idempotent Request
900
+
901
+ This SDK allows you to perform idempotent requests, that is safely retrying requests without accidentally performing the same operation twice.
902
+ To achieve this, provide an `idempotency_key` argument during initialization of the NOVU client. We strongly recommend that you use [UUID](https://datatracker.ietf.org/doc/html/rfc4122) format when you're generating your idempotency key.
903
+
904
+ ```ruby
905
+ client = Novu::Client.new(
906
+ access_token: '<your-novu-api_key>',
907
+ idempotency_key: '<your-idempotency-key>'
908
+ )
909
+ ```
910
+
911
+ ### Exponential Retry Mechanism
912
+
913
+ You can configure this SDK to retry failed requests. This is done by using [Exponential backoff strategy](https://en.wikipedia.org/wiki/Exponential_backoff). It is a common algorithm for retrying requests. The retries gradually extend the waiting time until reaching a specific limit. The concept is to prevent overloading the server with simultaneous requests once it is back online, especially in cases of temporary downtime.
914
+
915
+ ```ruby
916
+ client = Novu::Client.new(
917
+ access_token: '<your-novu-api_key>',
918
+ idempotency_key: '<your-idempotency-key>',
919
+ enable_retry: true, # it is disabled by default,
920
+ retry_config: {
921
+ max_retries: 3,
922
+ initial_delay: 4,
923
+ max_delay: 60
924
+ }
925
+ )
926
+ ```
927
+
928
+ ## The retry configuration is explained in the following table:
929
+ | Options | Detail | Default Value | Data Type |
930
+ | ------------- | -------------------------------------------------------------------| --------------- | --------- |
931
+ | max_retries | Specifies total number of retries to perform in case of failure | 1 | Integer |
932
+ | initial_delay | Specifies the minimum time to wait before retrying (in seconds) | 4 | Integer |
933
+ | max_delay | Specifies the maximum time to wait before retrying (in seconds) | 60 | Integer |
934
+ | enable_retry | enabling/disable the Exponential Retry mechanism | false | Boolean |
935
+
936
+
937
+ ### For more information about these methods and their parameters, see the [API documentation](https://docs.novu.co/api-reference).
153
938
 
154
939
  ## Contributing
155
940
 
156
- Bug reports and pull requests are welcome on GitHub at https://
941
+ Bug reports and pull requests are welcome [here.](https://github.com/novuhq/novu-ruby)
942
+
943
+ ## Support and Feedback
944
+
945
+ Be sure to visit the Novu official [documentation website](https://docs.novu.co/docs) for additional information about our API.
946
+ If you need additional assistance, join our Discord server [here](https://discord.novu.co).
947
+
948
+ ## License
949
+
950
+ Novu Ruby SDK is licensed under the MIT License - see the [LICENSE](https://github.com/novuhq/novu-ruby/blob/main/LICENSE.txt) file for details.