trycourier 4.20.0 → 4.22.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 (207) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/lib/courier/client.rb +39 -4
  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/inbox/message_delete_params.rb +22 -0
  8. data/lib/courier/models/inbox/message_restore_params.rb +22 -0
  9. data/lib/courier/models/journey_cancel_params.rb +13 -1
  10. data/lib/courier/models/journey_create_params.rb +13 -1
  11. data/lib/courier/models/journey_invoke_params.rb +13 -1
  12. data/lib/courier/models/journey_publish_params.rb +13 -1
  13. data/lib/courier/models/journeys/template_create_params.rb +13 -1
  14. data/lib/courier/models/journeys/template_publish_params.rb +13 -1
  15. data/lib/courier/models/lists/subscription_add_params.rb +13 -1
  16. data/lib/courier/models/notification_create_params.rb +13 -1
  17. data/lib/courier/models/notification_publish_params.rb +13 -1
  18. data/lib/courier/models/profile_create_params.rb +13 -1
  19. data/lib/courier/models/profiles/list_subscribe_params.rb +13 -1
  20. data/lib/courier/models/provider_create_params.rb +15 -1
  21. data/lib/courier/models/routing_strategy_create_params.rb +13 -1
  22. data/lib/courier/models/send_message_params.rb +15 -1
  23. data/lib/courier/models/users/preference_bulk_update_params.rb +15 -1
  24. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +14 -4
  25. data/lib/courier/models/users/topic_preference.rb +21 -7
  26. data/lib/courier/models/workspace_preference_create_params.rb +13 -1
  27. data/lib/courier/models/workspace_preference_publish_params.rb +13 -1
  28. data/lib/courier/models/workspace_preferences/topic_create_params.rb +13 -1
  29. data/lib/courier/models.rb +2 -14
  30. data/lib/courier/resources/audiences.rb +12 -5
  31. data/lib/courier/resources/audit_events.rb +5 -2
  32. data/lib/courier/resources/auth.rb +5 -1
  33. data/lib/courier/resources/automations/invoke.rb +47 -23
  34. data/lib/courier/resources/automations.rb +6 -1
  35. data/lib/courier/resources/brands.rb +38 -12
  36. data/lib/courier/resources/digests/schedules.rb +4 -3
  37. data/lib/courier/resources/digests.rb +2 -0
  38. data/lib/courier/resources/inbound.rb +3 -1
  39. data/lib/courier/resources/inbox/messages.rb +58 -0
  40. data/lib/courier/resources/inbox.rb +19 -0
  41. data/lib/courier/resources/journeys/templates.rb +43 -25
  42. data/lib/courier/resources/journeys.rb +73 -44
  43. data/lib/courier/resources/lists/subscriptions.rb +22 -8
  44. data/lib/courier/resources/lists.rb +14 -5
  45. data/lib/courier/resources/messages.rb +14 -14
  46. data/lib/courier/resources/notifications/checks.rb +8 -3
  47. data/lib/courier/resources/notifications.rb +48 -30
  48. data/lib/courier/resources/profiles/lists.rb +19 -8
  49. data/lib/courier/resources/profiles.rb +25 -14
  50. data/lib/courier/resources/providers/catalog.rb +4 -4
  51. data/lib/courier/resources/providers.rb +27 -18
  52. data/lib/courier/resources/requests.rb +4 -1
  53. data/lib/courier/resources/routing_strategies.rb +24 -12
  54. data/lib/courier/resources/send.rb +14 -4
  55. data/lib/courier/resources/tenants/preferences/items.rb +6 -2
  56. data/lib/courier/resources/tenants/preferences.rb +2 -0
  57. data/lib/courier/resources/tenants/templates/versions.rb +4 -7
  58. data/lib/courier/resources/tenants/templates.rb +14 -19
  59. data/lib/courier/resources/tenants.rb +14 -5
  60. data/lib/courier/resources/translations.rb +6 -2
  61. data/lib/courier/resources/users/preferences.rb +23 -42
  62. data/lib/courier/resources/users/tenants.rb +12 -10
  63. data/lib/courier/resources/users/tokens.rb +14 -6
  64. data/lib/courier/resources/users.rb +6 -0
  65. data/lib/courier/resources/workspace_preferences/topics.rb +27 -19
  66. data/lib/courier/resources/workspace_preferences.rb +40 -20
  67. data/lib/courier/version.rb +1 -1
  68. data/lib/courier.rb +4 -11
  69. data/rbi/courier/client.rbi +38 -3
  70. data/rbi/courier/models/automations/invoke_invoke_ad_hoc_params.rbi +18 -0
  71. data/rbi/courier/models/automations/invoke_invoke_by_template_params.rbi +18 -0
  72. data/rbi/courier/models/brand_create_params.rbi +18 -0
  73. data/rbi/courier/models/inbox/message_delete_params.rbi +40 -0
  74. data/rbi/courier/models/inbox/message_restore_params.rbi +40 -0
  75. data/rbi/courier/models/journey_cancel_params.rbi +31 -5
  76. data/rbi/courier/models/journey_create_params.rbi +31 -5
  77. data/rbi/courier/models/journey_invoke_params.rbi +26 -2
  78. data/rbi/courier/models/journey_publish_params.rbi +26 -2
  79. data/rbi/courier/models/journeys/template_create_params.rbi +26 -2
  80. data/rbi/courier/models/journeys/template_publish_params.rbi +23 -1
  81. data/rbi/courier/models/lists/subscription_add_params.rbi +23 -1
  82. data/rbi/courier/models/notification_create_params.rbi +31 -5
  83. data/rbi/courier/models/notification_publish_params.rbi +26 -2
  84. data/rbi/courier/models/profile_create_params.rbi +23 -1
  85. data/rbi/courier/models/profiles/list_subscribe_params.rbi +23 -1
  86. data/rbi/courier/models/provider_create_params.rbi +18 -0
  87. data/rbi/courier/models/routing_strategy_create_params.rbi +31 -5
  88. data/rbi/courier/models/send_message_params.rbi +18 -0
  89. data/rbi/courier/models/users/preference_bulk_update_params.rbi +18 -0
  90. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +14 -2
  91. data/rbi/courier/models/users/topic_preference.rbi +24 -2
  92. data/rbi/courier/models/workspace_preference_create_params.rbi +31 -5
  93. data/rbi/courier/models/workspace_preference_publish_params.rbi +31 -5
  94. data/rbi/courier/models/workspace_preferences/topic_create_params.rbi +26 -2
  95. data/rbi/courier/models.rbi +2 -14
  96. data/rbi/courier/resources/audiences.rbi +12 -5
  97. data/rbi/courier/resources/audit_events.rbi +5 -2
  98. data/rbi/courier/resources/auth.rbi +5 -1
  99. data/rbi/courier/resources/automations/invoke.rbi +48 -7
  100. data/rbi/courier/resources/automations.rbi +6 -1
  101. data/rbi/courier/resources/brands.rbi +37 -7
  102. data/rbi/courier/resources/digests/schedules.rbi +4 -3
  103. data/rbi/courier/resources/digests.rbi +2 -0
  104. data/rbi/courier/resources/inbound.rbi +3 -1
  105. data/rbi/courier/resources/inbox/messages.rbi +44 -0
  106. data/rbi/courier/resources/inbox.rbi +16 -0
  107. data/rbi/courier/resources/journeys/templates.rbi +47 -17
  108. data/rbi/courier/resources/journeys.rbi +93 -39
  109. data/rbi/courier/resources/lists/subscriptions.rbi +24 -5
  110. data/rbi/courier/resources/lists.rbi +14 -5
  111. data/rbi/courier/resources/messages.rbi +14 -14
  112. data/rbi/courier/resources/notifications/checks.rbi +8 -3
  113. data/rbi/courier/resources/notifications.rbi +58 -28
  114. data/rbi/courier/resources/profiles/lists.rbi +25 -6
  115. data/rbi/courier/resources/profiles.rbi +31 -11
  116. data/rbi/courier/resources/providers/catalog.rbi +4 -4
  117. data/rbi/courier/resources/providers.rbi +35 -19
  118. data/rbi/courier/resources/requests.rbi +4 -1
  119. data/rbi/courier/resources/routing_strategies.rbi +26 -10
  120. data/rbi/courier/resources/send.rbi +20 -3
  121. data/rbi/courier/resources/tenants/preferences/items.rbi +6 -2
  122. data/rbi/courier/resources/tenants/preferences.rbi +2 -0
  123. data/rbi/courier/resources/tenants/templates/versions.rbi +4 -7
  124. data/rbi/courier/resources/tenants/templates.rbi +14 -19
  125. data/rbi/courier/resources/tenants.rbi +14 -5
  126. data/rbi/courier/resources/translations.rbi +6 -2
  127. data/rbi/courier/resources/users/preferences.rbi +28 -40
  128. data/rbi/courier/resources/users/tenants.rbi +12 -10
  129. data/rbi/courier/resources/users/tokens.rbi +14 -6
  130. data/rbi/courier/resources/users.rbi +6 -0
  131. data/rbi/courier/resources/workspace_preferences/topics.rbi +37 -18
  132. data/rbi/courier/resources/workspace_preferences.rbi +51 -17
  133. data/sig/courier/client.rbs +2 -2
  134. data/sig/courier/models/automations/invoke_invoke_ad_hoc_params.rbs +15 -1
  135. data/sig/courier/models/automations/invoke_invoke_by_template_params.rbs +15 -1
  136. data/sig/courier/models/brand_create_params.rbs +15 -1
  137. data/sig/courier/models/inbox/message_delete_params.rbs +25 -0
  138. data/sig/courier/models/inbox/message_restore_params.rbs +25 -0
  139. data/sig/courier/models/journey_cancel_params.rbs +20 -3
  140. data/sig/courier/models/journey_create_params.rbs +20 -3
  141. data/sig/courier/models/journey_invoke_params.rbs +18 -1
  142. data/sig/courier/models/journey_publish_params.rbs +18 -1
  143. data/sig/courier/models/journeys/template_create_params.rbs +18 -1
  144. data/sig/courier/models/journeys/template_publish_params.rbs +18 -1
  145. data/sig/courier/models/lists/subscription_add_params.rbs +15 -1
  146. data/sig/courier/models/notification_create_params.rbs +20 -3
  147. data/sig/courier/models/notification_publish_params.rbs +18 -2
  148. data/sig/courier/models/profile_create_params.rbs +18 -1
  149. data/sig/courier/models/profiles/list_subscribe_params.rbs +15 -1
  150. data/sig/courier/models/provider_create_params.rbs +15 -1
  151. data/sig/courier/models/routing_strategy_create_params.rbs +20 -3
  152. data/sig/courier/models/send_message_params.rbs +17 -1
  153. data/sig/courier/models/users/preference_bulk_update_params.rbs +15 -1
  154. data/sig/courier/models/workspace_preference_create_params.rbs +20 -3
  155. data/sig/courier/models/workspace_preference_publish_params.rbs +20 -3
  156. data/sig/courier/models/workspace_preferences/topic_create_params.rbs +18 -1
  157. data/sig/courier/models.rbs +2 -14
  158. data/sig/courier/resources/automations/invoke.rbs +4 -0
  159. data/sig/courier/resources/brands.rbs +2 -0
  160. data/sig/courier/resources/inbox/messages.rbs +19 -0
  161. data/sig/courier/resources/inbox.rbs +9 -0
  162. data/sig/courier/resources/journeys/templates.rbs +4 -0
  163. data/sig/courier/resources/journeys.rbs +8 -0
  164. data/sig/courier/resources/lists/subscriptions.rbs +2 -0
  165. data/sig/courier/resources/notifications.rbs +4 -0
  166. data/sig/courier/resources/profiles/lists.rbs +2 -0
  167. data/sig/courier/resources/profiles.rbs +2 -0
  168. data/sig/courier/resources/providers.rbs +2 -0
  169. data/sig/courier/resources/routing_strategies.rbs +2 -0
  170. data/sig/courier/resources/send.rbs +2 -0
  171. data/sig/courier/resources/users/preferences.rbs +2 -0
  172. data/sig/courier/resources/workspace_preferences/topics.rbs +2 -0
  173. data/sig/courier/resources/workspace_preferences.rbs +4 -0
  174. metadata +14 -35
  175. data/lib/courier/models/bulk_add_users_params.rb +0 -26
  176. data/lib/courier/models/bulk_create_job_params.rb +0 -29
  177. data/lib/courier/models/bulk_create_job_response.rb +0 -16
  178. data/lib/courier/models/bulk_list_users_params.rb +0 -33
  179. data/lib/courier/models/bulk_list_users_response.rb +0 -49
  180. data/lib/courier/models/bulk_retrieve_job_params.rb +0 -20
  181. data/lib/courier/models/bulk_retrieve_job_response.rb +0 -76
  182. data/lib/courier/models/bulk_run_job_params.rb +0 -20
  183. data/lib/courier/models/inbound_bulk_message.rb +0 -91
  184. data/lib/courier/models/inbound_bulk_message_user.rb +0 -54
  185. data/lib/courier/resources/bulk.rb +0 -141
  186. data/rbi/courier/models/bulk_add_users_params.rbi +0 -43
  187. data/rbi/courier/models/bulk_create_job_params.rbi +0 -54
  188. data/rbi/courier/models/bulk_create_job_response.rbi +0 -26
  189. data/rbi/courier/models/bulk_list_users_params.rbi +0 -51
  190. data/rbi/courier/models/bulk_list_users_response.rbi +0 -125
  191. data/rbi/courier/models/bulk_retrieve_job_params.rbi +0 -35
  192. data/rbi/courier/models/bulk_retrieve_job_response.rbi +0 -157
  193. data/rbi/courier/models/bulk_run_job_params.rbi +0 -35
  194. data/rbi/courier/models/inbound_bulk_message.rbi +0 -124
  195. data/rbi/courier/models/inbound_bulk_message_user.rbi +0 -88
  196. data/rbi/courier/resources/bulk.rbi +0 -102
  197. data/sig/courier/models/bulk_add_users_params.rbs +0 -28
  198. data/sig/courier/models/bulk_create_job_params.rbs +0 -24
  199. data/sig/courier/models/bulk_create_job_response.rbs +0 -13
  200. data/sig/courier/models/bulk_list_users_params.rbs +0 -28
  201. data/sig/courier/models/bulk_list_users_response.rbs +0 -65
  202. data/sig/courier/models/bulk_retrieve_job_params.rbs +0 -23
  203. data/sig/courier/models/bulk_retrieve_job_response.rbs +0 -66
  204. data/sig/courier/models/bulk_run_job_params.rbs +0 -23
  205. data/sig/courier/models/inbound_bulk_message.rbs +0 -58
  206. data/sig/courier/models/inbound_bulk_message_user.rbs +0 -42
  207. data/sig/courier/resources/bulk.rbs +0 -34
