@trycourier/courier 6.6.1-alpha0 → 6.7.0-alpha10

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 (312) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +11 -11
  3. package/client.d.mts +48 -20
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +48 -20
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -3
  9. package/client.mjs.map +1 -1
  10. package/internal/to-file.d.mts +1 -1
  11. package/internal/to-file.d.ts +1 -1
  12. package/internal/to-file.js +1 -1
  13. package/internal/to-file.mjs +1 -1
  14. package/internal/tslib.js +6 -6
  15. package/package.json +1 -1
  16. package/resources/audiences.d.mts +30 -52
  17. package/resources/audiences.d.mts.map +1 -1
  18. package/resources/audiences.d.ts +30 -52
  19. package/resources/audiences.d.ts.map +1 -1
  20. package/resources/audiences.js.map +1 -1
  21. package/resources/audiences.mjs.map +1 -1
  22. package/resources/audit-events.d.mts +5 -9
  23. package/resources/audit-events.d.mts.map +1 -1
  24. package/resources/audit-events.d.ts +5 -9
  25. package/resources/audit-events.d.ts.map +1 -1
  26. package/resources/auth.d.mts +2 -2
  27. package/resources/auth.d.mts.map +1 -1
  28. package/resources/auth.d.ts +2 -2
  29. package/resources/auth.d.ts.map +1 -1
  30. package/resources/automations/automations.d.mts +5 -252
  31. package/resources/automations/automations.d.mts.map +1 -1
  32. package/resources/automations/automations.d.ts +5 -252
  33. package/resources/automations/automations.d.ts.map +1 -1
  34. package/resources/automations/automations.js +0 -42
  35. package/resources/automations/automations.js.map +1 -1
  36. package/resources/automations/automations.mjs +1 -43
  37. package/resources/automations/automations.mjs.map +1 -1
  38. package/resources/automations/index.d.mts +2 -2
  39. package/resources/automations/index.d.mts.map +1 -1
  40. package/resources/automations/index.d.ts +2 -2
  41. package/resources/automations/index.d.ts.map +1 -1
  42. package/resources/automations/index.js.map +1 -1
  43. package/resources/automations/index.mjs +2 -2
  44. package/resources/automations/index.mjs.map +1 -1
  45. package/resources/automations/invoke.d.mts +122 -9
  46. package/resources/automations/invoke.d.mts.map +1 -1
  47. package/resources/automations/invoke.d.ts +122 -9
  48. package/resources/automations/invoke.d.ts.map +1 -1
  49. package/resources/automations/invoke.js +45 -0
  50. package/resources/automations/invoke.js.map +1 -1
  51. package/resources/automations/invoke.mjs +45 -0
  52. package/resources/automations/invoke.mjs.map +1 -1
  53. package/resources/brands.d.mts +76 -52
  54. package/resources/brands.d.mts.map +1 -1
  55. package/resources/brands.d.ts +76 -52
  56. package/resources/brands.d.ts.map +1 -1
  57. package/resources/brands.js.map +1 -1
  58. package/resources/brands.mjs.map +1 -1
  59. package/resources/bulk.d.mts +36 -127
  60. package/resources/bulk.d.mts.map +1 -1
  61. package/resources/bulk.d.ts +36 -127
  62. package/resources/bulk.d.ts.map +1 -1
  63. package/resources/bulk.js.map +1 -1
  64. package/resources/bulk.mjs.map +1 -1
  65. package/resources/inbound.d.mts +1 -1
  66. package/resources/inbound.d.ts +1 -1
  67. package/resources/index.d.mts +11 -10
  68. package/resources/index.d.mts.map +1 -1
  69. package/resources/index.d.ts +11 -10
  70. package/resources/index.d.ts.map +1 -1
  71. package/resources/index.js +2 -0
  72. package/resources/index.js.map +1 -1
  73. package/resources/index.mjs +3 -2
  74. package/resources/index.mjs.map +1 -1
  75. package/resources/lists/index.d.mts +2 -2
  76. package/resources/lists/index.d.mts.map +1 -1
  77. package/resources/lists/index.d.ts +2 -2
  78. package/resources/lists/index.d.ts.map +1 -1
  79. package/resources/lists/index.js.map +1 -1
  80. package/resources/lists/index.mjs +1 -1
  81. package/resources/lists/index.mjs.map +1 -1
  82. package/resources/lists/lists.d.mts +19 -13
  83. package/resources/lists/lists.d.mts.map +1 -1
  84. package/resources/lists/lists.d.ts +19 -13
  85. package/resources/lists/lists.d.ts.map +1 -1
  86. package/resources/lists/lists.js +7 -2
  87. package/resources/lists/lists.js.map +1 -1
  88. package/resources/lists/lists.mjs +7 -2
  89. package/resources/lists/lists.mjs.map +1 -1
  90. package/resources/lists/subscriptions.d.mts +8 -52
  91. package/resources/lists/subscriptions.d.mts.map +1 -1
  92. package/resources/lists/subscriptions.d.ts +8 -52
  93. package/resources/lists/subscriptions.d.ts.map +1 -1
  94. package/resources/lists/subscriptions.js.map +1 -1
  95. package/resources/lists/subscriptions.mjs.map +1 -1
  96. package/resources/messages.d.mts +8 -8
  97. package/resources/messages.d.mts.map +1 -1
  98. package/resources/messages.d.ts +8 -8
  99. package/resources/messages.d.ts.map +1 -1
  100. package/resources/messages.js +1 -1
  101. package/resources/messages.js.map +1 -1
  102. package/resources/messages.mjs +1 -1
  103. package/resources/messages.mjs.map +1 -1
  104. package/resources/notifications/checks.d.mts +5 -12
  105. package/resources/notifications/checks.d.mts.map +1 -1
  106. package/resources/notifications/checks.d.ts +5 -12
  107. package/resources/notifications/checks.d.ts.map +1 -1
  108. package/resources/notifications/checks.js.map +1 -1
  109. package/resources/notifications/checks.mjs.map +1 -1
  110. package/resources/notifications/index.d.mts +2 -2
  111. package/resources/notifications/index.d.mts.map +1 -1
  112. package/resources/notifications/index.d.ts +2 -2
  113. package/resources/notifications/index.d.ts.map +1 -1
  114. package/resources/notifications/index.js.map +1 -1
  115. package/resources/notifications/index.mjs.map +1 -1
  116. package/resources/notifications/notifications.d.mts +13 -11
  117. package/resources/notifications/notifications.d.mts.map +1 -1
  118. package/resources/notifications/notifications.d.ts +13 -11
  119. package/resources/notifications/notifications.d.ts.map +1 -1
  120. package/resources/notifications/notifications.js.map +1 -1
  121. package/resources/notifications/notifications.mjs.map +1 -1
  122. package/resources/profiles/index.d.mts +1 -1
  123. package/resources/profiles/index.d.mts.map +1 -1
  124. package/resources/profiles/index.d.ts +1 -1
  125. package/resources/profiles/index.d.ts.map +1 -1
  126. package/resources/profiles/index.js.map +1 -1
  127. package/resources/profiles/index.mjs.map +1 -1
  128. package/resources/profiles/lists.d.mts +5 -11
  129. package/resources/profiles/lists.d.mts.map +1 -1
  130. package/resources/profiles/lists.d.ts +5 -11
  131. package/resources/profiles/lists.d.ts.map +1 -1
  132. package/resources/profiles/profiles.d.mts +7 -3
  133. package/resources/profiles/profiles.d.mts.map +1 -1
  134. package/resources/profiles/profiles.d.ts +7 -3
  135. package/resources/profiles/profiles.d.ts.map +1 -1
  136. package/resources/profiles/profiles.js.map +1 -1
  137. package/resources/profiles/profiles.mjs.map +1 -1
  138. package/resources/send.d.mts +127 -745
  139. package/resources/send.d.mts.map +1 -1
  140. package/resources/send.d.ts +127 -745
  141. package/resources/send.d.ts.map +1 -1
  142. package/resources/send.js +12 -1
  143. package/resources/send.js.map +1 -1
  144. package/resources/send.mjs +12 -1
  145. package/resources/send.mjs.map +1 -1
  146. package/resources/shared.d.mts +245 -0
  147. package/resources/shared.d.mts.map +1 -0
  148. package/resources/shared.d.ts +245 -0
  149. package/resources/shared.d.ts.map +1 -0
  150. package/resources/shared.js +4 -0
  151. package/resources/shared.js.map +1 -0
  152. package/{src/resources/tenants/default-preferences.ts → resources/shared.mjs} +2 -2
  153. package/resources/shared.mjs.map +1 -0
  154. package/resources/tenants/index.d.mts +3 -1
  155. package/resources/tenants/index.d.mts.map +1 -1
  156. package/resources/tenants/index.d.ts +3 -1
  157. package/resources/tenants/index.d.ts.map +1 -1
  158. package/resources/tenants/index.js +5 -1
  159. package/resources/tenants/index.js.map +1 -1
  160. package/resources/tenants/index.mjs +2 -0
  161. package/resources/tenants/index.mjs.map +1 -1
  162. package/resources/tenants/templates.d.mts +91 -0
  163. package/resources/tenants/templates.d.mts.map +1 -0
  164. package/resources/tenants/templates.d.ts +91 -0
  165. package/resources/tenants/templates.d.ts.map +1 -0
  166. package/resources/tenants/templates.js +38 -0
  167. package/resources/tenants/templates.js.map +1 -0
  168. package/resources/tenants/templates.mjs +34 -0
  169. package/resources/tenants/templates.mjs.map +1 -0
  170. package/resources/tenants/tenant-default-preferences/index.d.mts +3 -0
  171. package/resources/tenants/tenant-default-preferences/index.d.mts.map +1 -0
  172. package/resources/tenants/tenant-default-preferences/index.d.ts +3 -0
  173. package/resources/tenants/tenant-default-preferences/index.d.ts.map +1 -0
  174. package/resources/tenants/tenant-default-preferences/index.js +9 -0
  175. package/resources/tenants/tenant-default-preferences/index.js.map +1 -0
  176. package/resources/tenants/tenant-default-preferences/index.mjs +4 -0
  177. package/resources/tenants/tenant-default-preferences/index.mjs.map +1 -0
  178. package/resources/tenants/{default-preferences → tenant-default-preferences}/items.d.mts +5 -18
  179. package/resources/tenants/tenant-default-preferences/items.d.mts.map +1 -0
  180. package/resources/tenants/{default-preferences → tenant-default-preferences}/items.d.ts +5 -18
  181. package/resources/tenants/tenant-default-preferences/items.d.ts.map +1 -0
  182. package/resources/tenants/{default-preferences → tenant-default-preferences}/items.js +2 -2
  183. package/resources/tenants/tenant-default-preferences/items.js.map +1 -0
  184. package/resources/tenants/{default-preferences → tenant-default-preferences}/items.mjs +2 -2
  185. package/resources/tenants/tenant-default-preferences/items.mjs.map +1 -0
  186. package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.mts +10 -0
  187. package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.mts.map +1 -0
  188. package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.ts +10 -0
  189. package/resources/tenants/tenant-default-preferences/tenant-default-preferences.d.ts.map +1 -0
  190. package/resources/tenants/{default-preferences/default-preferences.js → tenant-default-preferences/tenant-default-preferences.js} +5 -5
  191. package/resources/tenants/tenant-default-preferences/tenant-default-preferences.js.map +1 -0
  192. package/resources/tenants/{default-preferences/default-preferences.mjs → tenant-default-preferences/tenant-default-preferences.mjs} +4 -4
  193. package/resources/tenants/tenant-default-preferences/tenant-default-preferences.mjs.map +1 -0
  194. package/resources/tenants/tenant-default-preferences.d.mts +2 -0
  195. package/resources/tenants/tenant-default-preferences.d.mts.map +1 -0
  196. package/resources/tenants/tenant-default-preferences.d.ts +2 -0
  197. package/resources/tenants/tenant-default-preferences.d.ts.map +1 -0
  198. package/resources/tenants/{default-preferences.js → tenant-default-preferences.js} +2 -2
  199. package/resources/tenants/tenant-default-preferences.js.map +1 -0
  200. package/resources/tenants/tenant-default-preferences.mjs +3 -0
  201. package/resources/tenants/tenant-default-preferences.mjs.map +1 -0
  202. package/resources/tenants/tenants.d.mts +66 -7
  203. package/resources/tenants/tenants.d.mts.map +1 -1
  204. package/resources/tenants/tenants.d.ts +66 -7
  205. package/resources/tenants/tenants.d.ts.map +1 -1
  206. package/resources/tenants/tenants.js +8 -2
  207. package/resources/tenants/tenants.js.map +1 -1
  208. package/resources/tenants/tenants.mjs +8 -2
  209. package/resources/tenants/tenants.mjs.map +1 -1
  210. package/resources/users/index.d.mts +3 -3
  211. package/resources/users/index.d.mts.map +1 -1
  212. package/resources/users/index.d.ts +3 -3
  213. package/resources/users/index.d.ts.map +1 -1
  214. package/resources/users/index.js.map +1 -1
  215. package/resources/users/index.mjs.map +1 -1
  216. package/resources/users/preferences.d.mts +8 -11
  217. package/resources/users/preferences.d.mts.map +1 -1
  218. package/resources/users/preferences.d.ts +8 -11
  219. package/resources/users/preferences.d.ts.map +1 -1
  220. package/resources/users/preferences.js.map +1 -1
  221. package/resources/users/preferences.mjs.map +1 -1
  222. package/resources/users/tenants.d.mts +4 -21
  223. package/resources/users/tenants.d.mts.map +1 -1
  224. package/resources/users/tenants.d.ts +4 -21
  225. package/resources/users/tenants.d.ts.map +1 -1
  226. package/resources/users/tenants.js.map +1 -1
  227. package/resources/users/tenants.mjs.map +1 -1
  228. package/resources/users/tokens.d.mts +22 -23
  229. package/resources/users/tokens.d.mts.map +1 -1
  230. package/resources/users/tokens.d.ts +22 -23
  231. package/resources/users/tokens.d.ts.map +1 -1
  232. package/resources/users/tokens.js +14 -15
  233. package/resources/users/tokens.js.map +1 -1
  234. package/resources/users/tokens.mjs +14 -15
  235. package/resources/users/tokens.mjs.map +1 -1
  236. package/resources/users/users.d.mts +6 -6
  237. package/resources/users/users.d.mts.map +1 -1
  238. package/resources/users/users.d.ts +6 -6
  239. package/resources/users/users.d.ts.map +1 -1
  240. package/resources/users/users.js.map +1 -1
  241. package/resources/users/users.mjs.map +1 -1
  242. package/src/client.ts +81 -56
  243. package/src/internal/to-file.ts +1 -1
  244. package/src/resources/audiences.ts +45 -90
  245. package/src/resources/audit-events.ts +7 -13
  246. package/src/resources/auth.ts +2 -16
  247. package/src/resources/automations/automations.ts +6 -342
  248. package/src/resources/automations/index.ts +2 -12
  249. package/src/resources/automations/invoke.ts +163 -14
  250. package/src/resources/brands.ts +119 -53
  251. package/src/resources/bulk.ts +28 -148
  252. package/src/resources/inbound.ts +1 -1
  253. package/src/resources/index.ts +24 -30
  254. package/src/resources/lists/index.ts +9 -3
  255. package/src/resources/lists/lists.ts +27 -16
  256. package/src/resources/lists/subscriptions.ts +7 -65
  257. package/src/resources/messages.ts +10 -7
  258. package/src/resources/notifications/checks.ts +4 -17
  259. package/src/resources/notifications/index.ts +2 -4
  260. package/src/resources/notifications/notifications.ts +13 -14
  261. package/src/resources/profiles/index.ts +1 -0
  262. package/src/resources/profiles/lists.ts +5 -13
  263. package/src/resources/profiles/profiles.ts +9 -2
  264. package/src/resources/send.ts +122 -928
  265. package/src/resources/shared.ts +305 -0
  266. package/src/resources/tenants/index.ts +10 -0
  267. package/src/resources/tenants/templates.ts +124 -0
  268. package/src/resources/tenants/tenant-default-preferences/index.ts +4 -0
  269. package/src/resources/tenants/{default-preferences → tenant-default-preferences}/items.ts +5 -27
  270. package/src/resources/tenants/{default-preferences/default-preferences.ts → tenant-default-preferences/tenant-default-preferences.ts} +4 -12
  271. package/src/resources/tenants/tenant-default-preferences.ts +3 -0
  272. package/src/resources/tenants/tenants.ts +89 -8
  273. package/src/resources/users/index.ts +2 -4
  274. package/src/resources/users/preferences.ts +7 -12
  275. package/src/resources/users/tenants.ts +3 -23
  276. package/src/resources/users/tokens.ts +33 -34
  277. package/src/resources/users/users.ts +4 -8
  278. package/src/version.ts +1 -1
  279. package/version.d.mts +1 -1
  280. package/version.d.mts.map +1 -1
  281. package/version.d.ts +1 -1
  282. package/version.d.ts.map +1 -1
  283. package/version.js +1 -1
  284. package/version.js.map +1 -1
  285. package/version.mjs +1 -1
  286. package/version.mjs.map +1 -1
  287. package/resources/tenants/default-preferences/default-preferences.d.mts +0 -10
  288. package/resources/tenants/default-preferences/default-preferences.d.mts.map +0 -1
  289. package/resources/tenants/default-preferences/default-preferences.d.ts +0 -10
  290. package/resources/tenants/default-preferences/default-preferences.d.ts.map +0 -1
  291. package/resources/tenants/default-preferences/default-preferences.js.map +0 -1
  292. package/resources/tenants/default-preferences/default-preferences.mjs.map +0 -1
  293. package/resources/tenants/default-preferences/index.d.mts +0 -3
  294. package/resources/tenants/default-preferences/index.d.mts.map +0 -1
  295. package/resources/tenants/default-preferences/index.d.ts +0 -3
  296. package/resources/tenants/default-preferences/index.d.ts.map +0 -1
  297. package/resources/tenants/default-preferences/index.js +0 -9
  298. package/resources/tenants/default-preferences/index.js.map +0 -1
  299. package/resources/tenants/default-preferences/index.mjs +0 -4
  300. package/resources/tenants/default-preferences/index.mjs.map +0 -1
  301. package/resources/tenants/default-preferences/items.d.mts.map +0 -1
  302. package/resources/tenants/default-preferences/items.d.ts.map +0 -1
  303. package/resources/tenants/default-preferences/items.js.map +0 -1
  304. package/resources/tenants/default-preferences/items.mjs.map +0 -1
  305. package/resources/tenants/default-preferences.d.mts +0 -2
  306. package/resources/tenants/default-preferences.d.mts.map +0 -1
  307. package/resources/tenants/default-preferences.d.ts +0 -2
  308. package/resources/tenants/default-preferences.d.ts.map +0 -1
  309. package/resources/tenants/default-preferences.js.map +0 -1
  310. package/resources/tenants/default-preferences.mjs +0 -3
  311. package/resources/tenants/default-preferences.mjs.map +0 -1
  312. package/src/resources/tenants/default-preferences/index.ts +0 -10
