trycourier 4.21.0 → 4.23.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 (231) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/lib/courier/client.rb +43 -0
  4. data/lib/courier/models/automations/invoke_invoke_ad_hoc_params.rb +13 -1
  5. data/lib/courier/models/automations/invoke_invoke_by_template_params.rb +13 -1
  6. data/lib/courier/models/brand_create_params.rb +13 -1
  7. data/lib/courier/models/broadcast.rb +132 -0
  8. data/lib/courier/models/broadcast_archive_params.rb +20 -0
  9. data/lib/courier/models/broadcast_cancel_params.rb +20 -0
  10. data/lib/courier/models/broadcast_create_params.rb +14 -0
  11. data/lib/courier/models/broadcast_duplicate_params.rb +20 -0
  12. data/lib/courier/models/broadcast_list_params.rb +30 -0
  13. data/lib/courier/models/broadcast_list_response.rb +24 -0
  14. data/lib/courier/models/broadcast_put_content_params.rb +20 -0
  15. data/lib/courier/models/broadcast_retrieve_content_params.rb +33 -0
  16. data/lib/courier/models/broadcast_retrieve_params.rb +20 -0
  17. data/lib/courier/models/broadcast_schedule.rb +59 -0
  18. data/lib/courier/models/broadcast_schedule_params.rb +20 -0
  19. data/lib/courier/models/broadcast_send_params.rb +20 -0
  20. data/lib/courier/models/broadcast_update_params.rb +20 -0
  21. data/lib/courier/models/create_broadcast_request.rb +43 -0
  22. data/lib/courier/models/inbox/message_delete_params.rb +22 -0
  23. data/lib/courier/models/inbox/message_restore_params.rb +22 -0
  24. data/lib/courier/models/journey_cancel_params.rb +13 -1
  25. data/lib/courier/models/journey_create_params.rb +13 -1
  26. data/lib/courier/models/journey_invoke_params.rb +13 -1
  27. data/lib/courier/models/journey_publish_params.rb +13 -1
  28. data/lib/courier/models/journeys/template_create_params.rb +13 -1
  29. data/lib/courier/models/journeys/template_publish_params.rb +13 -1
  30. data/lib/courier/models/lists/subscription_add_params.rb +13 -1
  31. data/lib/courier/models/notification_create_params.rb +13 -1
  32. data/lib/courier/models/notification_publish_params.rb +13 -1
  33. data/lib/courier/models/profile_create_params.rb +13 -1
  34. data/lib/courier/models/profiles/list_subscribe_params.rb +13 -1
  35. data/lib/courier/models/provider_create_params.rb +15 -1
  36. data/lib/courier/models/routing_strategy_create_params.rb +13 -1
  37. data/lib/courier/models/schedule_broadcast_request.rb +59 -0
  38. data/lib/courier/models/send_broadcast_request.rb +39 -0
  39. data/lib/courier/models/send_message_params.rb +15 -1
  40. data/lib/courier/models/update_broadcast_request.rb +18 -0
  41. data/lib/courier/models/users/preference_bulk_update_params.rb +15 -1
  42. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +14 -4
  43. data/lib/courier/models/users/topic_preference.rb +21 -7
  44. data/lib/courier/models/workspace_preference_create_params.rb +13 -1
  45. data/lib/courier/models/workspace_preference_publish_params.rb +13 -1
  46. data/lib/courier/models/workspace_preferences/topic_create_params.rb +13 -1
  47. data/lib/courier/models.rb +38 -0
  48. data/lib/courier/resources/audiences.rb +12 -5
  49. data/lib/courier/resources/audit_events.rb +5 -2
  50. data/lib/courier/resources/auth.rb +5 -1
  51. data/lib/courier/resources/automations/invoke.rb +47 -23
  52. data/lib/courier/resources/automations.rb +6 -1
  53. data/lib/courier/resources/brands.rb +38 -12
  54. data/lib/courier/resources/broadcasts.rb +290 -0
  55. data/lib/courier/resources/digests/schedules.rb +4 -3
  56. data/lib/courier/resources/digests.rb +2 -0
  57. data/lib/courier/resources/inbound.rb +3 -1
  58. data/lib/courier/resources/inbox/messages.rb +58 -0
  59. data/lib/courier/resources/inbox.rb +19 -0
  60. data/lib/courier/resources/journeys/templates.rb +43 -25
  61. data/lib/courier/resources/journeys.rb +73 -44
  62. data/lib/courier/resources/lists/subscriptions.rb +22 -8
  63. data/lib/courier/resources/lists.rb +14 -5
  64. data/lib/courier/resources/messages.rb +14 -14
  65. data/lib/courier/resources/notifications/checks.rb +8 -3
  66. data/lib/courier/resources/notifications.rb +48 -30
  67. data/lib/courier/resources/profiles/lists.rb +19 -8
  68. data/lib/courier/resources/profiles.rb +25 -14
  69. data/lib/courier/resources/providers/catalog.rb +4 -4
  70. data/lib/courier/resources/providers.rb +27 -18
  71. data/lib/courier/resources/requests.rb +4 -1
  72. data/lib/courier/resources/routing_strategies.rb +24 -12
  73. data/lib/courier/resources/send.rb +14 -4
  74. data/lib/courier/resources/tenants/preferences/items.rb +6 -2
  75. data/lib/courier/resources/tenants/preferences.rb +2 -0
  76. data/lib/courier/resources/tenants/templates/versions.rb +4 -7
  77. data/lib/courier/resources/tenants/templates.rb +14 -19
  78. data/lib/courier/resources/tenants.rb +14 -5
  79. data/lib/courier/resources/translations.rb +6 -2
  80. data/lib/courier/resources/users/preferences.rb +23 -42
  81. data/lib/courier/resources/users/tenants.rb +12 -10
  82. data/lib/courier/resources/users/tokens.rb +14 -6
  83. data/lib/courier/resources/users.rb +6 -0
  84. data/lib/courier/resources/workspace_preferences/topics.rb +27 -19
  85. data/lib/courier/resources/workspace_preferences.rb +40 -20
  86. data/lib/courier/version.rb +1 -1
  87. data/lib/courier.rb +24 -1
  88. data/rbi/courier/client.rbi +41 -0
  89. data/rbi/courier/models/automations/invoke_invoke_ad_hoc_params.rbi +18 -0
  90. data/rbi/courier/models/automations/invoke_invoke_by_template_params.rbi +18 -0
  91. data/rbi/courier/models/brand_create_params.rbi +18 -0
  92. data/rbi/courier/models/broadcast.rbi +164 -0
  93. data/rbi/courier/models/broadcast_archive_params.rbi +35 -0
  94. data/rbi/courier/models/broadcast_cancel_params.rbi +35 -0
  95. data/rbi/courier/models/broadcast_create_params.rbi +27 -0
  96. data/rbi/courier/models/broadcast_duplicate_params.rbi +35 -0
  97. data/rbi/courier/models/broadcast_list_params.rbi +54 -0
  98. data/rbi/courier/models/broadcast_list_response.rbi +39 -0
  99. data/rbi/courier/models/broadcast_put_content_params.rbi +35 -0
  100. data/rbi/courier/models/broadcast_retrieve_content_params.rbi +57 -0
  101. data/rbi/courier/models/broadcast_retrieve_params.rbi +35 -0
  102. data/rbi/courier/models/broadcast_schedule.rbi +92 -0
  103. data/rbi/courier/models/broadcast_schedule_params.rbi +35 -0
  104. data/rbi/courier/models/broadcast_send_params.rbi +35 -0
  105. data/rbi/courier/models/broadcast_update_params.rbi +35 -0
  106. data/rbi/courier/models/create_broadcast_request.rbi +81 -0
  107. data/rbi/courier/models/inbox/message_delete_params.rbi +40 -0
  108. data/rbi/courier/models/inbox/message_restore_params.rbi +40 -0
  109. data/rbi/courier/models/journey_cancel_params.rbi +31 -5
  110. data/rbi/courier/models/journey_create_params.rbi +31 -5
  111. data/rbi/courier/models/journey_invoke_params.rbi +26 -2
  112. data/rbi/courier/models/journey_publish_params.rbi +26 -2
  113. data/rbi/courier/models/journeys/template_create_params.rbi +26 -2
  114. data/rbi/courier/models/journeys/template_publish_params.rbi +23 -1
  115. data/rbi/courier/models/lists/subscription_add_params.rbi +23 -1
  116. data/rbi/courier/models/notification_create_params.rbi +31 -5
  117. data/rbi/courier/models/notification_publish_params.rbi +26 -2
  118. data/rbi/courier/models/profile_create_params.rbi +23 -1
  119. data/rbi/courier/models/profiles/list_subscribe_params.rbi +23 -1
  120. data/rbi/courier/models/provider_create_params.rbi +18 -0
  121. data/rbi/courier/models/routing_strategy_create_params.rbi +31 -5
  122. data/rbi/courier/models/schedule_broadcast_request.rbi +103 -0
  123. data/rbi/courier/models/send_broadcast_request.rbi +77 -0
  124. data/rbi/courier/models/send_message_params.rbi +18 -0
  125. data/rbi/courier/models/update_broadcast_request.rbi +28 -0
  126. data/rbi/courier/models/users/preference_bulk_update_params.rbi +18 -0
  127. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +14 -2
  128. data/rbi/courier/models/users/topic_preference.rbi +24 -2
  129. data/rbi/courier/models/workspace_preference_create_params.rbi +31 -5
  130. data/rbi/courier/models/workspace_preference_publish_params.rbi +31 -5
  131. data/rbi/courier/models/workspace_preferences/topic_create_params.rbi +26 -2
  132. data/rbi/courier/models.rbi +39 -0
  133. data/rbi/courier/resources/audiences.rbi +12 -5
  134. data/rbi/courier/resources/audit_events.rbi +5 -2
  135. data/rbi/courier/resources/auth.rbi +5 -1
  136. data/rbi/courier/resources/automations/invoke.rbi +48 -7
  137. data/rbi/courier/resources/automations.rbi +6 -1
  138. data/rbi/courier/resources/brands.rbi +37 -7
  139. data/rbi/courier/resources/broadcasts.rbi +199 -0
  140. data/rbi/courier/resources/digests/schedules.rbi +4 -3
  141. data/rbi/courier/resources/digests.rbi +2 -0
  142. data/rbi/courier/resources/inbound.rbi +3 -1
  143. data/rbi/courier/resources/inbox/messages.rbi +44 -0
  144. data/rbi/courier/resources/inbox.rbi +16 -0
  145. data/rbi/courier/resources/journeys/templates.rbi +47 -17
  146. data/rbi/courier/resources/journeys.rbi +93 -39
  147. data/rbi/courier/resources/lists/subscriptions.rbi +24 -5
  148. data/rbi/courier/resources/lists.rbi +14 -5
  149. data/rbi/courier/resources/messages.rbi +14 -14
  150. data/rbi/courier/resources/notifications/checks.rbi +8 -3
  151. data/rbi/courier/resources/notifications.rbi +58 -28
  152. data/rbi/courier/resources/profiles/lists.rbi +25 -6
  153. data/rbi/courier/resources/profiles.rbi +31 -11
  154. data/rbi/courier/resources/providers/catalog.rbi +4 -4
  155. data/rbi/courier/resources/providers.rbi +35 -19
  156. data/rbi/courier/resources/requests.rbi +4 -1
  157. data/rbi/courier/resources/routing_strategies.rbi +26 -10
  158. data/rbi/courier/resources/send.rbi +20 -3
  159. data/rbi/courier/resources/tenants/preferences/items.rbi +6 -2
  160. data/rbi/courier/resources/tenants/preferences.rbi +2 -0
  161. data/rbi/courier/resources/tenants/templates/versions.rbi +4 -7
  162. data/rbi/courier/resources/tenants/templates.rbi +14 -19
  163. data/rbi/courier/resources/tenants.rbi +14 -5
  164. data/rbi/courier/resources/translations.rbi +6 -2
  165. data/rbi/courier/resources/users/preferences.rbi +28 -40
  166. data/rbi/courier/resources/users/tenants.rbi +12 -10
  167. data/rbi/courier/resources/users/tokens.rbi +14 -6
  168. data/rbi/courier/resources/users.rbi +6 -0
  169. data/rbi/courier/resources/workspace_preferences/topics.rbi +37 -18
  170. data/rbi/courier/resources/workspace_preferences.rbi +51 -17
  171. data/sig/courier/client.rbs +4 -0
  172. data/sig/courier/models/automations/invoke_invoke_ad_hoc_params.rbs +15 -1
  173. data/sig/courier/models/automations/invoke_invoke_by_template_params.rbs +15 -1
  174. data/sig/courier/models/brand_create_params.rbs +15 -1
  175. data/sig/courier/models/broadcast.rbs +98 -0
  176. data/sig/courier/models/broadcast_archive_params.rbs +23 -0
  177. data/sig/courier/models/broadcast_cancel_params.rbs +23 -0
  178. data/sig/courier/models/broadcast_create_params.rbs +15 -0
  179. data/sig/courier/models/broadcast_duplicate_params.rbs +23 -0
  180. data/sig/courier/models/broadcast_list_params.rbs +30 -0
  181. data/sig/courier/models/broadcast_list_response.rbs +22 -0
  182. data/sig/courier/models/broadcast_put_content_params.rbs +25 -0
  183. data/sig/courier/models/broadcast_retrieve_content_params.rbs +30 -0
  184. data/sig/courier/models/broadcast_retrieve_params.rbs +23 -0
  185. data/sig/courier/models/broadcast_schedule.rbs +46 -0
  186. data/sig/courier/models/broadcast_schedule_params.rbs +25 -0
  187. data/sig/courier/models/broadcast_send_params.rbs +25 -0
  188. data/sig/courier/models/broadcast_update_params.rbs +25 -0
  189. data/sig/courier/models/create_broadcast_request.rbs +40 -0
  190. data/sig/courier/models/inbox/message_delete_params.rbs +25 -0
  191. data/sig/courier/models/inbox/message_restore_params.rbs +25 -0
  192. data/sig/courier/models/journey_cancel_params.rbs +20 -3
  193. data/sig/courier/models/journey_create_params.rbs +20 -3
  194. data/sig/courier/models/journey_invoke_params.rbs +18 -1
  195. data/sig/courier/models/journey_publish_params.rbs +18 -1
  196. data/sig/courier/models/journeys/template_create_params.rbs +18 -1
  197. data/sig/courier/models/journeys/template_publish_params.rbs +18 -1
  198. data/sig/courier/models/lists/subscription_add_params.rbs +15 -1
  199. data/sig/courier/models/notification_create_params.rbs +20 -3
  200. data/sig/courier/models/notification_publish_params.rbs +18 -2
  201. data/sig/courier/models/profile_create_params.rbs +18 -1
  202. data/sig/courier/models/profiles/list_subscribe_params.rbs +15 -1
  203. data/sig/courier/models/provider_create_params.rbs +15 -1
  204. data/sig/courier/models/routing_strategy_create_params.rbs +20 -3
  205. data/sig/courier/models/schedule_broadcast_request.rbs +48 -0
  206. data/sig/courier/models/send_broadcast_request.rbs +36 -0
  207. data/sig/courier/models/send_message_params.rbs +17 -1
  208. data/sig/courier/models/update_broadcast_request.rbs +13 -0
  209. data/sig/courier/models/users/preference_bulk_update_params.rbs +15 -1
  210. data/sig/courier/models/workspace_preference_create_params.rbs +20 -3
  211. data/sig/courier/models/workspace_preference_publish_params.rbs +20 -3
  212. data/sig/courier/models/workspace_preferences/topic_create_params.rbs +18 -1
  213. data/sig/courier/models.rbs +38 -0
  214. data/sig/courier/resources/automations/invoke.rbs +4 -0
  215. data/sig/courier/resources/brands.rbs +2 -0
  216. data/sig/courier/resources/broadcasts.rbs +74 -0
  217. data/sig/courier/resources/inbox/messages.rbs +19 -0
  218. data/sig/courier/resources/inbox.rbs +9 -0
  219. data/sig/courier/resources/journeys/templates.rbs +4 -0
  220. data/sig/courier/resources/journeys.rbs +8 -0
  221. data/sig/courier/resources/lists/subscriptions.rbs +2 -0
  222. data/sig/courier/resources/notifications.rbs +4 -0
  223. data/sig/courier/resources/profiles/lists.rbs +2 -0
  224. data/sig/courier/resources/profiles.rbs +2 -0
  225. data/sig/courier/resources/providers.rbs +2 -0
  226. data/sig/courier/resources/routing_strategies.rbs +2 -0
  227. data/sig/courier/resources/send.rbs +2 -0
  228. data/sig/courier/resources/users/preferences.rbs +2 -0
  229. data/sig/courier/resources/workspace_preferences/topics.rbs +2 -0
  230. data/sig/courier/resources/workspace_preferences.rbs +4 -0
  231. metadata +71 -2