@@ -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,
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Lists
6
+ # Manage static groups of users that you subscribe explicitly, and send to them by
7
+ # list id or list pattern.
6
8
  class Subscriptions
7
- # Get the list's subscriptions.
9
+ # Returns the users subscribed to a list with paging, each with the preferences
10
+ # recorded for that subscription.
8
11
  sig do
9
12
  params(
10
13
  list_id: String,
@@ -27,13 +30,28 @@ module Courier
27
30
  params(
28
31
  list_id: String,
29
32
  recipients: T::Array[Courier::PutSubscriptionsRecipient::OrHash],
33
+ idempotency_key: String,
34
+ x_idempotency_expiration: String,
30
35
  request_options: Courier::RequestOptions::OrHash
31
36
  ).void
32
37
  end
33
38
  def add(
34
- # A unique identifier representing the list you wish to retrieve.
39
+ # Path param: A unique identifier representing the list you wish to retrieve.
35
40
  list_id,
41
+ # Body param
36
42
  recipients:,
43
+ # Header param: A unique key that makes this request idempotent. If Courier
44
+ # receives another request with the same `Idempotency-Key`, it returns the stored
45
+ # response from the first request without performing the operation again
46
+ # (including the original status code and any error). Use it to safely retry
47
+ # `POST` requests after network failures without risking duplicate sends. The key
48
+ # is scoped to this endpoint.
49
+ idempotency_key: nil,
50
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
51
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
52
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
53
+ # maximum is 1 year.
54
+ x_idempotency_expiration: nil,
37
55
  request_options: {}
38
56
  )
39
57
  end
@@ -55,8 +73,8 @@ module Courier
55
73
  )