@@ -1,1036 +1,230 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
- import * as SendAPI from './send';
5
- import * as BulkAPI from './bulk';
4
+ import * as Shared from './shared';
6
5
  import { APIPromise } from '../core/api-promise';
7
6
  import { RequestOptions } from '../internal/request-options';
8
7
 
9
8
  export class Send extends APIResource {
10
9
  /**
11
10
  * Use the send API to send a message to one or more recipients.
12
- */
13
- sendMessage(body: SendSendMessageParams, options?: RequestOptions): APIPromise<SendSendMessageResponse> {
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const response = await client.send.message({
15
+ * message: {
16
+ * to: { user_id: 'example_user' },
17
+ * template: 'template_id',
18
+ * data: { foo: 'bar' },
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ message(body: SendMessageParams, options?: RequestOptions): APIPromise<SendMessageResponse> {
14
24
  return this._client.post('/send', { body, ...options });
15
25
  }
16
26
  }
17
27
 
18
- export interface BaseMessage {
19
- brand_id?: string | null;
20
-
21
- /**
22
- * "Define run-time configuration for one or more channels. If you don't specify
23
- * channels, the default configuration for each channel will be used. Valid
24
- * ChannelId's are: email, sms, push, inbox, direct_message, banner, and webhook."
25
- */
26
- channels?: { [key: string]: BaseMessage.Channels } | null;
27
-
28
- /**
29
- * Context to load with this recipient. Will override any context set on
30
- * message.context.
31
- */
32
- context?: MessageContext | null;
33
-
34
- /**
35
- * An arbitrary object that includes any data you want to pass to the message. The
36
- * data will populate the corresponding template or elements variables.
37
- */
38
- data?: { [key: string]: unknown } | null;
39
-
40
- /**
41
- * Defines the time to wait before delivering the message. You can specify one of
42
- * the following options. Duration with the number of milliseconds to delay. Until
43
- * with an ISO 8601 timestamp that specifies when it should be delivered. Until
44
- * with an OpenStreetMap opening_hours-like format that specifies the
45
- * [Delivery Window](https://www.courier.com/docs/platform/sending/failover/#delivery-window)
46
- * (e.g., 'Mo-Fr 08:00-18:00pm')
47
- */
48
- delay?: BaseMessage.Delay | null;
49
-
50
- /**
51
- * "Expiry allows you to set an absolute or relative time in which a message
52
- * expires. Note: This is only valid for the Courier Inbox channel as of
53
- * 12-08-2022."
54
- */
55
- expiry?: BaseMessage.Expiry | null;
56
-
57
- /**
58
- * Metadata such as utm tracking attached with the notification through this
59
- * channel.
60
- */
61
- metadata?: BaseMessage.Metadata | null;
62
-
63
- preferences?: BaseMessage.Preferences | null;
64
-
65
- /**
66
- * An object whose keys are valid provider identifiers which map to an object.
67
- */
68
- providers?: { [key: string]: BaseMessage.Providers } | null;
69
-
28
+ export interface SendMessageResponse {
70
29
  /**
71
- * Allows you to customize which channel(s) Courier will potentially deliver the
72
- * message. If no routing key is specified, Courier will use the default routing
73
- * configuration or routing defined by the template.
30
+ * A successful call to `POST /send` returns a `202` status code along with a
31
+ * `requestId` in the response body. For single-recipient requests, the `requestId`
32
+ * is the derived message_id. For multiple recipients, Courier assigns a unique
33
+ * message_id to each derived message.
74
34
  */
75
- routing?: BaseMessage.Routing | null;
35
+ requestId: string;
36
+ }
76
37
 
38
+ export interface SendMessageParams {
77
39
  /**
78
- * Time in ms to attempt the channel before failing over to the next available
79
- * channel.
40
+ * The message property has the following primary top-level properties. They define
41
+ * the destination and content of the message.
80
42
  */
81
- timeout?: BaseMessage.Timeout | null;
43
+ message: SendMessageParams.Message;
82
44
  }
83
45
 
84
- export namespace BaseMessage {
85
- export interface Channels {
86
- /**
87
- * Id of the brand that should be used for rendering the message. If not specified,
88
- * the brand configured as default brand will be used.
89
- */
90
- brand_id?: string | null;
91
-
92
- /**
93
- * A JavaScript conditional expression to determine if the message should be sent
94
- * through the channel. Has access to the data and profile object. For example,
95
- * `data.name === profile.name`
96
- */
97
- if?: string | null;
98
-
99
- metadata?: Channels.Metadata | null;
100
-
101
- /**
102
- * Channel specific overrides.
103
- */
104
- override?: { [key: string]: unknown } | null;
105
-
106
- /**
107
- * A list of providers enabled for this channel. Courier will select one provider
108
- * to send through unless routing_method is set to all.
109
- */
110
- providers?: Array<string> | null;
111
-
112
- /**
113
- * The method for selecting the providers to send the message with. Single will
114
- * send to one of the available providers for this channel, all will send the
115
- * message through all channels. Defaults to `single`.
116
- */
117
- routing_method?: SendAPI.RoutingMethod | null;
118
-
119
- timeouts?: Channels.Timeouts | null;
120
- }
121
-
122
- export namespace Channels {
123
- export interface Metadata {
124
- utm?: SendAPI.Utm | null;
125
- }
126
-
127
- export interface Timeouts {
128
- channel?: number | null;
129
-
130
- provider?: number | null;
131
- }
132
- }
133
-
46
+ export namespace SendMessageParams {
134
47
  /**
135
- * Defines the time to wait before delivering the message. You can specify one of
136
- * the following options. Duration with the number of milliseconds to delay. Until
137
- * with an ISO 8601 timestamp that specifies when it should be delivered. Until
138
- * with an OpenStreetMap opening_hours-like format that specifies the
139
- * [Delivery Window](https://www.courier.com/docs/platform/sending/failover/#delivery-window)
140
- * (e.g., 'Mo-Fr 08:00-18:00pm')
48
+ * The message property has the following primary top-level properties. They define
49
+ * the destination and content of the message.
141
50
  */
142
- export interface Delay {
143
- /**
144
- * The duration of the delay in milliseconds.
145
- */
146
- duration?: number | null;
51
+ export interface Message {
52
+ brand_id?: string | null;
147
53
 
148
54
  /**
149
- * An ISO 8601 timestamp that specifies when it should be delivered or an
150
- * OpenStreetMap opening_hours-like format that specifies the
151
- * [Delivery Window](https://www.courier.com/docs/platform/sending/failover/#delivery-window)
152
- * (e.g., 'Mo-Fr 08:00-18:00pm')
55
+ * Define run-time configuration for channels. Valid ChannelId's: email, sms, push,
56
+ * inbox, direct_message, banner, webhook.
153
57
  */
154
- until?: string | null;
155
- }
58
+ channels?: { [key: string]: Message.Channels } | null;
156
59
 
157
- /**
158
- * "Expiry allows you to set an absolute or relative time in which a message
159
- * expires. Note: This is only valid for the Courier Inbox channel as of
160
- * 12-08-2022."
161
- */
162
- export interface Expiry {
163
60
  /**
164
- * A duration in the form of milliseconds or an ISO8601 Duration format (i.e.
165
- * P1DT4H).
61
+ * Describes content that will work for email, inbox, push, chat, or any channel
62
+ * id.
166
63
  */
167
- expires_in: string | number;
64
+ content?: Shared.ElementalContentSugar | Shared.ElementalContent;
168
65
 
169
- /**
170
- * An epoch timestamp or ISO8601 timestamp with timezone
171
- * `(YYYY-MM-DDThh:mm:ss.sTZD)` that describes the time in which a message expires.
172
- */
173
- expires_at?: string | null;
174
- }
66
+ context?: Shared.MessageContext | null;
175
67
 
176
- /**
177
- * Metadata such as utm tracking attached with the notification through this
178
- * channel.
179
- */
180
- export interface Metadata {
181
- /**
182
- * An arbitrary string to tracks the event that generated this request (e.g.
183
- * 'signup').
184
- */
185
- event?: string | null;
68
+ data?: { [key: string]: unknown } | null;
186
69
 
187
- /**
188
- * An array of up to 9 tags you wish to associate with this request (and
189
- * corresponding messages) for later analysis. Individual tags cannot be more than
190
- * 30 characters in length.
191
- */
192
- tags?: Array<string> | null;
70
+ delay?: Message.Delay | null;
193
71
 
194
- /**
195
- * A unique ID used to correlate this request to processing on your servers. Note:
196
- * Courier does not verify the uniqueness of this ID.
197
- */
198
- trace_id?: string | null;
72
+ expiry?: Message.Expiry | null;
199
73
 
200
- /**
201
- * Identify the campaign that refers traffic to a specific website, and attributes
202
- * the browser's website session.
203
- */
204
- utm?: SendAPI.Utm | null;
205
- }
206
-
207
- export interface Preferences {
208
- /**
209
- * The ID of the subscription topic you want to apply to the message. If this is a
210
- * templated message, it will override the subscription topic if already associated
211
- */
212
- subscription_topic_id: string;
213
- }
74
+ metadata?: Message.Metadata | null;
214
75
 
215
- export interface Providers {
216
- /**
217
- * A JavaScript conditional expression to determine if the message should be sent
218
- * through the channel. Has access to the data and profile object. For example,
219
- * `data.name === profile.name`
220
- */
221
- if?: string | null;
76
+ preferences?: Message.Preferences | null;
222
77
 
223
- metadata?: Providers.Metadata | null;
78
+ providers?: { [key: string]: Message.Providers } | null;
224
79
 
225
80
  /**
226
- * Provider specific overrides.
81
+ * Customize which channels/providers Courier may deliver the message through.
227
82
  */
228
- override?: { [key: string]: unknown } | null;
83
+ routing?: Message.Routing | null;
229
84
 
230
- timeouts?: number | null;
231
- }
85
+ template?: string | null;
232
86
 
233
- export namespace Providers {
234
- export interface Metadata {
235
- utm?: SendAPI.Utm | null;
236
- }
237
- }
87
+ timeout?: Message.Timeout | null;
238
88
 
239
- /**
240
- * Allows you to customize which channel(s) Courier will potentially deliver the
241
- * message. If no routing key is specified, Courier will use the default routing
242
- * configuration or routing defined by the template.
243
- */
244
- export interface Routing {
245
89
  /**
246
- * A list of channels or providers to send the message through. Can also
247
- * recursively define sub-routing methods, which can be useful for defining
248
- * advanced push notification delivery strategies.
90
+ * The recipient or a list of recipients of the message
249
91
  */
250
- channels: Array<Routing.RoutingStrategyChannel | Routing.RoutingStrategyProvider | string>;
251
-
252
- method: SendAPI.RoutingMethod;
92
+ to?: Shared.UserRecipient | Array<Shared.Recipient> | null;
253
93
  }
254
94
 
255
- export namespace Routing {
256
- export interface RoutingStrategyChannel {
257
- channel: string;
258
-
259
- config?: { [key: string]: unknown } | null;
260
-
261
- if?: string | null;
262
-
263
- method?: SendAPI.RoutingMethod | null;
264
-
265
- providers?: { [key: string]: RoutingStrategyChannel.Providers } | null;
266
- }
267
-
268
- export namespace RoutingStrategyChannel {
269
- export interface Providers {
270
- /**
271
- * A JavaScript conditional expression to determine if the message should be sent
272
- * through the channel. Has access to the data and profile object. For example,
273
- * `data.name === profile.name`
274
- */
275
- if?: string | null;
276
-
277
- metadata?: Providers.Metadata | null;
278
-
279
- /**
280
- * Provider specific overrides.
281
- */
282
- override?: { [key: string]: unknown } | null;
283
-
284
- timeouts?: number | null;
285
- }
286
-
287
- export namespace Providers {
288
- export interface Metadata {
289
- utm?: SendAPI.Utm | null;
290
- }
291
- }
292
- }
293
-
294
- export interface RoutingStrategyProvider {
295
- metadata: RoutingStrategyProvider.Metadata;
296
-
297
- name: string;
298
-
299
- config?: { [key: string]: unknown } | null;
300
-
301
- if?: string | null;
302
- }
303
-
304
- export namespace RoutingStrategyProvider {
305
- export interface Metadata {
306
- utm?: SendAPI.Utm | null;
307
- }
308
- }
309
- }
310
-
311
- /**
312
- * Time in ms to attempt the channel before failing over to the next available
313
- * channel.
314
- */
315
- export interface Timeout {
316
- channel?: { [key: string]: number } | null;
317
-
318
- criteria?: 'no-escalation' | 'delivered' | 'viewed' | 'engaged' | null;
319
-
320
- escalation?: number | null;
321
-
322
- message?: number | null;
323
-
324
- provider?: { [key: string]: number } | null;
325
- }
326
- }
327
-
328
- export interface BaseMessageSendTo {
329
- /**
330
- * The recipient or a list of recipients of the message
331
- */
332
- to?:
333
- | BaseMessageSendTo.AudienceRecipient
334
- | BaseMessageSendTo.UnionMember1
335
- | BaseMessageSendTo.UnionMember2
336
- | BulkAPI.UserRecipient
337
- | BaseMessageSendTo.SlackRecipient
338
- | BaseMessageSendTo.MsTeamsRecipient
339
- | { [key: string]: unknown }
340
- | BaseMessageSendTo.PagerdutyRecipient
341
- | BaseMessageSendTo.WebhookRecipient
342
- | Array<Recipient>
343
- | null;
344
- }
345
-
346
- export namespace BaseMessageSendTo {
347
- export interface AudienceRecipient {
348
- /**
349
- * A unique identifier associated with an Audience. A message will be sent to each
350
- * user in the audience.
351
- */
352
- audience_id: string;
353
-
354
- data?: { [key: string]: unknown } | null;
355
-
356
- filters?: Array<AudienceRecipient.Filter> | null;
357
- }
358
-
359
- export namespace AudienceRecipient {
360
- export interface Filter {
95
+ export namespace Message {
96
+ export interface Channels {
361
97
  /**
362
- * Send to users only if they are member of the account
98
+ * Brand id used for rendering.
363
99
  */
364
- operator: 'MEMBER_OF';
365
-
366
- path: 'account_id';
100
+ brand_id?: string | null;
367
101
 
368
- value: string;
369
- }
370
- }
371
-
372
- export interface UnionMember1 {
373
- data?: { [key: string]: unknown } | null;
374
-
375
- filters?: Array<UnionMember1.Filter> | null;
376
-
377
- list_id?: string | null;
378
- }
379
-
380
- export namespace UnionMember1 {
381
- export interface Filter {
382
102
  /**
383
- * Send to users only if they are member of the account
103
+ * JS conditional with access to data/profile.
384
104
  */
385
- operator: 'MEMBER_OF';
386
-
387
- path: 'account_id';
388
-
389
- value: string;
390
- }
391
- }
392
-
393
- export interface UnionMember2 {
394
- data?: { [key: string]: unknown } | null;
395
-
396
- list_pattern?: string | null;
397
- }
398
-
399
- export interface SlackRecipient {
400
- slack:
401
- | SlackRecipient.SendToSlackChannel
402
- | SlackRecipient.SendToSlackEmail
403
- | SlackRecipient.SendToSlackUserID;
404
- }
405
-
406
- export namespace SlackRecipient {
407
- export interface SendToSlackChannel extends SendAPI.SlackBaseProperties {
408
- channel: string;
409
- }
410
-
411
- export interface SendToSlackEmail extends SendAPI.SlackBaseProperties {
412
- email: string;
413
- }
414
-
415
- export interface SendToSlackUserID extends SendAPI.SlackBaseProperties {
416
- user_id: string;
417
- }
418
- }
419
-
420
- export interface MsTeamsRecipient {
421
- ms_teams:
422
- | MsTeamsRecipient.SendToMsTeamsUserID
423
- | MsTeamsRecipient.SendToMsTeamsEmail
424
- | MsTeamsRecipient.SendToMsTeamsChannelID
425
- | MsTeamsRecipient.SendToMsTeamsConversationID
426
- | MsTeamsRecipient.SendToMsTeamsChannelName;
427
- }
428
-
429
- export namespace MsTeamsRecipient {
430
- export interface SendToMsTeamsUserID extends SendAPI.MsTeamsBaseProperties {
431
- user_id: string;
432
- }
433
-
434
- export interface SendToMsTeamsEmail extends SendAPI.MsTeamsBaseProperties {
435
- email: string;
436
- }
437
-
438
- export interface SendToMsTeamsChannelID extends SendAPI.MsTeamsBaseProperties {
439
- channel_id: string;
440
- }
441
-
442
- export interface SendToMsTeamsConversationID extends SendAPI.MsTeamsBaseProperties {
443
- conversation_id: string;
444
- }
445
-
446
- export interface SendToMsTeamsChannelName extends SendAPI.MsTeamsBaseProperties {
447
- channel_name: string;
448
-
449
- team_id: string;
450
- }
451
- }
452
-
453
- export interface PagerdutyRecipient {
454
- pagerduty: PagerdutyRecipient.Pagerduty;
455
- }
456
-
457
- export namespace PagerdutyRecipient {
458
- export interface Pagerduty {
459
- event_action?: string | null;
460
-
461
- routing_key?: string | null;
462
-
463
- severity?: string | null;
464
-
465
- source?: string | null;
466
- }
467
- }
468
-
469
- export interface WebhookRecipient {
470
- webhook: WebhookRecipient.Webhook;
471
- }
105
+ if?: string | null;
472
106
 
473
- export namespace WebhookRecipient {
474
- export interface Webhook {
475
- /**
476
- * The URL to send the webhook request to.
477
- */
478
- url: string;
107
+ metadata?: Channels.Metadata | null;
479
108
 
480
109
  /**
481
- * Authentication configuration for the webhook request.
110
+ * Channel specific overrides.
482
111
  */
483
- authentication?: Webhook.Authentication | null;
112
+ override?: { [key: string]: unknown } | null;
484
113
 
485
114
  /**
486
- * Custom headers to include in the webhook request.
115
+ * Providers enabled for this channel.
487
116
  */
488
- headers?: { [key: string]: string } | null;
117
+ providers?: Array<string> | null;
489
118
 
490
119
  /**
491
- * The HTTP method to use for the webhook request. Defaults to POST if not
492
- * specified.
120
+ * Defaults to `single`.
493
121
  */
494
- method?: 'POST' | 'PUT' | null;
122
+ routing_method?: 'all' | 'single' | null;
495
123
 
496
- /**
497
- * Specifies what profile information is included in the request payload. Defaults
498
- * to 'limited' if not specified.
499
- */
500
- profile?: 'limited' | 'expanded' | null;
124
+ timeouts?: Channels.Timeouts | null;
501
125
  }
502
126
 
503
- export namespace Webhook {
504
- /**
505
- * Authentication configuration for the webhook request.
506
- */
507
- export interface Authentication {
508
- /**
509
- * The authentication mode to use. Defaults to 'none' if not specified.
510
- */
511
- mode: 'none' | 'basic' | 'bearer';
512
-
513
- /**
514
- * Token for bearer authentication.
515
- */
516
- token?: string | null;
127
+ export namespace Channels {
128
+ export interface Metadata {
129
+ utm?: Shared.Utm | null;
130
+ }
517
131
 
518
- /**
519
- * Password for basic authentication.
520
- */
521
- password?: string | null;
132
+ export interface Timeouts {
133
+ channel?: number | null;
522
134
 
523
- /**
524
- * Username for basic authentication.
525
- */
526
- username?: string | null;
135
+ provider?: number | null;
527
136
  }
528
137
  }
529
- }
530
- }
531
-
532
- /**
533
- * Syntatic Sugar to provide a fast shorthand for Courier Elemental Blocks.
534
- */
535
- export type Content = Content.ElementalContent | Content.ElementalContentSugar;
536
-
537
- export namespace Content {
538
- export interface ElementalContent {
539
- elements: Array<SendAPI.ElementalNode>;
540
-
541
- /**
542
- * For example, "2022-01-01"
543
- */
544
- version: string;
545
-
546
- brand?: unknown;
547
- }
548
-
549
- /**
550
- * Syntatic Sugar to provide a fast shorthand for Courier Elemental Blocks.
551
- */
552
- export interface ElementalContentSugar {
553
- /**
554
- * The text content displayed in the notification.
555
- */
556
- body: string;
557
-
558
- /**
559
- * The title to be displayed by supported channels i.e. push, email (as subject)
560
- */
561
- title: string;
562
- }
563
- }
564
-
565
- export interface ElementalChannelNode {
566
- /**
567
- * The channel the contents of this element should be applied to. Can be `email`,
568
- * `push`, `direct_message`, `sms` or a provider such as slack
569
- */
570
- channel: string;
571
-
572
- channels?: Array<string> | null;
573
-
574
- /**
575
- * An array of elements to apply to the channel. If `raw` has not been specified,
576
- * `elements` is `required`.
577
- */
578
- elements?: Array<ElementalNode> | null;
579
-
580
- if?: string | null;
581
-
582
- loop?: string | null;
583
-
584
- /**
585
- * Raw data to apply to the channel. If `elements` has not been specified, `raw` is
586
- * `required`.
587
- */
588
- raw?: { [key: string]: unknown } | null;
589
-
590
- ref?: string | null;
591
- }
592
-
593
- export interface ElementalGroupNode {
594
- /**
595
- * Sub elements to render.
596
- */
597
- elements: Array<ElementalNode>;
598
-
599
- channels?: Array<string> | null;
600
-
601
- if?: string | null;
602
-
603
- loop?: string | null;
604
-
605
- ref?: string | null;
606
- }
607
-
608
- /**
609
- * The channel element allows a notification to be customized based on which
610
- * channel it is sent through. For example, you may want to display a detailed
611
- * message when the notification is sent through email, and a more concise message
612
- * in a push notification. Channel elements are only valid as top-level elements;
613
- * you cannot nest channel elements. If there is a channel element specified at the
614
- * top-level of the document, all sibling elements must be channel elements. Note:
615
- * As an alternative, most elements support a `channel` property. Which allows you
616
- * to selectively display an individual element on a per channel basis. See the
617
- * [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
618
- * for more details.
619
- */
620
- export type ElementalNode =
621
- | ElementalNode.UnionMember0
622
- | ElementalNode.UnionMember1
623
- | ElementalNode.UnionMember2
624
- | ElementalNode.UnionMember3
625
- | ElementalNode.UnionMember4
626
- | ElementalNode.UnionMember5
627
- | ElementalNode.UnionMember6
628
- | ElementalNode.UnionMember7;
629
-
630
- export namespace ElementalNode {
631
- export interface UnionMember0 {
632
- channels?: Array<string> | null;
633
-
634
- if?: string | null;
635
-
636
- loop?: string | null;
637
-
638
- ref?: string | null;
639
-
640
- type?: 'text';
641
- }
642
-
643
- export interface UnionMember1 {
644
- channels?: Array<string> | null;
645
-
646
- if?: string | null;
647
138
 
648
- loop?: string | null;
649
-
650
- ref?: string | null;
651
-
652
- type?: 'meta';
653
- }
654
-
655
- /**
656
- * The channel element allows a notification to be customized based on which
657
- * channel it is sent through. For example, you may want to display a detailed
658
- * message when the notification is sent through email, and a more concise message
659
- * in a push notification. Channel elements are only valid as top-level elements;
660
- * you cannot nest channel elements. If there is a channel element specified at the
661
- * top-level of the document, all sibling elements must be channel elements. Note:
662
- * As an alternative, most elements support a `channel` property. Which allows you
663
- * to selectively display an individual element on a per channel basis. See the
664
- * [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
665
- * for more details.
666
- */
667
- export interface UnionMember2 extends SendAPI.ElementalChannelNode {
668
- type?: 'channel';
669
- }
670
-
671
- export interface UnionMember3 {
672
- channels?: Array<string> | null;
673
-
674
- if?: string | null;
675
-
676
- loop?: string | null;
677
-
678
- ref?: string | null;
679
-
680
- type?: 'image';
681
- }
682
-
683
- export interface UnionMember4 {
684
- channels?: Array<string> | null;
685
-
686
- if?: string | null;
687
-
688
- loop?: string | null;
689
-
690
- ref?: string | null;
691
-
692
- type?: 'action';
693
- }
694
-
695
- export interface UnionMember5 {
696
- channels?: Array<string> | null;
697
-
698
- if?: string | null;
699
-
700
- loop?: string | null;
701
-
702
- ref?: string | null;
703
-
704
- type?: 'divider';
705
- }
706
-
707
- /**
708
- * Allows you to group elements together. This can be useful when used in
709
- * combination with "if" or "loop". See
710
- * [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
711
- * for more details.
712
- */
713
- export interface UnionMember6 extends SendAPI.ElementalGroupNode {
714
- type?: 'group';
715
- }
716
-
717
- export interface UnionMember7 {
718
- channels?: Array<string> | null;
719
-
720
- if?: string | null;
721
-
722
- loop?: string | null;
723
-
724
- ref?: string | null;
725
-
726
- type?: 'quote';
727
- }
728
- }
729
-
730
- /**
731
- * Describes the content of the message in a way that will work for email, push,
732
- * chat, or any channel.
733
- */
734
- export type Message = Message.ContentMessage | Message.TemplateMessage;
735
-
736
- export namespace Message {
737
- /**
738
- * Describes the content of the message in a way that will work for email, push,
739
- * chat, or any channel.
740
- */
741
- export interface ContentMessage extends SendAPI.BaseMessage, SendAPI.BaseMessageSendTo {
742
- /**
743
- * Describes the content of the message in a way that will work for email, push,
744
- * chat, or any channel. Either this or template must be specified.
745
- */
746
- content: SendAPI.Content;
747
- }
748
-
749
- /**
750
- * A template for a type of message that can be sent more than once. For example,
751
- * you might create an "Appointment Reminder" Notification or “Reset Password”
752
- * Notifications.
753
- */
754
- export interface TemplateMessage extends SendAPI.BaseMessage, SendAPI.BaseMessageSendTo {
755
- /**
756
- * The id of the notification template to be rendered and sent to the recipient(s).
757
- * This field or the content field must be supplied.
758
- */
759
- template: string;
760
- }
761
- }
762
-
763
- export interface MessageContext {
764
- /**
765
- * An id of a tenant, see
766
- * [tenants api docs](https://www.courier.com/docs/reference/tenants/). Will load
767
- * brand, default preferences and any other base context data associated with this
768
- * tenant.
769
- */
770
- tenant_id?: string | null;
771
- }
772
-
773
- export interface MsTeamsBaseProperties {
774
- service_url: string;
775
-
776
- tenant_id: string;
777
- }
778
-
779
- export type Recipient =
780
- | Recipient.AudienceRecipient
781
- | Recipient.UnionMember1
782
- | Recipient.UnionMember2
783
- | BulkAPI.UserRecipient
784
- | Recipient.SlackRecipient
785
- | Recipient.MsTeamsRecipient
786
- | { [key: string]: unknown }
787
- | Recipient.PagerdutyRecipient
788
- | Recipient.WebhookRecipient;
789
-
790
- export namespace Recipient {
791
- export interface AudienceRecipient {
792
- /**
793
- * A unique identifier associated with an Audience. A message will be sent to each
794
- * user in the audience.
795
- */
796
- audience_id: string;
797
-
798
- data?: { [key: string]: unknown } | null;
799
-
800
- filters?: Array<AudienceRecipient.Filter> | null;
801
- }
802
-
803
- export namespace AudienceRecipient {
804
- export interface Filter {
139
+ export interface Delay {
805
140
  /**
806
- * Send to users only if they are member of the account
141
+ * The duration of the delay in milliseconds.
807
142
  */
808
- operator: 'MEMBER_OF';
809
-
810
- path: 'account_id';
811
-
812
- value: string;
813
- }
814
- }
815
-
816
- export interface UnionMember1 {
817
- data?: { [key: string]: unknown } | null;
818
-
819
- filters?: Array<UnionMember1.Filter> | null;
143
+ duration?: number | null;
820
144
 
821
- list_id?: string | null;
822
- }
823
-
824
- export namespace UnionMember1 {
825
- export interface Filter {
826
145
  /**
827
- * Send to users only if they are member of the account
146
+ * ISO 8601 timestamp or opening_hours-like format.
828
147
  */
829
- operator: 'MEMBER_OF';
830
-
831
- path: 'account_id';
832
-
833
- value: string;
834
- }
835
- }
836
-
837
- export interface UnionMember2 {
838
- data?: { [key: string]: unknown } | null;
839
-
840
- list_pattern?: string | null;
841
- }
842
-
843
- export interface SlackRecipient {
844
- slack:
845
- | SlackRecipient.SendToSlackChannel
846
- | SlackRecipient.SendToSlackEmail
847
- | SlackRecipient.SendToSlackUserID;
848
- }
849
-
850
- export namespace SlackRecipient {
851
- export interface SendToSlackChannel extends SendAPI.SlackBaseProperties {
852
- channel: string;
148
+ until?: string | null;
853
149
  }
854
150
 
855
- export interface SendToSlackEmail extends SendAPI.SlackBaseProperties {
856
- email: string;
857
- }
858
-
859
- export interface SendToSlackUserID extends SendAPI.SlackBaseProperties {
860
- user_id: string;
861
- }
862
- }
863
-
864
- export interface MsTeamsRecipient {
865
- ms_teams:
866
- | MsTeamsRecipient.SendToMsTeamsUserID
867
- | MsTeamsRecipient.SendToMsTeamsEmail
868
- | MsTeamsRecipient.SendToMsTeamsChannelID
869
- | MsTeamsRecipient.SendToMsTeamsConversationID
870
- | MsTeamsRecipient.SendToMsTeamsChannelName;
871
- }
872
-
873
- export namespace MsTeamsRecipient {
874
- export interface SendToMsTeamsUserID extends SendAPI.MsTeamsBaseProperties {
875
- user_id: string;
876
- }
877
-
878
- export interface SendToMsTeamsEmail extends SendAPI.MsTeamsBaseProperties {
879
- email: string;
880
- }
881
-
882
- export interface SendToMsTeamsChannelID extends SendAPI.MsTeamsBaseProperties {
883
- channel_id: string;
884
- }
885
-
886
- export interface SendToMsTeamsConversationID extends SendAPI.MsTeamsBaseProperties {
887
- conversation_id: string;
888
- }
889
-
890
- export interface SendToMsTeamsChannelName extends SendAPI.MsTeamsBaseProperties {
891
- channel_name: string;
151
+ export interface Expiry {
152
+ /**
153
+ * Duration in ms or ISO8601 duration (e.g. P1DT4H).
154
+ */
155
+ expires_in: string | number;
892
156
 
893
- team_id: string;
157
+ /**
158
+ * Epoch or ISO8601 timestamp with timezone.
159
+ */
160
+ expires_at?: string | null;
894
161
  }
895
- }
896
-
897
- export interface PagerdutyRecipient {
898
- pagerduty: PagerdutyRecipient.Pagerduty;
899
- }
900
162
 
901
- export namespace PagerdutyRecipient {
902
- export interface Pagerduty {
903
- event_action?: string | null;
163
+ export interface Metadata {
164
+ event?: string | null;
904
165
 
905
- routing_key?: string | null;
166
+ tags?: Array<string> | null;
906
167
 
907
- severity?: string | null;
168
+ trace_id?: string | null;
908
169
 
909
- source?: string | null;
170
+ utm?: Shared.Utm | null;
910
171
  }
911
- }
912
172
 
913
- export interface WebhookRecipient {
914
- webhook: WebhookRecipient.Webhook;
915
- }
916
-
917
- export namespace WebhookRecipient {
918
- export interface Webhook {
173
+ export interface Preferences {
919
174
  /**
920
- * The URL to send the webhook request to.
175
+ * The subscription topic to apply to the message.
921
176
  */
922
- url: string;
177
+ subscription_topic_id: string;
178
+ }
923
179
 
180
+ export interface Providers {
924
181
  /**
925
- * Authentication configuration for the webhook request.
182
+ * JS conditional with access to data/profile.
926
183
  */
927
- authentication?: Webhook.Authentication | null;
184
+ if?: string | null;
928
185
 
929
- /**
930
- * Custom headers to include in the webhook request.
931
- */
932
- headers?: { [key: string]: string } | null;
186
+ metadata?: Providers.Metadata | null;
933
187
 
934
188
  /**
935
- * The HTTP method to use for the webhook request. Defaults to POST if not
936
- * specified.
189
+ * Provider-specific overrides.
937
190
  */
938
- method?: 'POST' | 'PUT' | null;
191
+ override?: { [key: string]: unknown } | null;
939
192
 
940
- /**
941
- * Specifies what profile information is included in the request payload. Defaults
942
- * to 'limited' if not specified.
943
- */
944
- profile?: 'limited' | 'expanded' | null;
193
+ timeouts?: number | null;
945
194
  }
946
195
 
947
- export namespace Webhook {
948
- /**
949
- * Authentication configuration for the webhook request.
950
- */
951
- export interface Authentication {
952
- /**
953
- * The authentication mode to use. Defaults to 'none' if not specified.
954
- */
955
- mode: 'none' | 'basic' | 'bearer';
956
-
957
- /**
958
- * Token for bearer authentication.
959
- */
960
- token?: string | null;
961
-
962
- /**
963
- * Password for basic authentication.
964
- */
965
- password?: string | null;
966
-
967
- /**
968
- * Username for basic authentication.
969
- */
970
- username?: string | null;
196
+ export namespace Providers {
197
+ export interface Metadata {
198
+ utm?: Shared.Utm | null;
971
199
  }
972
200
  }
973
- }
974
- }
975
-
976
- export type RoutingMethod = 'all' | 'single';
977
-
978
- export interface SlackBaseProperties {
979
- access_token: string;
980
- }
981
201
 
982
- export interface Utm {
983
- campaign?: string | null;
202
+ /**
203
+ * Customize which channels/providers Courier may deliver the message through.
204
+ */
205
+ export interface Routing {
206
+ /**
207
+ * A list of channels or providers (or nested routing rules).
208
+ */
209
+ channels: Array<Shared.MessageRoutingChannel>;
984
210
 
985
- content?: string | null;
211
+ method: 'all' | 'single';
212
+ }
986
213
 
987
- medium?: string | null;
214
+ export interface Timeout {
215
+ channel?: { [key: string]: number } | null;
988
216
 
989
- source?: string | null;
217
+ criteria?: 'no-escalation' | 'delivered' | 'viewed' | 'engaged' | null;
990
218
 
991
- term?: string | null;
992
- }
219
+ escalation?: number | null;
993
220
 
994
- export interface SendSendMessageResponse {
995
- /**
996
- * A successful call to `POST /send` returns a `202` status code along with a
997
- * `requestId` in the response body.
998
- *
999
- * For send requests that have a single recipient, the `requestId` is assigned to
1000
- * the derived message as its message_id. Therefore the `requestId` can be supplied
1001
- * to the Message's API for single recipient messages.
1002
- *
1003
- * For send requests that have multiple recipients (accounts, audiences, lists,
1004
- * etc.), Courier assigns a unique id to each derived message as its `message_id`.
1005
- * Therefore the `requestId` cannot be supplied to the Message's API for
1006
- * single-recipient messages.
1007
- */
1008
- requestId: string;
1009
- }
221
+ message?: number | null;
1010
222
 
1011
- export interface SendSendMessageParams {
1012
- /**
1013
- * Defines the message to be delivered
1014
- */
1015
- message: Message;
223
+ provider?: { [key: string]: number } | null;
224
+ }
225
+ }
1016
226
  }
1017
227
 
1018
228
  export declare namespace Send {
1019
- export {
1020
- type BaseMessage as BaseMessage,
1021
- type BaseMessageSendTo as BaseMessageSendTo,
1022
- type Content as Content,
1023
- type ElementalChannelNode as ElementalChannelNode,
1024
- type ElementalGroupNode as ElementalGroupNode,
1025
- type ElementalNode as ElementalNode,
1026
- type Message as Message,
1027
- type MessageContext as MessageContext,
1028
- type MsTeamsBaseProperties as MsTeamsBaseProperties,
1029
- type Recipient as Recipient,
1030
- type RoutingMethod as RoutingMethod,
1031
- type SlackBaseProperties as SlackBaseProperties,
1032
- type Utm as Utm,
1033
- type SendSendMessageResponse as SendSendMessageResponse,
1034
- type SendSendMessageParams as SendSendMessageParams,
1035
- };
229
+ export { type SendMessageResponse as SendMessageResponse, type SendMessageParams as SendMessageParams };
1036
230
  }