@@ -0,0 +1,199 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Resources
5
+ class Broadcasts
6
+ # Create a broadcast. Provisions a private notification template for the broadcast
7
+ # and returns the new broadcast in the draft state. Exactly one channel is
8
+ # required.
9
+ sig do
10
+ params(
11
+ channel: Courier::CreateBroadcastRequest::Channel::OrSymbol,
12
+ name: String,
13
+ request_options: Courier::RequestOptions::OrHash
14
+ ).returns(Courier::Broadcast)
15
+ end
16
+ def create(
17
+ # The single delivery channel for this broadcast.
18
+ channel:,
19
+ # Human-readable name.
20
+ name:,
21
+ request_options: {}
22
+ )
23
+ end
24
+
25
+ # Retrieve a broadcast by ID. Archived broadcasts return 404.
26
+ sig do
27
+ params(
28
+ broadcast_id: String,
29
+ request_options: Courier::RequestOptions::OrHash
30
+ ).returns(Courier::Broadcast)
31
+ end
32
+ def retrieve(broadcast_id, request_options: {})
33
+ end
34
+
35
+ # Update a broadcast's name. Content is edited via the broadcast's notification
36
+ # template, not this endpoint.
37
+ sig do
38
+ params(
39
+ broadcast_id: String,
40
+ name: String,
41
+ request_options: Courier::RequestOptions::OrHash
42
+ ).returns(Courier::Broadcast)
43
+ end
44
+ def update(
45
+ broadcast_id,
46
+ # New human-readable name.
47
+ name:,
48
+ request_options: {}
49
+ )
50
+ end
51
+
52
+ # List broadcasts in your workspace. Cursor-paginated; returns broadcasts
53
+ # newest-first.
54
+ sig do
55
+ params(
56
+ cursor: T.nilable(String),
57
+ limit: Integer,
58
+ request_options: Courier::RequestOptions::OrHash
59
+ ).returns(Courier::BroadcastListResponse)
60
+ end
61
+ def list(
62
+ # Opaque pagination cursor from a previous response. Omit for the first page.
63
+ cursor: nil,
64
+ # Maximum number of results per page.
65
+ limit: nil,
66
+ request_options: {}
67
+ )
68
+ end
69
+
70
+ # Archive a broadcast. This is a soft delete — the archived broadcast is returned
71
+ # and no longer appears in list results.
72
+ sig do
73
+ params(
74
+ broadcast_id: String,
75
+ request_options: Courier::RequestOptions::OrHash
76
+ ).returns(Courier::Broadcast)
77
+ end
78
+ def archive(broadcast_id, request_options: {})
79
+ end
80
+
81
+ # Cancel a broadcast's pending schedule, returning it to the draft state. Only
82
+ # valid for a scheduled broadcast.
83
+ sig do
84
+ params(
85
+ broadcast_id: String,
86
+ request_options: Courier::RequestOptions::OrHash
87
+ ).returns(Courier::Broadcast)
88
+ end
89
+ def cancel(broadcast_id, request_options: {})
90
+ end
91
+
92
+ # Duplicate a broadcast (and its template) into a new draft named "{source name}
93
+ # (copy)".
94
+ sig do
95
+ params(
96
+ broadcast_id: String,
97
+ request_options: Courier::RequestOptions::OrHash
98
+ ).returns(Courier::Broadcast)
99
+ end
100
+ def duplicate(broadcast_id, request_options: {})
101
+ end
102
+
103
+ # Author the broadcast's content by replacing the draft elemental content of its
104
+ # private notification template. The draft is published automatically when the
105
+ # broadcast is sent or scheduled.
106
+ sig do
107
+ params(
108
+ broadcast_id: String,
109
+ content: Courier::NotificationContentPutRequest::Content::OrHash,
110
+ state: Courier::NotificationTemplateState::OrSymbol,
111
+ request_options: Courier::RequestOptions::OrHash
112
+ ).returns(Courier::NotificationContentMutationResponse)
113
+ end
114
+ def put_content(
115
+ broadcast_id,
116
+ # Elemental content payload. The server defaults `version` when omitted.
117
+ content:,
118
+ # Template state. Defaults to `DRAFT`.
119
+ state: nil,
120
+ request_options: {}
121
+ )
122
+ end
123
+
124
+ # Retrieve the broadcast's content — the elemental content of its private
125
+ # notification template. Defaults to the working draft, since broadcast content is
126
+ # authored as a draft until the broadcast is sent.
127
+ sig do
128
+ params(
129
+ broadcast_id: String,
130
+ version: String,
131
+ request_options: Courier::RequestOptions::OrHash
132
+ ).returns(Courier::NotificationContentGetResponse)
133
+ end
134
+ def retrieve_content(
135
+ broadcast_id,
136
+ # Accepts `draft`, `published`, or a version string (e.g. `v001`). Defaults to
137
+ # `draft`.
138
+ version: nil,
139
+ request_options: {}
140
+ )
141
+ end
142
+
143
+ # Schedule a broadcast for a future send to a list or audience. Publishes the
144
+ # broadcast template first. Not allowed once the broadcast is sending or sent. For
145
+ # an immediate send use POST /broadcasts/{broadcastId}/send.
146
+ sig do
147
+ params(
148
+ broadcast_id: String,
149
+ recipient_id: String,
150
+ recipient_type:
151
+ Courier::ScheduleBroadcastRequest::RecipientType::OrSymbol,
152
+ scheduled_to: String,
153
+ timezone: String,
154
+ request_options: Courier::RequestOptions::OrHash
155
+ ).returns(Courier::Broadcast)
156
+ end
157
+ def schedule(
158
+ broadcast_id,
159
+ # ID of the target list or audience.
160
+ recipient_id:,
161
+ # Whether the broadcast targets a list or an audience.
162
+ recipient_type:,
163
+ # Wall-clock timestamp of the future send, no timezone offset (e.g.
164
+ # "2026-07-21T20:00:00"). The zone is given by `timezone`.
165
+ scheduled_to:,
166
+ # IANA timezone for the scheduled send (e.g. America/New_York).
167
+ timezone: nil,
168
+ request_options: {}
169
+ )
170
+ end
171
+
172
+ # Send a broadcast immediately to a list or audience. Publishes the broadcast
173
+ # template first. Not allowed once the broadcast is sending or sent.
174
+ sig do
175
+ params(
176
+ broadcast_id: String,
177
+ recipient_id: String,
178
+ recipient_type:
179
+ Courier::SendBroadcastRequest::RecipientType::OrSymbol,
180
+ request_options: Courier::RequestOptions::OrHash
181
+ ).returns(Courier::Broadcast)
182
+ end
183
+ def send_(
184
+ broadcast_id,
185
+ # ID of the target list or audience.
186
+ recipient_id:,
187
+ # Whether the broadcast targets a list or an audience.
188
+ recipient_type:,
189
+ request_options: {}
190
+ )
191
+ end
192
+
193
+ # @api private
194
+ sig { params(client: Courier::Client).returns(T.attached_class) }
195
+ def self.new(client:)
196
+ end
197
+ end
198
+ end
199
+ end
@@ -3,10 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Digests
6
+ # Inspect what has accumulated in a digest schedule and release a digest ahead of
7
+ # its next scheduled delivery.
6
8
  class Schedules