56
74
  end
57
75
 
58
- # Subscribe a user to an existing list (note: if the List does not exist, it will
59
- # be automatically created).
76
+ # Subscribes one user to a list, creating the list if it does not yet exist.
77
+ # Optional preferences apply to this subscription only.
60
78
  sig do
61
79
  params(
62
80
  user_id: String,
@@ -77,7 +95,8 @@ module Courier
77
95
  )
78
96
  end
79
97
 
80
- # Delete a subscription to a list by list ID and user ID.
98
+ # Removes one user's subscription to a list, addressed by list id and user id. The
99
+ # user's profile and other subscriptions are separate resources.
81
100
  sig do
82
101
  params(
83
102
  user_id: String,
@@ -2,11 +2,16 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Manage static groups of users that you subscribe explicitly, and send to them by
6
+ # list id or list pattern.
5
7
  class Lists
8
+ # Manage static groups of users that you subscribe explicitly, and send to them by
9
+ # list id or list pattern.
6
10
  sig { returns(Courier::Resources::Lists::Subscriptions) }
7
11
  attr_reader :subscriptions
8
12
 
9
- # Returns a list based on the list ID provided.
13
+ # Returns one list by id with its name and created and updated timestamps. Fetch
14
+ # its subscribers separately with the subscriptions endpoint.
10
15
  sig do
11
16
  params(
12
17
  list_id: String,
@@ -20,7 +25,8 @@ module Courier
20
25
  )
21
26
  end
22
27
 
23
- # Create or replace an existing list with the supplied values.
28
+ # Creates or replaces a list from a name and preferences. Subscribers are managed
29
+ # through the separate subscriptions endpoints.
24
30
  sig do
25
31
  params(
26
32
  list_id: String,
@@ -38,7 +44,8 @@ module Courier
38
44
  )
39
45
  end
40
46
 
41
- # Returns all of the lists, with the ability to filter based on a pattern.
47
+ # Returns the workspace's lists, filterable by a pattern to fetch a subset such as
48
+ # every regional list. Paged by cursor.
42
49
  sig do
43
50
  params(
44
51
  cursor: T.nilable(String),
@@ -58,7 +65,8 @@ module Courier
58
65
  )
59
66
  end
60
67
 
61
- # Delete a list by list ID.
68
+ # Deletes a list, halting sends that target it. A previously deleted list can be
69
+ # brought back with the companion restore endpoint.
62
70
  sig do
63
71
  params(
64
72
  list_id: String,
@@ -72,7 +80,8 @@ module Courier
72
80
  )
73
81
  end
74
82
 
75
- # Restore a previously deleted list.
83
+ # Restores a previously deleted list along with its subscribers, so a list removed
84
+ # by mistake can be brought back rather than rebuilt.
76
85
  sig do
77
86
  params(
78
87
  list_id: String,
@@ -2,8 +2,11 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Look up the messages Courier has accepted, inspect their delivery history and
6
+ # rendered output, and cancel, resend, or archive them.
5
7
  class Messages
6
- # Fetch the status of a message you've previously sent.
8
+ # Returns a sent message's status, recipient, event, and per-provider delivery
9
+ # detail, with timestamps for enqueued, sent, delivered, opened, and clicked.
7
10
  sig do
8
11
  params(
9
12
  message_id: String,
@@ -18,7 +21,8 @@ module Courier
18
21
  )
19
22
  end
20
23
 
21
- # Fetch the statuses of messages you've previously sent.
24
+ # Returns previously sent messages, most recent first, each carrying its status,
25
+ # recipient, channel, and provider. Paged by cursor.
22
26
  sig do
23
27
  params(
24
28
  archived: T.nilable(T::Boolean),
@@ -80,11 +84,8 @@ module Courier
80
84
  )
81
85
  end
82
86
 
83
- # Cancel a message that is currently in the process of being delivered. A
84
- # well-formatted API call to the cancel message API will return either `200`
85
- # status code for a successful cancellation or `409` status code for an
86
- # unsuccessful cancellation. Both cases will include the actual message record in
87
- # the response body (see details below).
87
+ # Cancels a message that is still in the delivery pipeline and returns the message
88
+ # record with its resulting canceled or failed status.
88
89
  sig do
89
90
  params(
90
91
  message_id: String,
@@ -98,7 +99,8 @@ module Courier
98
99
  )
99
100
  end
100
101
 
101
- # Get message content
102
+ # Returns the rendered content Courier delivered for a message, broken out per
103
+ # channel, to confirm what the recipient received.
102
104
  sig do
103
105
  params(
104
106
  message_id: String,
@@ -113,7 +115,8 @@ module Courier
113
115
  )
114
116
  end
115
117
 
116
- # Fetch the array of events of a message you've previously sent.
118
+ # Returns the ordered event history for a sent message, one entry per status
119
+ # transition with its timestamp.
117
120
  sig do
118
121
  params(
119
122
  message_id: String,
@@ -130,11 +133,8 @@ module Courier
130
133
  )
131
134
  end
132
135
 
133
- # Resend a previously sent message. The original send request is loaded from
134
- # storage and a brand-new send is enqueued for the same recipient and content,
135
- # producing a **new** `messageId` — the original message is not modified.
136
- # Throttled by a per-message rate limit; a repeat inside the limit window returns
137
- # `429 Too Many Requests`.
136
+ # Resends a previously sent message to the same recipient and content, returning a
137
+ # new messageId. The original send request is not modified.
138
138
  sig do
139
139
  params(
140
140
  message_id: String,
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Notifications
6
+ # Create, update, version, publish, and localize notification templates and their
7
+ # content.
6
8
  class Checks
7
- # Replace the submission checks for a notification template.
9
+ # Replaces the approval checks on a template submission with the complete set
10
+ # supplied in the request body.
8
11
  sig do
9
12
  params(
10
13
  submission_id: String,
@@ -24,7 +27,8 @@ module Courier
24
27
  )
25
28
  end
26
29
 
27
- # Retrieve the submission checks for a notification template.
30
+ # Returns the approval checks recorded for a template submission, each with its
31
+ # pass or fail result.
28
32
  sig do
29
33
  params(
30
34
  submission_id: String,
@@ -41,7 +45,8 @@ module Courier
41
45
  )
42
46
  end
43
47
 
44
- # Cancel a submission for a notification template.
48
+ # Cancels a pending template submission, withdrawing it from the approval
49
+ # workflow. The template stays in draft and can be resubmitted later.
45
50
  sig do
46
51
  params(
47
52
  submission_id: String,
@@ -2,7 +2,11 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Create, update, version, publish, and localize notification templates and their
6
+ # content.
5
7
  class Notifications
8
+ # Create, update, version, publish, and localize notification templates and their
9
+ # content.
6
10
  sig { returns(Courier::Resources::Notifications::Checks) }
7
11
  attr_reader :checks
8
12
 
@@ -12,16 +16,30 @@ module Courier
12
16
  params(
13
17
  notification: Courier::NotificationTemplatePayload::OrHash,
14
18
  state: Courier::NotificationTemplateCreateRequest::State::OrSymbol,
19
+ idempotency_key: String,
20
+ x_idempotency_expiration: String,
15
21
  request_options: Courier::RequestOptions::OrHash
16
22
  ).returns(Courier::NotificationTemplateResponse)
17
23
  end
18
24
  def create(
19
- # Core template fields used in POST and PUT request bodies (nested under a
20
- # `notification` key) and returned at the top level in responses.
25
+ # Body param: Core template fields used in POST and PUT request bodies (nested
26
+ # under a `notification` key) and returned at the top level in responses.
21
27
  notification:,
22
- # Template state after creation. Case-insensitive input, normalized to uppercase
23
- # in the response. Defaults to "DRAFT".
28
+ # Body param: Template state after creation. Case-insensitive input, normalized to
29
+ # uppercase in the response. Defaults to "DRAFT".
24
30
  state: nil,
31
+ # Header param: A unique key that makes this request idempotent. If Courier
32
+ # receives another request with the same `Idempotency-Key`, it returns the stored
33
+ # response from the first request without performing the operation again
34
+ # (including the original status code and any error). Use it to safely retry
35
+ # `POST` requests after network failures without risking duplicate sends. The key
36
+ # is scoped to this endpoint.
37
+ idempotency_key: nil,
38
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
39
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
40
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
41
+ # maximum is 1 year.
42
+ x_idempotency_expiration: nil,
25
43
  request_options: {}
26
44
  )
27
45
  end
@@ -45,7 +63,8 @@ module Courier
45
63
  )
46
64
  end
47
65
 
48
- # List notification templates in your workspace.
66
+ # Lists the workspace's notification templates. Each carries a name, tags, brand,
67
+ # routing, and its draft or published state.
49
68
  sig do
50
69
  params(
51
70
  cursor: T.nilable(String),
@@ -65,7 +84,8 @@ module Courier
65
84
  )
66
85
  end
67
86
 
68
- # Archive a notification template.
87
+ # Archives a notification template, preventing new sends from referencing it. The
88
+ # template stays retrievable for its version history.
69
89
  sig do
70
90
  params(
71
91
  id: String,
@@ -79,12 +99,9 @@ module Courier
79
99
  )
80
100
  end
81
101
 
82
- # Duplicate a notification template. Creates a standalone copy within the same
83
- # workspace and environment, with " COPY" appended to the title. The copy clones
84
- # the source draft's tags, brand, subscription topic, routing strategy, channels,
85
- # and content, and is always created as a standalone template (it is not linked to
86
- # any journey or broadcast, even if the source was). Templates that are scoped to
87
- # a journey or a broadcast cannot be duplicated through this endpoint.
102
+ # Copies a notification template within the same workspace and environment,
103
+ # appending " COPY" to the title. The copy is standalone and independently
104
+ # editable.
88
105
  sig do
89
106
  params(
90
107
  id: String,
@@ -98,7 +115,8 @@ module Courier
98
115
  )
99
116
  end
100
117
 
101
- # List versions of a notification template.
118
+ # Returns a notification template's published versions, most recent first, for
119
+ # comparison or rollback. Paged.
102
120
  sig do
103
121
  params(
104
122
  id: String,
@@ -124,21 +142,35 @@ module Courier
124
142
  params(
125
143
  id: String,
126
144
  version: String,
145
+ idempotency_key: String,
146
+ x_idempotency_expiration: String,
127
147
  request_options: Courier::RequestOptions::OrHash
128
148
  ).void
129
149
  end
130
150
  def publish(
131
- # Template ID (nt\_ prefix).
151
+ # Path param: Template ID (nt\_ prefix).
132
152
  id,
133
- # Historical version to publish (e.g. "v001"). Omit to publish the current draft.
153
+ # Body param: Historical version to publish (e.g. "v001"). Omit to publish the
154
+ # current draft.
134
155
  version: nil,
156
+ # Header param: A unique key that makes this request idempotent. If Courier
157
+ # receives another request with the same `Idempotency-Key`, it returns the stored
158
+ # response from the first request without performing the operation again
159
+ # (including the original status code and any error). Use it to safely retry
160
+ # `POST` requests after network failures without risking duplicate sends. The key
161
+ # is scoped to this endpoint.
162
+ idempotency_key: nil,
163
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
164
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
165
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
166
+ # maximum is 1 year.
167
+ x_idempotency_expiration: nil,
135
168
  request_options: {}
136
169
  )
137
170
  end
138
171
 
139
- # Replace the elemental content of a notification template. Overwrites all
140
- # elements in the template with the provided content. Only supported for V2
141
- # (elemental) templates.
172
+ # Replaces all Elemental content in a template, overwriting every existing
173
+ # element. Supported for V2 templates only, not V1 blocks and channels.
142
174
  sig do
143
175
  params(
144
176
  id: String,
@@ -158,8 +190,8 @@ module Courier
158
190
  )
159
191
  end
160
192
 
161
- # Update a single element within a notification template. Only supported for V2
162
- # (elemental) templates.
193
+ # Replaces one Elemental element in a template, addressed by its element id.
194
+ # Supported for V2 templates only, not V1 blocks and channels.
163
195
  sig do
164
196
  params(
165
197
  element_id: String,
@@ -197,9 +229,8 @@ module Courier
197
229
  )
198
230
  end
199
231
 
200
- # Set locale-specific content overrides for a notification template. Each element
201
- # override must reference an existing element by ID. Only supported for V2
202
- # (elemental) templates.
232
+ # Sets locale-specific content overrides for a template. Each override must
233
+ # reference an element that already exists in the default content.
203
234
  sig do
204
235
  params(
205
236
  locale_id: String,
@@ -223,7 +254,8 @@ module Courier
223
254
  )
224
255
  end
225
256
 
226
- # Replace a notification template. All fields are required.
257
+ # Replaces a notification template in full, so send every field rather than only
258
+ # the ones you want changed. Publish separately to make it live.
227
259
  sig do
228
260
  params(
229
261
  id: String,
@@ -245,10 +277,8 @@ module Courier
245
277
  )
246
278
  end
247
279
 
248
- # Retrieve the content of a notification template. The response shape depends on
249
- # whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
250
- # the `version` query parameter to select draft, published, or a specific
251
- # historical version.
280
+ # Returns a template's content and checksum. V2 templates return Elemental
281
+ # elements, while V1 templates return blocks and channels instead.
252
282
  sig do
253
283
  params(
254
284
  id: String,