@trycourier/courier 6.6.1-alpha0 → 6.7.0-alpha2
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.
- package/CHANGELOG.md +50 -0
- package/README.md +11 -11
- package/client.d.mts +23 -14
- package/client.d.mts.map +1 -1
- package/client.d.ts +23 -14
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs +2 -2
- package/client.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/tslib.js +6 -6
- package/package.json +1 -1
- package/resources/audiences.d.mts +27 -46
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +27 -46
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audit-events.d.mts +3 -7
- package/resources/audit-events.d.mts.map +1 -1
- package/resources/audit-events.d.ts +3 -7
- package/resources/audit-events.d.ts.map +1 -1
- package/resources/auth.d.mts +2 -2
- package/resources/auth.d.mts.map +1 -1
- package/resources/auth.d.ts +2 -2
- package/resources/auth.d.ts.map +1 -1
- package/resources/automations/automations.d.mts +2 -253
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +2 -253
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.js +0 -42
- package/resources/automations/automations.js.map +1 -1
- package/resources/automations/automations.mjs +0 -42
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/index.d.mts +2 -2
- package/resources/automations/index.d.mts.map +1 -1
- package/resources/automations/index.d.ts +2 -2
- package/resources/automations/index.d.ts.map +1 -1
- package/resources/automations/index.js.map +1 -1
- package/resources/automations/index.mjs +1 -1
- package/resources/automations/index.mjs.map +1 -1
- package/resources/automations/invoke.d.mts +124 -9
- package/resources/automations/invoke.d.mts.map +1 -1
- package/resources/automations/invoke.d.ts +124 -9
- package/resources/automations/invoke.d.ts.map +1 -1
- package/resources/automations/invoke.js +45 -0
- package/resources/automations/invoke.js.map +1 -1
- package/resources/automations/invoke.mjs +45 -0
- package/resources/automations/invoke.mjs.map +1 -1
- package/resources/brands.d.mts +74 -50
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +74 -50
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.js.map +1 -1
- package/resources/brands.mjs.map +1 -1
- package/resources/bulk.d.mts +38 -89
- package/resources/bulk.d.mts.map +1 -1
- package/resources/bulk.d.ts +38 -89
- package/resources/bulk.d.ts.map +1 -1
- package/resources/inbound.d.mts +1 -1
- package/resources/inbound.d.ts +1 -1
- package/resources/index.d.mts +8 -7
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +8 -7
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -0
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/lists/index.d.mts +2 -2
- package/resources/lists/index.d.mts.map +1 -1
- package/resources/lists/index.d.ts +2 -2
- package/resources/lists/index.d.ts.map +1 -1
- package/resources/lists/index.js.map +1 -1
- package/resources/lists/index.mjs +1 -1
- package/resources/lists/index.mjs.map +1 -1
- package/resources/lists/lists.d.mts +9 -7
- package/resources/lists/lists.d.mts.map +1 -1
- package/resources/lists/lists.d.ts +9 -7
- package/resources/lists/lists.d.ts.map +1 -1
- package/resources/lists/lists.js +7 -2
- package/resources/lists/lists.js.map +1 -1
- package/resources/lists/lists.mjs +7 -2
- package/resources/lists/lists.mjs.map +1 -1
- package/resources/lists/subscriptions.d.mts +9 -34
- package/resources/lists/subscriptions.d.mts.map +1 -1
- package/resources/lists/subscriptions.d.ts +9 -34
- package/resources/lists/subscriptions.d.ts.map +1 -1
- package/resources/messages.d.mts +6 -6
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +6 -6
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +1 -1
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +1 -1
- package/resources/messages.mjs.map +1 -1
- package/resources/notifications/index.d.mts +1 -1
- package/resources/notifications/index.d.mts.map +1 -1
- package/resources/notifications/index.d.ts +1 -1
- package/resources/notifications/index.d.ts.map +1 -1
- package/resources/notifications/index.js.map +1 -1
- package/resources/notifications/index.mjs.map +1 -1
- package/resources/notifications/notifications.d.mts +3 -8
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +3 -8
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/send.d.mts +245 -701
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +245 -701
- package/resources/send.d.ts.map +1 -1
- package/resources/send.js +12 -1
- package/resources/send.js.map +1 -1
- package/resources/send.mjs +12 -1
- package/resources/send.mjs.map +1 -1
- package/resources/shared.d.mts +42 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +42 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/tenants/index.d.mts +1 -0
- package/resources/tenants/index.d.mts.map +1 -1
- package/resources/tenants/index.d.ts +1 -0
- package/resources/tenants/index.d.ts.map +1 -1
- package/resources/tenants/index.js +3 -1
- package/resources/tenants/index.js.map +1 -1
- package/resources/tenants/index.mjs +1 -0
- package/resources/tenants/index.mjs.map +1 -1
- package/resources/tenants/templates.d.mts +122 -0
- package/resources/tenants/templates.d.mts.map +1 -0
- package/resources/tenants/templates.d.ts +122 -0
- package/resources/tenants/templates.d.ts.map +1 -0
- package/resources/tenants/templates.js +38 -0
- package/resources/tenants/templates.js.map +1 -0
- package/resources/tenants/templates.mjs +34 -0
- package/resources/tenants/templates.mjs.map +1 -0
- package/resources/tenants/tenants.d.mts +4 -0
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +4 -0
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +4 -0
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +4 -0
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/users/index.d.mts +1 -1
- package/resources/users/index.d.mts.map +1 -1
- package/resources/users/index.d.ts +1 -1
- package/resources/users/index.d.ts.map +1 -1
- package/resources/users/tokens.d.mts +22 -23
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts +22 -23
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.js +14 -15
- package/resources/users/tokens.js.map +1 -1
- package/resources/users/tokens.mjs +14 -15
- package/resources/users/tokens.mjs.map +1 -1
- package/resources/users/users.d.mts +2 -2
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +2 -2
- package/resources/users/users.d.ts.map +1 -1
- package/src/client.ts +48 -38
- package/src/internal/to-file.ts +1 -1
- package/src/resources/audiences.ts +43 -82
- package/src/resources/audit-events.ts +5 -11
- package/src/resources/auth.ts +2 -16
- package/src/resources/automations/automations.ts +4 -340
- package/src/resources/automations/index.ts +3 -8
- package/src/resources/automations/invoke.ts +163 -13
- package/src/resources/brands.ts +117 -51
- package/src/resources/bulk.ts +31 -104
- package/src/resources/inbound.ts +1 -1
- package/src/resources/index.ts +17 -19
- package/src/resources/lists/index.ts +9 -1
- package/src/resources/lists/lists.ts +15 -5
- package/src/resources/lists/subscriptions.ts +12 -45
- package/src/resources/messages.ts +8 -5
- package/src/resources/notifications/index.ts +0 -2
- package/src/resources/notifications/notifications.ts +2 -12
- package/src/resources/send.ts +249 -853
- package/src/resources/shared.ts +61 -0
- package/src/resources/tenants/index.ts +8 -0
- package/src/resources/tenants/templates.ts +165 -0
- package/src/resources/tenants/tenants.ts +21 -0
- package/src/resources/users/index.ts +2 -2
- package/src/resources/users/tokens.ts +33 -34
- package/src/resources/users/users.ts +4 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/send.ts
CHANGED
|
@@ -3,606 +3,55 @@
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as SendAPI from './send';
|
|
5
5
|
import * as BulkAPI from './bulk';
|
|
6
|
+
import * as Shared from './shared';
|
|
7
|
+
import * as TemplatesAPI from './tenants/templates';
|
|
6
8
|
import { APIPromise } from '../core/api-promise';
|
|
7
9
|
import { RequestOptions } from '../internal/request-options';
|
|
8
10
|
|
|
9
11
|
export class Send extends APIResource {
|
|
10
12
|
/**
|
|
11
13
|
* Use the send API to send a message to one or more recipients.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const response = await client.send.message({
|
|
18
|
+
* message: {
|
|
19
|
+
* to: { user_id: 'example_user' },
|
|
20
|
+
* template: 'template_id',
|
|
21
|
+
* data: { name: 'Example Name' },
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
12
25
|
*/
|
|
13
|
-
|
|
26
|
+
message(body: SendMessageParams, options?: RequestOptions): APIPromise<SendMessageResponse> {
|
|
14
27
|
return this._client.post('/send', { body, ...options });
|
|
15
28
|
}
|
|
16
29
|
}
|
|
17
30
|
|
|
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
|
-
|
|
70
|
-
/**
|
|
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.
|
|
74
|
-
*/
|
|
75
|
-
routing?: BaseMessage.Routing | null;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Time in ms to attempt the channel before failing over to the next available
|
|
79
|
-
* channel.
|
|
80
|
-
*/
|
|
81
|
-
timeout?: BaseMessage.Timeout | null;
|
|
82
|
-
}
|
|
83
|
-
|
|
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
|
-
|
|
134
|
-
/**
|
|
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')
|
|
141
|
-
*/
|
|
142
|
-
export interface Delay {
|
|
143
|
-
/**
|
|
144
|
-
* The duration of the delay in milliseconds.
|
|
145
|
-
*/
|
|
146
|
-
duration?: number | null;
|
|
147
|
-
|
|
148
|
-
/**
|
|
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')
|
|
153
|
-
*/
|
|
154
|
-
until?: string | null;
|
|
155
|
-
}
|
|
156
|
-
|
|
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
|
-
/**
|
|
164
|
-
* A duration in the form of milliseconds or an ISO8601 Duration format (i.e.
|
|
165
|
-
* P1DT4H).
|
|
166
|
-
*/
|
|
167
|
-
expires_in: string | number;
|
|
168
|
-
|
|
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
|
-
}
|
|
175
|
-
|
|
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;
|
|
186
|
-
|
|
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;
|
|
193
|
-
|
|
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;
|
|
199
|
-
|
|
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
|
-
}
|
|
214
|
-
|
|
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;
|
|
222
|
-
|
|
223
|
-
metadata?: Providers.Metadata | null;
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Provider specific overrides.
|
|
227
|
-
*/
|
|
228
|
-
override?: { [key: string]: unknown } | null;
|
|
229
|
-
|
|
230
|
-
timeouts?: number | null;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export namespace Providers {
|
|
234
|
-
export interface Metadata {
|
|
235
|
-
utm?: SendAPI.Utm | null;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
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
|
-
/**
|
|
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.
|
|
249
|
-
*/
|
|
250
|
-
channels: Array<Routing.RoutingStrategyChannel | Routing.RoutingStrategyProvider | string>;
|
|
251
|
-
|
|
252
|
-
method: SendAPI.RoutingMethod;
|
|
253
|
-
}
|
|
254
|
-
|
|
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 {
|
|
361
|
-
/**
|
|
362
|
-
* Send to users only if they are member of the account
|
|
363
|
-
*/
|
|
364
|
-
operator: 'MEMBER_OF';
|
|
365
|
-
|
|
366
|
-
path: 'account_id';
|
|
367
|
-
|
|
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
|
-
/**
|
|
383
|
-
* Send to users only if they are member of the account
|
|
384
|
-
*/
|
|
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
|
-
}
|
|
472
|
-
|
|
473
|
-
export namespace WebhookRecipient {
|
|
474
|
-
export interface Webhook {
|
|
475
|
-
/**
|
|
476
|
-
* The URL to send the webhook request to.
|
|
477
|
-
*/
|
|
478
|
-
url: string;
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Authentication configuration for the webhook request.
|
|
482
|
-
*/
|
|
483
|
-
authentication?: Webhook.Authentication | null;
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Custom headers to include in the webhook request.
|
|
487
|
-
*/
|
|
488
|
-
headers?: { [key: string]: string } | null;
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* The HTTP method to use for the webhook request. Defaults to POST if not
|
|
492
|
-
* specified.
|
|
493
|
-
*/
|
|
494
|
-
method?: 'POST' | 'PUT' | null;
|
|
495
|
-
|
|
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;
|
|
501
|
-
}
|
|
502
|
-
|
|
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;
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Password for basic authentication.
|
|
520
|
-
*/
|
|
521
|
-
password?: string | null;
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Username for basic authentication.
|
|
525
|
-
*/
|
|
526
|
-
username?: string | null;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
31
|
/**
|
|
533
|
-
*
|
|
32
|
+
* The channel element allows a notification to be customized based on which
|
|
33
|
+
* channel it is sent through. For example, you may want to display a detailed
|
|
34
|
+
* message when the notification is sent through email, and a more concise message
|
|
35
|
+
* in a push notification. Channel elements are only valid as top-level elements;
|
|
36
|
+
* you cannot nest channel elements. If there is a channel element specified at the
|
|
37
|
+
* top-level of the document, all sibling elements must be channel elements. Note:
|
|
38
|
+
* As an alternative, most elements support a `channel` property. Which allows you
|
|
39
|
+
* to selectively display an individual element on a per channel basis. See the
|
|
40
|
+
* [control flow docs](https://www.courier.com/docs/platform/content/elemental/control-flow/)
|
|
41
|
+
* for more details.
|
|
534
42
|
*/
|
|
535
|
-
export
|
|
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 {
|
|
43
|
+
export interface ElementalChannelNode extends Shared.ElementalBaseNode {
|
|
566
44
|
/**
|
|
567
45
|
* The channel the contents of this element should be applied to. Can be `email`,
|
|
568
46
|
* `push`, `direct_message`, `sms` or a provider such as slack
|
|
569
47
|
*/
|
|
570
48
|
channel: string;
|
|
571
49
|
|
|
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
50
|
/**
|
|
585
51
|
* Raw data to apply to the channel. If `elements` has not been specified, `raw` is
|
|
586
52
|
* `required`.
|
|
587
53
|
*/
|
|
588
54
|
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
55
|
}
|
|
607
56
|
|
|
608
57
|
/**
|
|
@@ -624,31 +73,14 @@ export type ElementalNode =
|
|
|
624
73
|
| ElementalNode.UnionMember3
|
|
625
74
|
| ElementalNode.UnionMember4
|
|
626
75
|
| ElementalNode.UnionMember5
|
|
627
|
-
| ElementalNode.UnionMember6
|
|
628
|
-
| ElementalNode.UnionMember7;
|
|
76
|
+
| ElementalNode.UnionMember6;
|
|
629
77
|
|
|
630
78
|
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
|
-
|
|
79
|
+
export interface UnionMember0 extends Shared.ElementalBaseNode {
|
|
640
80
|
type?: 'text';
|
|
641
81
|
}
|
|
642
82
|
|
|
643
|
-
export interface UnionMember1 {
|
|
644
|
-
channels?: Array<string> | null;
|
|
645
|
-
|
|
646
|
-
if?: string | null;
|
|
647
|
-
|
|
648
|
-
loop?: string | null;
|
|
649
|
-
|
|
650
|
-
ref?: string | null;
|
|
651
|
-
|
|
83
|
+
export interface UnionMember1 extends Shared.ElementalBaseNode {
|
|
652
84
|
type?: 'meta';
|
|
653
85
|
}
|
|
654
86
|
|
|
@@ -668,369 +100,333 @@ export namespace ElementalNode {
|
|
|
668
100
|
type?: 'channel';
|
|
669
101
|
}
|
|
670
102
|
|
|
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
|
-
|
|
103
|
+
export interface UnionMember3 extends Shared.ElementalBaseNode {
|
|
680
104
|
type?: 'image';
|
|
681
105
|
}
|
|
682
106
|
|
|
683
107
|
export interface UnionMember4 {
|
|
684
|
-
|
|
108
|
+
/**
|
|
109
|
+
* A unique id used to identify the action when it is executed.
|
|
110
|
+
*/
|
|
111
|
+
action_id?: string | null;
|
|
685
112
|
|
|
686
|
-
|
|
113
|
+
/**
|
|
114
|
+
* The alignment of the action button. Defaults to "center".
|
|
115
|
+
*/
|
|
116
|
+
align?: Shared.Alignment | null;
|
|
687
117
|
|
|
688
|
-
|
|
118
|
+
/**
|
|
119
|
+
* The background color of the action button.
|
|
120
|
+
*/
|
|
121
|
+
background_color?: string | null;
|
|
689
122
|
|
|
690
|
-
|
|
123
|
+
/**
|
|
124
|
+
* The text content of the action shown to the user.
|
|
125
|
+
*/
|
|
126
|
+
content?: string;
|
|
691
127
|
|
|
692
|
-
|
|
693
|
-
|
|
128
|
+
/**
|
|
129
|
+
* The target URL of the action.
|
|
130
|
+
*/
|
|
131
|
+
href?: string;
|
|
694
132
|
|
|
695
|
-
|
|
696
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Region specific content. See
|
|
135
|
+
* [locales docs](https://www.courier.com/docs/platform/content/elemental/locales/)
|
|
136
|
+
* for more details.
|
|
137
|
+
*/
|
|
138
|
+
locales?: { [key: string]: UnionMember4.Locales } | null;
|
|
697
139
|
|
|
698
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Defaults to `button`.
|
|
142
|
+
*/
|
|
143
|
+
style?: 'button' | 'link' | null;
|
|
699
144
|
|
|
700
|
-
|
|
145
|
+
type?: 'action';
|
|
146
|
+
}
|
|
701
147
|
|
|
702
|
-
|
|
148
|
+
export namespace UnionMember4 {
|
|
149
|
+
export interface Locales {
|
|
150
|
+
content: string;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
703
153
|
|
|
154
|
+
export interface UnionMember5 extends Shared.ElementalBaseNode {
|
|
704
155
|
type?: 'divider';
|
|
705
156
|
}
|
|
706
157
|
|
|
158
|
+
export interface UnionMember6 extends Shared.ElementalBaseNode {
|
|
159
|
+
type?: 'quote';
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface MessageContext {
|
|
707
164
|
/**
|
|
708
|
-
*
|
|
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.
|
|
165
|
+
* Tenant id used to load brand/default preferences/context.
|
|
712
166
|
*/
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
167
|
+
tenant_id?: string | null;
|
|
168
|
+
}
|
|
716
169
|
|
|
717
|
-
|
|
718
|
-
|
|
170
|
+
export interface Recipient {
|
|
171
|
+
/**
|
|
172
|
+
* Use `tenant_id` instead.
|
|
173
|
+
*/
|
|
174
|
+
account_id?: string | null;
|
|
719
175
|
|
|
720
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Context such as tenant_id to send the notification with.
|
|
178
|
+
*/
|
|
179
|
+
context?: MessageContext | null;
|
|
721
180
|
|
|
722
|
-
|
|
181
|
+
data?: { [key: string]: unknown } | null;
|
|
723
182
|
|
|
724
|
-
|
|
183
|
+
email?: string | null;
|
|
725
184
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
185
|
+
/**
|
|
186
|
+
* The user's preferred ISO 639-1 language code.
|
|
187
|
+
*/
|
|
188
|
+
locale?: string | null;
|
|
729
189
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
*/
|
|
734
|
-
export type Message = Message.ContentMessage | Message.TemplateMessage;
|
|
190
|
+
phone_number?: string | null;
|
|
191
|
+
|
|
192
|
+
preferences?: Recipient.Preferences | null;
|
|
735
193
|
|
|
736
|
-
export namespace Message {
|
|
737
194
|
/**
|
|
738
|
-
*
|
|
739
|
-
* chat, or any channel.
|
|
195
|
+
* Tenant id. Will load brand, default preferences and base context data.
|
|
740
196
|
*/
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
197
|
+
tenant_id?: string | null;
|
|
198
|
+
|
|
199
|
+
user_id?: string | null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export namespace Recipient {
|
|
203
|
+
export interface Preferences {
|
|
204
|
+
notifications: { [key: string]: Shared.Preference };
|
|
205
|
+
|
|
206
|
+
categories?: { [key: string]: Shared.Preference } | null;
|
|
207
|
+
|
|
208
|
+
templateId?: string | null;
|
|
747
209
|
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface Utm {
|
|
213
|
+
campaign?: string | null;
|
|
214
|
+
|
|
215
|
+
content?: string | null;
|
|
216
|
+
|
|
217
|
+
medium?: string | null;
|
|
218
|
+
|
|
219
|
+
source?: string | null;
|
|
748
220
|
|
|
221
|
+
term?: string | null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface SendMessageResponse {
|
|
749
225
|
/**
|
|
750
|
-
* A
|
|
751
|
-
*
|
|
752
|
-
*
|
|
226
|
+
* A successful call to `POST /send` returns a `202` status code along with a
|
|
227
|
+
* `requestId` in the response body. For single-recipient requests, the `requestId`
|
|
228
|
+
* is the derived message_id. For multiple recipients, Courier assigns a unique
|
|
229
|
+
* message_id to each derived message.
|
|
753
230
|
*/
|
|
754
|
-
|
|
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
|
-
}
|
|
231
|
+
requestId: string;
|
|
761
232
|
}
|
|
762
233
|
|
|
763
|
-
export interface
|
|
234
|
+
export interface SendMessageParams {
|
|
764
235
|
/**
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* brand, default preferences and any other base context data associated with this
|
|
768
|
-
* tenant.
|
|
236
|
+
* The message property has the following primary top-level properties. They define
|
|
237
|
+
* the destination and content of the message.
|
|
769
238
|
*/
|
|
770
|
-
|
|
239
|
+
message: SendMessageParams.Message;
|
|
771
240
|
}
|
|
772
241
|
|
|
773
|
-
export
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
242
|
+
export namespace SendMessageParams {
|
|
243
|
+
/**
|
|
244
|
+
* The message property has the following primary top-level properties. They define
|
|
245
|
+
* the destination and content of the message.
|
|
246
|
+
*/
|
|
247
|
+
export interface Message {
|
|
248
|
+
brand_id?: string | null;
|
|
778
249
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
| Recipient.SlackRecipient
|
|
785
|
-
| Recipient.MsTeamsRecipient
|
|
786
|
-
| { [key: string]: unknown }
|
|
787
|
-
| Recipient.PagerdutyRecipient
|
|
788
|
-
| Recipient.WebhookRecipient;
|
|
250
|
+
/**
|
|
251
|
+
* Define run-time configuration for channels. Valid ChannelId's: email, sms, push,
|
|
252
|
+
* inbox, direct_message, banner, webhook.
|
|
253
|
+
*/
|
|
254
|
+
channels?: { [key: string]: Message.Channels } | null;
|
|
789
255
|
|
|
790
|
-
export namespace Recipient {
|
|
791
|
-
export interface AudienceRecipient {
|
|
792
256
|
/**
|
|
793
|
-
*
|
|
794
|
-
*
|
|
257
|
+
* Describes content that will work for email, inbox, push, chat, or any channel
|
|
258
|
+
* id.
|
|
795
259
|
*/
|
|
796
|
-
|
|
260
|
+
content?: Shared.ElementalContentSugar | TemplatesAPI.ElementalContent;
|
|
261
|
+
|
|
262
|
+
context?: SendAPI.MessageContext | null;
|
|
797
263
|
|
|
798
264
|
data?: { [key: string]: unknown } | null;
|
|
799
265
|
|
|
800
|
-
|
|
801
|
-
}
|
|
266
|
+
delay?: Message.Delay | null;
|
|
802
267
|
|
|
803
|
-
|
|
804
|
-
export interface Filter {
|
|
805
|
-
/**
|
|
806
|
-
* Send to users only if they are member of the account
|
|
807
|
-
*/
|
|
808
|
-
operator: 'MEMBER_OF';
|
|
268
|
+
expiry?: Message.Expiry | null;
|
|
809
269
|
|
|
810
|
-
|
|
270
|
+
metadata?: Message.Metadata | null;
|
|
811
271
|
|
|
812
|
-
|
|
813
|
-
}
|
|
814
|
-
}
|
|
272
|
+
preferences?: Message.Preferences | null;
|
|
815
273
|
|
|
816
|
-
|
|
817
|
-
|
|
274
|
+
providers?: { [key: string]: Message.Providers } | null;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Customize which channels/providers Courier may deliver the message through.
|
|
278
|
+
*/
|
|
279
|
+
routing?: Message.Routing | null;
|
|
818
280
|
|
|
819
|
-
|
|
281
|
+
timeout?: Message.Timeout | null;
|
|
820
282
|
|
|
821
|
-
|
|
283
|
+
/**
|
|
284
|
+
* The recipient or a list of recipients of the message
|
|
285
|
+
*/
|
|
286
|
+
to?: BulkAPI.UserRecipient | Array<SendAPI.Recipient> | null;
|
|
822
287
|
}
|
|
823
288
|
|
|
824
|
-
export namespace
|
|
825
|
-
export interface
|
|
289
|
+
export namespace Message {
|
|
290
|
+
export interface Channels {
|
|
826
291
|
/**
|
|
827
|
-
*
|
|
292
|
+
* Brand id used for rendering.
|
|
828
293
|
*/
|
|
829
|
-
|
|
294
|
+
brand_id?: string | null;
|
|
830
295
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
export interface UnionMember2 {
|
|
838
|
-
data?: { [key: string]: unknown } | null;
|
|
296
|
+
/**
|
|
297
|
+
* JS conditional with access to data/profile.
|
|
298
|
+
*/
|
|
299
|
+
if?: string | null;
|
|
839
300
|
|
|
840
|
-
|
|
841
|
-
}
|
|
301
|
+
metadata?: Channels.Metadata | null;
|
|
842
302
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
|
847
|
-
| SlackRecipient.SendToSlackUserID;
|
|
848
|
-
}
|
|
303
|
+
/**
|
|
304
|
+
* Channel specific overrides.
|
|
305
|
+
*/
|
|
306
|
+
override?: { [key: string]: unknown } | null;
|
|
849
307
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Providers enabled for this channel.
|
|
310
|
+
*/
|
|
311
|
+
providers?: Array<string> | null;
|
|
854
312
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Defaults to `single`.
|
|
315
|
+
*/
|
|
316
|
+
routing_method?: 'all' | 'single' | null;
|
|
858
317
|
|
|
859
|
-
|
|
860
|
-
user_id: string;
|
|
318
|
+
timeouts?: Channels.Timeouts | null;
|
|
861
319
|
}
|
|
862
|
-
}
|
|
863
320
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
| MsTeamsRecipient.SendToMsTeamsChannelID
|
|
869
|
-
| MsTeamsRecipient.SendToMsTeamsConversationID
|
|
870
|
-
| MsTeamsRecipient.SendToMsTeamsChannelName;
|
|
871
|
-
}
|
|
321
|
+
export namespace Channels {
|
|
322
|
+
export interface Metadata {
|
|
323
|
+
utm?: SendAPI.Utm | null;
|
|
324
|
+
}
|
|
872
325
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
user_id: string;
|
|
876
|
-
}
|
|
326
|
+
export interface Timeouts {
|
|
327
|
+
channel?: number | null;
|
|
877
328
|
|
|
878
|
-
|
|
879
|
-
|
|
329
|
+
provider?: number | null;
|
|
330
|
+
}
|
|
880
331
|
}
|
|
881
332
|
|
|
882
|
-
export interface
|
|
883
|
-
|
|
884
|
-
|
|
333
|
+
export interface Delay {
|
|
334
|
+
/**
|
|
335
|
+
* The duration of the delay in milliseconds.
|
|
336
|
+
*/
|
|
337
|
+
duration?: number | null;
|
|
885
338
|
|
|
886
|
-
|
|
887
|
-
|
|
339
|
+
/**
|
|
340
|
+
* ISO 8601 timestamp or opening_hours-like format.
|
|
341
|
+
*/
|
|
342
|
+
until?: string | null;
|
|
888
343
|
}
|
|
889
344
|
|
|
890
|
-
export interface
|
|
891
|
-
|
|
345
|
+
export interface Expiry {
|
|
346
|
+
/**
|
|
347
|
+
* Duration in ms or ISO8601 duration (e.g. P1DT4H).
|
|
348
|
+
*/
|
|
349
|
+
expires_in: string | number;
|
|
892
350
|
|
|
893
|
-
|
|
351
|
+
/**
|
|
352
|
+
* Epoch or ISO8601 timestamp with timezone.
|
|
353
|
+
*/
|
|
354
|
+
expires_at?: string | null;
|
|
894
355
|
}
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
export interface PagerdutyRecipient {
|
|
898
|
-
pagerduty: PagerdutyRecipient.Pagerduty;
|
|
899
|
-
}
|
|
900
356
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
event_action?: string | null;
|
|
357
|
+
export interface Metadata {
|
|
358
|
+
event?: string | null;
|
|
904
359
|
|
|
905
|
-
|
|
360
|
+
tags?: Array<string> | null;
|
|
906
361
|
|
|
907
|
-
|
|
362
|
+
trace_id?: string | null;
|
|
908
363
|
|
|
909
|
-
|
|
364
|
+
utm?: SendAPI.Utm | null;
|
|
910
365
|
}
|
|
911
|
-
}
|
|
912
366
|
|
|
913
|
-
|
|
914
|
-
webhook: WebhookRecipient.Webhook;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
export namespace WebhookRecipient {
|
|
918
|
-
export interface Webhook {
|
|
367
|
+
export interface Preferences {
|
|
919
368
|
/**
|
|
920
|
-
* The
|
|
369
|
+
* The subscription topic to apply to the message.
|
|
921
370
|
*/
|
|
922
|
-
|
|
371
|
+
subscription_topic_id: string;
|
|
372
|
+
}
|
|
923
373
|
|
|
374
|
+
export interface Providers {
|
|
924
375
|
/**
|
|
925
|
-
*
|
|
376
|
+
* JS conditional with access to data/profile.
|
|
926
377
|
*/
|
|
927
|
-
|
|
378
|
+
if?: string | null;
|
|
928
379
|
|
|
929
|
-
|
|
930
|
-
* Custom headers to include in the webhook request.
|
|
931
|
-
*/
|
|
932
|
-
headers?: { [key: string]: string } | null;
|
|
380
|
+
metadata?: Providers.Metadata | null;
|
|
933
381
|
|
|
934
382
|
/**
|
|
935
|
-
*
|
|
936
|
-
* specified.
|
|
383
|
+
* Provider-specific overrides.
|
|
937
384
|
*/
|
|
938
|
-
|
|
385
|
+
override?: { [key: string]: unknown } | null;
|
|
939
386
|
|
|
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;
|
|
387
|
+
timeouts?: number | null;
|
|
945
388
|
}
|
|
946
389
|
|
|
947
|
-
export namespace
|
|
948
|
-
|
|
949
|
-
|
|
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;
|
|
390
|
+
export namespace Providers {
|
|
391
|
+
export interface Metadata {
|
|
392
|
+
utm?: SendAPI.Utm | null;
|
|
971
393
|
}
|
|
972
394
|
}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
395
|
|
|
976
|
-
|
|
396
|
+
/**
|
|
397
|
+
* Customize which channels/providers Courier may deliver the message through.
|
|
398
|
+
*/
|
|
399
|
+
export interface Routing {
|
|
400
|
+
/**
|
|
401
|
+
* A list of channels or providers (or nested routing rules).
|
|
402
|
+
*/
|
|
403
|
+
channels: Array<Shared.MessageRoutingChannel>;
|
|
977
404
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
}
|
|
405
|
+
method: 'all' | 'single';
|
|
406
|
+
}
|
|
981
407
|
|
|
982
|
-
export interface
|
|
983
|
-
|
|
408
|
+
export interface Timeout {
|
|
409
|
+
channel?: { [key: string]: number } | null;
|
|
984
410
|
|
|
985
|
-
|
|
411
|
+
criteria?: 'no-escalation' | 'delivered' | 'viewed' | 'engaged' | null;
|
|
986
412
|
|
|
987
|
-
|
|
413
|
+
escalation?: number | null;
|
|
988
414
|
|
|
989
|
-
|
|
415
|
+
message?: number | null;
|
|
990
416
|
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
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
|
-
}
|
|
1010
|
-
|
|
1011
|
-
export interface SendSendMessageParams {
|
|
1012
|
-
/**
|
|
1013
|
-
* Defines the message to be delivered
|
|
1014
|
-
*/
|
|
1015
|
-
message: Message;
|
|
417
|
+
provider?: { [key: string]: number } | null;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
1016
420
|
}
|
|
1017
421
|
|
|
1018
422
|
export declare namespace Send {
|
|
1019
423
|
export {
|
|
1020
|
-
type BaseMessage as BaseMessage,
|
|
1021
|
-
type BaseMessageSendTo as BaseMessageSendTo,
|
|
1022
|
-
type Content as Content,
|
|
1023
424
|
type ElementalChannelNode as ElementalChannelNode,
|
|
1024
|
-
type ElementalGroupNode as ElementalGroupNode,
|
|
1025
425
|
type ElementalNode as ElementalNode,
|
|
1026
|
-
type Message as Message,
|
|
1027
426
|
type MessageContext as MessageContext,
|
|
1028
|
-
type MsTeamsBaseProperties as MsTeamsBaseProperties,
|
|
1029
427
|
type Recipient as Recipient,
|
|
1030
|
-
type RoutingMethod as RoutingMethod,
|
|
1031
|
-
type SlackBaseProperties as SlackBaseProperties,
|
|
1032
428
|
type Utm as Utm,
|
|
1033
|
-
type
|
|
1034
|
-
type
|
|
429
|
+
type SendMessageResponse as SendMessageResponse,
|
|
430
|
+
type SendMessageParams as SendMessageParams,
|
|
1035
431
|
};
|
|
1036
432
|
}
|