7
- # List the digest instances for a schedule. Each instance represents the events
8
- # accumulated for a single user against the schedule, and can be used to monitor
9
- # digest accumulation before the digest is released.
9
+ # Returns the digest instances for a schedule, one per user, with cursor paging.
10
+ # Use it to see what has accumulated before a digest releases.
10
11
  sig do
11
12
  params(
12
13
  schedule_id: String,
@@ -3,6 +3,8 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Digests
6
+ # Inspect what has accumulated in a digest schedule and release a digest ahead of
7
+ # its next scheduled delivery.
6
8
  sig { returns(Courier::Resources::Digests::Schedules) }
7
9
  attr_reader :schedules
8
10
 
@@ -2,8 +2,10 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Record an inbound event that triggers the journeys and automations mapped to it.
5
6
  class Inbound
6
- # Courier Track Event
7
+ # Records an inbound event that can trigger a journey. Requires an event name, a
8
+ # messageId you generate, a type, and a properties object.
7
9
  sig do
8
10
  params(
9
11
  event: String,
@@ -0,0 +1,44 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Resources
5
+ class Inbox
6
+ # Manage the messages in a user's in-app inbox.
7
+ class Messages
8
+ # Delete a user's inbox message. The message is removed from every inbox read (it
9
+ # stops appearing in the recipient's Inbox); it can be restored.
10
+ sig do
11
+ params(
12
+ message_id: String,
13
+ request_options: Courier::RequestOptions::OrHash
14
+ ).void
15
+ end
16
+ def delete(
17
+ # The message ID of the inbox message to delete.
18
+ message_id,
19
+ request_options: {}
20
+ )
21
+ end
22
+
23
+ # Restore a previously deleted inbox message.
24
+ sig do
25
+ params(
26
+ message_id: String,
27
+ request_options: Courier::RequestOptions::OrHash
28
+ ).void
29
+ end
30
+ def restore(
31
+ # The message ID of the inbox message to restore.
32
+ message_id,
33
+ request_options: {}
34
+ )
35
+ end
36
+
37
+ # @api private
38
+ sig { params(client: Courier::Client).returns(T.attached_class) }
39
+ def self.new(client:)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,16 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Resources
5
+ class Inbox
6
+ # Manage the messages in a user's in-app inbox.
7
+ sig { returns(Courier::Resources::Inbox::Messages) }
8
+ attr_reader :messages
9
+
10
+ # @api private
11
+ sig { params(client: Courier::Client).returns(T.attached_class) }
12
+ def self.new(client:)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -3,6 +3,8 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Journeys
6
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
7
+ # along with the templates scoped to them.
6
8
  class Templates
7
9
  # Create a notification template scoped to this journey. Defaults to `DRAFT`
8
10
  # state; pass `state: "PUBLISHED"` to publish on create.
@@ -14,23 +16,40 @@ module Courier
14
16
  Courier::JourneyTemplateCreateRequest::Notification::OrHash,
15
17
  provider_key: String,
16
18
  state: String,
19
+ idempotency_key: String,
20
+ x_idempotency_expiration: String,
17
21
  request_options: Courier::RequestOptions::OrHash
18
22
  ).returns(Courier::JourneyTemplateGetResponse)
19
23
  end
20
24
  def create(
21
- # Journey id
25
+ # Path param: Journey id
22
26
  template_id,
27
+ # Body param
23
28
  channel:,
29
+ # Body param
24
30
  notification:,
31
+ # Body param
25
32
  provider_key: nil,
33
+ # Body param
26
34
  state: nil,
35
+ # Header param: A unique key that makes this request idempotent. If Courier
36
+ # receives another request with the same `Idempotency-Key`, it returns the stored
37
+ # response from the first request without performing the operation again
38
+ # (including the original status code and any error). Use it to safely retry
39
+ # `POST` requests after network failures without risking duplicate sends. The key
40
+ # is scoped to this endpoint.
41
+ idempotency_key: nil,
42
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
43
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
44
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
45
+ # maximum is 1 year.
46
+ x_idempotency_expiration: nil,
27
47
  request_options: {}
28
48
  )
29
49
  end
30
50
 
31
- # Fetch a journey-scoped notification template by id. Pass `?version=draft`
32
- # (default `published`) to retrieve the working draft, or `?version=vN` for a
33
- # historical version.
51
+ # Returns a journey's own notification template with its name, brand, subscription
52
+ # topic, and content. Defaults to the published version.
34
53
  sig do
35
54
  params(
36
55
  notification_id: String,
@@ -68,8 +87,8 @@ module Courier
68
87
  )
69
88
  end
70
89
 
71
- # Archive the journey-scoped notification template. Archived templates cannot be
72
- # sent.
90
+ # Archives one journey's notification template, preventing further sends. Detach
91
+ # any send node referencing it beforehand.
73
92
  sig do
74
93
  params(
75
94
  notification_id: String,
@@ -86,8 +105,8 @@ module Courier
86
105
  )
87
106
  end
88
107
 
89
- # List published versions of the journey-scoped notification template, ordered
90
- # most recent first.
108
+ # Lists the published versions of a template that belongs to a journey, most
109
+ # recent first. Paged by cursor.
91
110
  sig do
92
111
  params(
93
112
  notification_id: String,
@@ -104,14 +123,15 @@ module Courier
104
123
  )
105
124
  end
106
125
 
107
- # Publish the current draft of the journey-scoped notification template as a new
108
- # version. Optionally roll back to a prior version by passing
109
- # `{ "version": "vN" }`.
126
+ # Publishes a journey-scoped template's draft as a new version. Pass a version
127
+ # instead to roll back the template to an earlier publish.
110
128
  sig do
111
129
  params(
112
130
  notification_id: String,
113
131
  template_id: String,
114
132
  version: String,
133
+ idempotency_key: String,
134
+ x_idempotency_expiration: String,
115
135
  request_options: Courier::RequestOptions::OrHash
116
136
  ).void
117
137
  end
@@ -122,6 +142,18 @@ module Courier
122
142
  template_id:,
123
143
  # Body param
124
144
  version: nil,
145
+ # Header param: A unique key that makes this request idempotent. If Courier
146
+ # receives another request with the same `Idempotency-Key`, it returns the stored
147
+ # response from the first request without performing the operation again
148
+ # (including the original status code and any error). Use it to safely retry
149
+ # `POST` requests after network failures without risking duplicate sends. The key
150
+ # is scoped to this endpoint.
151
+ idempotency_key: nil,
152
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
153
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
154
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
155
+ # maximum is 1 year.
156
+ x_idempotency_expiration: nil,
125
157
  request_options: {}
126
158
  )
127
159
  end
@@ -179,7 +211,8 @@ module Courier
179
211
  )
180
212
  end
181
213
 
182
- # Replace the journey-scoped notification template draft.
214
+ # Replaces the draft content of one journey's notification template. Publish it
215
+ # before send nodes referencing it render the change.
183
216
  sig do
184
217
  params(
185
218
  notification_id: String,
@@ -203,11 +236,8 @@ module Courier
203
236
  )
204
237
  end
205
238
 
206
- # Retrieve the elemental content of a journey-scoped notification template. The
207
- # response contains the versioned elements along with their content checksums,
208
- # which can be used to detect changes between versions. Pass `?version=draft`
209
- # (default `published`) to retrieve the working draft, or `?version=vN` for a
210
- # historical version.
239
+ # Returns the Elemental elements and version of a journey-scoped template's
240
+ # content. Compare versions to see what changed between publishes.
211
241
  sig do
212
242
  params(
213
243
  notification_id: String,
@@ -2,16 +2,16 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
6
+ # along with the templates scoped to them.
5
7
  class Journeys
8
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
9
+ # along with the templates scoped to them.
6
10
  sig { returns(Courier::Resources::Journeys::Templates) }
7
11
  attr_reader :templates
8
12
 
9
- # Create a journey. Defaults to `DRAFT` state; pass `state: "PUBLISHED"` to
10
- # publish on create. Send nodes are not allowed on `POST`. The standard flow is:
11
- # create the journey shell here, add notification templates with
12
- # `POST /journeys/{templateId}/templates`, then wire them into the journey with
13
- # `PUT /journeys/{templateId}`. Call `POST /journeys/{templateId}/publish` to
14
- # publish a draft after the fact.
13
+ # Creates a journey from a set of nodes, in draft state unless you pass a
14
+ # published state. Send nodes cannot be included until their templates exist.
15
15
  sig do
16
16
  params(
17
17
  name: String,
@@ -36,15 +36,32 @@ module Courier
36
36
  ],
37
37
  enabled: T::Boolean,
38
38
  state: Courier::JourneyState::OrSymbol,
39
+ idempotency_key: String,
40
+ x_idempotency_expiration: String,
39
41
  request_options: Courier::RequestOptions::OrHash
40
42
  ).returns(Courier::JourneyResponse)
41
43
  end
42
44
  def create(
45
+ # Body param
43
46
  name:,
47
+ # Body param
44
48
  nodes:,
49
+ # Body param
45
50
  enabled: nil,
46
- # Lifecycle state of a journey.
51
+ # Body param: Lifecycle state of a journey.
47
52
  state: nil,
53
+ # Header param: A unique key that makes this request idempotent. If Courier
54
+ # receives another request with the same `Idempotency-Key`, it returns the stored
55
+ # response from the first request without performing the operation again
56
+ # (including the original status code and any error). Use it to safely retry
57
+ # `POST` requests after network failures without risking duplicate sends. The key
58
+ # is scoped to this endpoint.
59
+ idempotency_key: nil,
60
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
61
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
62
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
63
+ # maximum is 1 year.
64
+ x_idempotency_expiration: nil,
48
65
  request_options: {}
49
66
  )
50
67
  end
@@ -67,7 +84,8 @@ module Courier
67
84
  )
68
85
  end
69
86
 
70
- # Get the list of journeys.
87
+ # Lists the workspace's journeys, each carrying a name, state, and enabled flag.
88
+ # Paged by cursor.
71
89
  sig do
72
90
  params(
73
91
  cursor: String,
@@ -86,8 +104,8 @@ module Courier
86
104
  )
87
105
  end
88
106
 
89
- # Archive a journey. Archived journeys cannot be invoked. Existing journey runs
90
- # continue to completion.
107
+ # Archives a journey so it can no longer be invoked. Runs already in flight
108
+ # continue to completion, so archiving never strands a user mid-sequence.
91
109
  sig do
92
110
  params(
93
111
  template_id: String,
@@ -101,12 +119,8 @@ module Courier
101
119
  )
102
120
  end
103
121
 
104
- # Cancel journey runs. The request body must include EXACTLY ONE of
105
- # `cancelation_token` (cancels every run associated with the token) or `run_id`
106
- # (cancels a single tenant-scoped run). Supplying both or neither returns a `400`.
107
- # A `run_id` that does not match a run for the tenant returns `404`. Cancelation
108
- # is idempotent: a run that has already finished (`PROCESSED`/`ERROR`) or was
109
- # already `CANCELED` is left unchanged and its current status is returned.
122
+ # Cancels in-flight journey runs, either every run sharing a cancelation token or
123
+ # one run by id. Use it to stop a sequence when the event resolves.
110
124
  sig do
111
125
  params(
112
126
  cancel_journey_request:
@@ -114,53 +128,82 @@ module Courier
114
128
  Courier::CancelJourneyRequest::ByCancelationToken::OrHash,
115
129
  Courier::CancelJourneyRequest::ByRunID::OrHash
116
130
  ),
131
+ idempotency_key: String,
132
+ x_idempotency_expiration: String,
117
133
  request_options: Courier::RequestOptions::OrHash
118
134
  ).returns(Courier::CancelJourneyResponse::Variants)
119
135
  end
120
136
  def cancel(
121
- # Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of
137
+ # Body param: Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of
122
138
  # `cancelation_token` (cancels every run associated with the token) or `run_id`
123
139
  # (cancels a single tenant-scoped run).
124
140
  cancel_journey_request:,
141
+ # Header param: A unique key that makes this request idempotent. If Courier
142
+ # receives another request with the same `Idempotency-Key`, it returns the stored
143
+ # response from the first request without performing the operation again
144
+ # (including the original status code and any error). Use it to safely retry
145
+ # `POST` requests after network failures without risking duplicate sends. The key
146
+ # is scoped to this endpoint.
147
+ idempotency_key: nil,
148
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
149
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
150
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
151
+ # maximum is 1 year.
152
+ x_idempotency_expiration: nil,
125
153
  request_options: {}
126
154
  )
127
155
  end
128
156
 
129
- # Invoke a journey by id or alias to start a new run. The response includes a
130
- # `runId` identifying the run.
157
+ # Starts a journey run for one user and returns a runId. Runs execute
158
+ # asynchronously, so the response arrives before any message is sent.
131
159
  sig do
132
160
  params(
133
161
  template_id: String,
134
162
  data: T::Hash[Symbol, T.anything],
135
163
  profile: T::Hash[Symbol, T.anything],
136
164
  user_id: String,
165
+ idempotency_key: String,
166
+ x_idempotency_expiration: String,
137
167
  request_options: Courier::RequestOptions::OrHash
138
168
  ).returns(Courier::JourneysInvokeResponse)
139
169
  end
140
170
  def invoke(
141
- # A unique identifier representing the journey to be invoked. Accepts a Journey ID
142
- # or Journey Alias.
171
+ # Path param: A unique identifier representing the journey to be invoked. Accepts
172
+ # a Journey ID or Journey Alias.
143
173
  template_id,
144
- # Data payload passed to the journey. The expected shape can be predefined using
145
- # the schema builder in the journey editor. This data is available in journey
146
- # steps for condition evaluation and template variable interpolation. Can also
147
- # contain user identifiers (user_id, userId, anonymousId) if not provided
148
- # elsewhere.
174
+ # Body param: Data payload passed to the journey. The expected shape can be
175
+ # predefined using the schema builder in the journey editor. This data is
176
+ # available in journey steps for condition evaluation and template variable
177
+ # interpolation. Can also contain user identifiers (user_id, userId, anonymousId)
178
+ # if not provided elsewhere.
149
179
  data: nil,
150
- # Profile data for the user. Can contain contact information (email,
180
+ # Body param: Profile data for the user. Can contain contact information (email,
151
181
  # phone_number), user identifiers (user_id, userId, anonymousId), or any custom
152
182
  # profile fields. Profile fields are merged with any existing stored profile for
153
183
  # the user. Include context.tenant_id to load a tenant-scoped profile for
154
184
  # multi-tenant scenarios.
155
185
  profile: nil,
156
- # A unique identifier for the user. If not provided, the system will attempt to
157
- # resolve the user identifier from profile or data objects.
186
+ # Body param: A unique identifier for the user. If not provided, the system will
187
+ # attempt to resolve the user identifier from profile or data objects.
158
188
  user_id: nil,
189
+ # Header param: A unique key that makes this request idempotent. If Courier
190
+ # receives another request with the same `Idempotency-Key`, it returns the stored
191
+ # response from the first request without performing the operation again
192
+ # (including the original status code and any error). Use it to safely retry
193
+ # `POST` requests after network failures without risking duplicate sends. The key
194
+ # is scoped to this endpoint.
195
+ idempotency_key: nil,
196
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
197
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
198
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
199
+ # maximum is 1 year.
200
+ x_idempotency_expiration: nil,
159
201
  request_options: {}
160
202
  )
161
203
  end
162
204
 
163
- # List published versions of a journey, ordered most recent first.
205
+ # Lists a journey's published versions, most recent first, so you have a version
206
+ # id to roll back to. Paged by cursor.
164
207
  sig do
165
208
  params(
166
209
  template_id: String,
@@ -174,29 +217,40 @@ module Courier
174
217
  )
175
218
  end
176
219
 
177
- # Publish the current draft as a new version. Body is optional; pass
178
- # `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if
179
- # the journey has no draft to publish.
220
+ # Publishes a journey's current draft as a new version, making it live for new
221
+ # runs. Pass a version instead to roll back to an earlier one.
180
222
  sig do
181
223
  params(
182
224
  template_id: String,
183
225
  version: String,
226
+ idempotency_key: String,
227
+ x_idempotency_expiration: String,
184
228
  request_options: Courier::RequestOptions::OrHash
185
229
  ).returns(Courier::JourneyResponse)
186
230
  end
187
231
  def publish(
188
- # Journey id
232
+ # Path param: Journey id
189
233
  template_id,
234
+ # Body param
190
235
  version: nil,
236
+ # Header param: A unique key that makes this request idempotent. If Courier
237
+ # receives another request with the same `Idempotency-Key`, it returns the stored
238
+ # response from the first request without performing the operation again
239
+ # (including the original status code and any error). Use it to safely retry
240
+ # `POST` requests after network failures without risking duplicate sends. The key
241
+ # is scoped to this endpoint.
242
+ idempotency_key: nil,
243
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
244
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
245
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
246
+ # maximum is 1 year.
247
+ x_idempotency_expiration: nil,
191
248
  request_options: {}
192
249
  )
193
250
  end
194
251
 
195
- # Replace the journey draft. Updates the working draft only; call
196
- # `POST /journeys/{templateId}/publish` to make it live, or pass
197
- # `state: "PUBLISHED"` in this request to publish immediately. Send-node
198
- # `template` ids must already exist and be scoped to this journey, and node ids
199
- # must not be claimed by another journey.
252
+ # Replaces a journey's working draft, leaving the published version live until you
253
+ # publish. Reach for this when editing a journey already running.
200
254
  sig do
201
255
  params(
202
256
  template_id: String,