@trycourier/courier 7.24.0 → 7.25.1
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 +22 -0
- package/README.md +0 -3
- package/client.d.mts +5 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -2
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/audiences.d.mts +46 -0
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +46 -0
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audiences.js +46 -0
- package/resources/audiences.js.map +1 -1
- package/resources/audiences.mjs +46 -0
- package/resources/audiences.mjs.map +1 -1
- package/resources/automations/invoke.d.mts +5 -1
- package/resources/automations/invoke.d.mts.map +1 -1
- package/resources/automations/invoke.d.ts +5 -1
- package/resources/automations/invoke.d.ts.map +1 -1
- package/resources/automations/invoke.js +5 -1
- package/resources/automations/invoke.js.map +1 -1
- package/resources/automations/invoke.mjs +5 -1
- package/resources/automations/invoke.mjs.map +1 -1
- package/resources/brands.d.mts +4 -1
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +4 -1
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.js +4 -1
- package/resources/brands.js.map +1 -1
- package/resources/brands.mjs +4 -1
- package/resources/brands.mjs.map +1 -1
- package/resources/bulk.d.mts +194 -0
- package/resources/bulk.d.mts.map +1 -0
- package/resources/bulk.d.ts +194 -0
- package/resources/bulk.d.ts.map +1 -0
- package/resources/bulk.js +97 -0
- package/resources/bulk.js.map +1 -0
- package/resources/bulk.mjs +93 -0
- package/resources/bulk.mjs.map +1 -0
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/lists/lists.d.mts +3 -1
- package/resources/lists/lists.d.mts.map +1 -1
- package/resources/lists/lists.d.ts +3 -1
- package/resources/lists/lists.d.ts.map +1 -1
- package/resources/lists/lists.js +3 -1
- package/resources/lists/lists.js.map +1 -1
- package/resources/lists/lists.mjs +3 -1
- package/resources/lists/lists.mjs.map +1 -1
- package/resources/lists/subscriptions.d.mts +13 -2
- package/resources/lists/subscriptions.d.mts.map +1 -1
- package/resources/lists/subscriptions.d.ts +13 -2
- package/resources/lists/subscriptions.d.ts.map +1 -1
- package/resources/lists/subscriptions.js +13 -2
- package/resources/lists/subscriptions.js.map +1 -1
- package/resources/lists/subscriptions.mjs +13 -2
- package/resources/lists/subscriptions.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +2 -2
- package/resources/notifications/checks.d.ts +2 -2
- package/resources/notifications/checks.js +2 -2
- package/resources/notifications/checks.mjs +2 -2
- 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 +48 -14
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +48 -14
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +1 -0
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +1 -0
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/profiles/lists.d.mts +1 -1
- package/resources/profiles/lists.d.ts +1 -1
- package/resources/profiles/lists.js +1 -1
- package/resources/profiles/lists.mjs +1 -1
- package/resources/profiles/profiles.d.mts +12 -5
- package/resources/profiles/profiles.d.mts.map +1 -1
- package/resources/profiles/profiles.d.ts +12 -5
- package/resources/profiles/profiles.d.ts.map +1 -1
- package/resources/profiles/profiles.js +12 -5
- package/resources/profiles/profiles.js.map +1 -1
- package/resources/profiles/profiles.mjs +12 -5
- package/resources/profiles/profiles.mjs.map +1 -1
- package/resources/providers/providers.d.mts +6 -2
- package/resources/providers/providers.d.mts.map +1 -1
- package/resources/providers/providers.d.ts +6 -2
- package/resources/providers/providers.d.ts.map +1 -1
- package/resources/providers/providers.js +6 -2
- package/resources/providers/providers.js.map +1 -1
- package/resources/providers/providers.mjs +6 -2
- package/resources/providers/providers.mjs.map +1 -1
- package/resources/send.d.mts +2 -1
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +2 -1
- package/resources/send.d.ts.map +1 -1
- package/resources/send.js +2 -1
- package/resources/send.js.map +1 -1
- package/resources/send.mjs +2 -1
- package/resources/send.mjs.map +1 -1
- package/resources/shared.d.mts +16 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +16 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/tenants/templates/templates.d.mts +7 -1
- package/resources/tenants/templates/templates.d.mts.map +1 -1
- package/resources/tenants/templates/templates.d.ts +7 -1
- package/resources/tenants/templates/templates.d.ts.map +1 -1
- package/resources/tenants/templates/templates.js +7 -1
- package/resources/tenants/templates/templates.js.map +1 -1
- package/resources/tenants/templates/templates.mjs +7 -1
- package/resources/tenants/templates/templates.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +3 -1
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +3 -1
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +3 -1
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +3 -1
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/translations.d.mts +16 -0
- package/resources/translations.d.mts.map +1 -1
- package/resources/translations.d.ts +16 -0
- package/resources/translations.d.ts.map +1 -1
- package/resources/translations.js +16 -0
- package/resources/translations.js.map +1 -1
- package/resources/translations.mjs +16 -0
- package/resources/translations.mjs.map +1 -1
- package/resources/users/tenants.d.mts +5 -1
- package/resources/users/tenants.d.mts.map +1 -1
- package/resources/users/tenants.d.ts +5 -1
- package/resources/users/tenants.d.ts.map +1 -1
- package/resources/users/tenants.js +5 -1
- package/resources/users/tenants.js.map +1 -1
- package/resources/users/tenants.mjs +5 -1
- package/resources/users/tenants.mjs.map +1 -1
- package/resources/users/tokens.d.mts +8 -1
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts +8 -1
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.js +8 -1
- package/resources/users/tokens.js.map +1 -1
- package/resources/users/tokens.mjs +8 -1
- package/resources/users/tokens.mjs.map +1 -1
- package/resources/workspace-preferences/topics.d.mts +5 -2
- package/resources/workspace-preferences/topics.d.mts.map +1 -1
- package/resources/workspace-preferences/topics.d.ts +5 -2
- package/resources/workspace-preferences/topics.d.ts.map +1 -1
- package/resources/workspace-preferences/topics.js +5 -2
- package/resources/workspace-preferences/topics.js.map +1 -1
- package/resources/workspace-preferences/topics.mjs +5 -2
- package/resources/workspace-preferences/topics.mjs.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.d.mts +8 -2
- package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.d.ts +8 -2
- package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.js +8 -2
- package/resources/workspace-preferences/workspace-preferences.js.map +1 -1
- package/resources/workspace-preferences/workspace-preferences.mjs +8 -2
- package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -1
- package/src/client.ts +29 -0
- package/src/resources/audiences.ts +46 -0
- package/src/resources/automations/invoke.ts +5 -1
- package/src/resources/brands.ts +4 -1
- package/src/resources/bulk.ts +249 -0
- package/src/resources/index.ts +13 -0
- package/src/resources/lists/lists.ts +3 -1
- package/src/resources/lists/subscriptions.ts +13 -2
- package/src/resources/notifications/checks.ts +2 -2
- package/src/resources/notifications/index.ts +2 -0
- package/src/resources/notifications/notifications.ts +52 -13
- package/src/resources/profiles/lists.ts +1 -1
- package/src/resources/profiles/profiles.ts +12 -5
- package/src/resources/providers/providers.ts +6 -2
- package/src/resources/send.ts +2 -1
- package/src/resources/shared.ts +19 -0
- package/src/resources/tenants/templates/templates.ts +7 -1
- package/src/resources/tenants/tenants.ts +3 -1
- package/src/resources/translations.ts +16 -0
- package/src/resources/users/tenants.ts +5 -1
- package/src/resources/users/tokens.ts +8 -1
- package/src/resources/workspace-preferences/topics.ts +5 -2
- package/src/resources/workspace-preferences/workspace-preferences.ts +8 -2
- 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
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import * as BulkAPI from './bulk';
|
|
5
|
+
import * as Shared from './shared';
|
|
6
|
+
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { buildHeaders } from '../internal/headers';
|
|
8
|
+
import { RequestOptions } from '../internal/request-options';
|
|
9
|
+
import { path } from '../internal/utils/path';
|
|
10
|
+
|
|
11
|
+
export class Bulk extends APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Ingest user data into a Bulk Job.
|
|
14
|
+
*
|
|
15
|
+
* **Important**: For email-based bulk jobs, each user must include `profile.email`
|
|
16
|
+
* for provider routing to work correctly. The `to.email` field is not sufficient
|
|
17
|
+
* for email provider routing.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* await client.bulk.addUsers('job_id', {
|
|
22
|
+
* users: [
|
|
23
|
+
* {
|
|
24
|
+
* recipient: 'user_abc',
|
|
25
|
+
* profile: { email: 'jdoe@example.com' },
|
|
26
|
+
* data: { name: 'Jane' },
|
|
27
|
+
* },
|
|
28
|
+
* ],
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
addUsers(jobID: string, body: BulkAddUsersParams, options?: RequestOptions): APIPromise<void> {
|
|
33
|
+
return this._client.post(path`/bulk/${jobID}`, {
|
|
34
|
+
body,
|
|
35
|
+
...options,
|
|
36
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new bulk job for sending messages to multiple recipients.
|
|
42
|
+
*
|
|
43
|
+
* **Required**: `message.event` (event ID or notification ID)
|
|
44
|
+
*
|
|
45
|
+
* **Optional (V2 format)**: `message.template` (notification ID) or
|
|
46
|
+
* `message.content` (Elemental content) can be provided to override the
|
|
47
|
+
* notification associated with the event.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const response = await client.bulk.createJob({
|
|
52
|
+
* message: {
|
|
53
|
+
* event: 'welcome-series',
|
|
54
|
+
* brand: 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag',
|
|
55
|
+
* data: { campaign: 'spring-2024' },
|
|
56
|
+
* },
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
createJob(body: BulkCreateJobParams, options?: RequestOptions): APIPromise<BulkCreateJobResponse> {
|
|
61
|
+
return this._client.post('/bulk', { body, ...options });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get Bulk Job Users
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const response = await client.bulk.listUsers('job_id');
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
listUsers(
|
|
73
|
+
jobID: string,
|
|
74
|
+
query: BulkListUsersParams | null | undefined = {},
|
|
75
|
+
options?: RequestOptions,
|
|
76
|
+
): APIPromise<BulkListUsersResponse> {
|
|
77
|
+
return this._client.get(path`/bulk/${jobID}/users`, { query, ...options });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get a bulk job
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const response = await client.bulk.retrieveJob('job_id');
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
retrieveJob(jobID: string, options?: RequestOptions): APIPromise<BulkRetrieveJobResponse> {
|
|
89
|
+
return this._client.get(path`/bulk/${jobID}`, options);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Run a bulk job
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* await client.bulk.runJob('job_id');
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
runJob(jobID: string, options?: RequestOptions): APIPromise<void> {
|
|
101
|
+
return this._client.post(path`/bulk/${jobID}/run`, {
|
|
102
|
+
...options,
|
|
103
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Bulk message definition. Supports two formats:
|
|
110
|
+
*
|
|
111
|
+
* - V1 format: Requires `event` field (event ID or notification ID)
|
|
112
|
+
* - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
|
|
113
|
+
* content) in addition to `event`
|
|
114
|
+
*/
|
|
115
|
+
export interface InboundBulkMessage {
|
|
116
|
+
/**
|
|
117
|
+
* Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
|
|
118
|
+
* "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
|
|
119
|
+
* mapped to a notification.
|
|
120
|
+
*/
|
|
121
|
+
event: string;
|
|
122
|
+
|
|
123
|
+
brand?: string | null;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Elemental content (optional, for V2 format). When provided, this will be used
|
|
127
|
+
* instead of the notification associated with the `event` field.
|
|
128
|
+
*/
|
|
129
|
+
content?: Shared.ElementalContentSugar | Shared.ElementalContent | null;
|
|
130
|
+
|
|
131
|
+
data?: { [key: string]: unknown } | null;
|
|
132
|
+
|
|
133
|
+
locale?: { [key: string]: { [key: string]: unknown } } | null;
|
|
134
|
+
|
|
135
|
+
override?: { [key: string]: unknown } | null;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Notification ID or template ID (optional, for V2 format). When provided, this
|
|
139
|
+
* will be used instead of the notification associated with the `event` field.
|
|
140
|
+
*/
|
|
141
|
+
template?: string | null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface InboundBulkMessageUser {
|
|
145
|
+
/**
|
|
146
|
+
* User-specific data that will be merged with message.data
|
|
147
|
+
*/
|
|
148
|
+
data?: unknown;
|
|
149
|
+
|
|
150
|
+
preferences?: Shared.RecipientPreferences | null;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* User profile information. For email-based bulk jobs, `profile.email` is required
|
|
154
|
+
* for provider routing to determine if the message can be delivered. The email
|
|
155
|
+
* address should be provided here rather than in `to.email`.
|
|
156
|
+
*/
|
|
157
|
+
profile?: { [key: string]: unknown } | null;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* User ID (legacy field, use profile or to.user_id instead)
|
|
161
|
+
*/
|
|
162
|
+
recipient?: string | null;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Optional recipient information. Note: For email provider routing, use
|
|
166
|
+
* `profile.email` instead of `to.email`. The `to` field is primarily used for
|
|
167
|
+
* recipient identification and data merging.
|
|
168
|
+
*/
|
|
169
|
+
to?: Shared.UserRecipient | null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface BulkCreateJobResponse {
|
|
173
|
+
jobId: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface BulkListUsersResponse {
|
|
177
|
+
items: Array<BulkListUsersResponse.Item>;
|
|
178
|
+
|
|
179
|
+
paging: Shared.Paging;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export namespace BulkListUsersResponse {
|
|
183
|
+
export interface Item extends BulkAPI.InboundBulkMessageUser {
|
|
184
|
+
status: 'PENDING' | 'ENQUEUED' | 'ERROR';
|
|
185
|
+
|
|
186
|
+
messageId?: string | null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface BulkRetrieveJobResponse {
|
|
191
|
+
job: BulkRetrieveJobResponse.Job;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export namespace BulkRetrieveJobResponse {
|
|
195
|
+
export interface Job {
|
|
196
|
+
/**
|
|
197
|
+
* Bulk message definition. Supports two formats:
|
|
198
|
+
*
|
|
199
|
+
* - V1 format: Requires `event` field (event ID or notification ID)
|
|
200
|
+
* - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
|
|
201
|
+
* content) in addition to `event`
|
|
202
|
+
*/
|
|
203
|
+
definition: BulkAPI.InboundBulkMessage;
|
|
204
|
+
|
|
205
|
+
enqueued: number;
|
|
206
|
+
|
|
207
|
+
failures: number;
|
|
208
|
+
|
|
209
|
+
received: number;
|
|
210
|
+
|
|
211
|
+
status: 'CREATED' | 'PROCESSING' | 'COMPLETED' | 'ERROR';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface BulkAddUsersParams {
|
|
216
|
+
users: Array<InboundBulkMessageUser>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface BulkCreateJobParams {
|
|
220
|
+
/**
|
|
221
|
+
* Bulk message definition. Supports two formats:
|
|
222
|
+
*
|
|
223
|
+
* - V1 format: Requires `event` field (event ID or notification ID)
|
|
224
|
+
* - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
|
|
225
|
+
* content) in addition to `event`
|
|
226
|
+
*/
|
|
227
|
+
message: InboundBulkMessage;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface BulkListUsersParams {
|
|
231
|
+
/**
|
|
232
|
+
* A unique identifier that allows for fetching the next set of users added to the
|
|
233
|
+
* bulk job
|
|
234
|
+
*/
|
|
235
|
+
cursor?: string | null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export declare namespace Bulk {
|
|
239
|
+
export {
|
|
240
|
+
type InboundBulkMessage as InboundBulkMessage,
|
|
241
|
+
type InboundBulkMessageUser as InboundBulkMessageUser,
|
|
242
|
+
type BulkCreateJobResponse as BulkCreateJobResponse,
|
|
243
|
+
type BulkListUsersResponse as BulkListUsersResponse,
|
|
244
|
+
type BulkRetrieveJobResponse as BulkRetrieveJobResponse,
|
|
245
|
+
type BulkAddUsersParams as BulkAddUsersParams,
|
|
246
|
+
type BulkCreateJobParams as BulkCreateJobParams,
|
|
247
|
+
type BulkListUsersParams as BulkListUsersParams,
|
|
248
|
+
};
|
|
249
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -63,6 +63,17 @@ export {
|
|
|
63
63
|
type BroadcastScheduleParams,
|
|
64
64
|
type BroadcastSendParams,
|
|
65
65
|
} from './broadcasts';
|
|
66
|
+
export {
|
|
67
|
+
Bulk,
|
|
68
|
+
type InboundBulkMessage,
|
|
69
|
+
type InboundBulkMessageUser,
|
|
70
|
+
type BulkCreateJobResponse,
|
|
71
|
+
type BulkListUsersResponse,
|
|
72
|
+
type BulkRetrieveJobResponse,
|
|
73
|
+
type BulkAddUsersParams,
|
|
74
|
+
type BulkCreateJobParams,
|
|
75
|
+
type BulkListUsersParams,
|
|
76
|
+
} from './bulk';
|
|
66
77
|
export {
|
|
67
78
|
Digests,
|
|
68
79
|
type DigestCategory,
|
|
@@ -148,6 +159,7 @@ export {
|
|
|
148
159
|
type NotificationElementPutRequest,
|
|
149
160
|
type NotificationGetContent,
|
|
150
161
|
type NotificationLocalePutRequest,
|
|
162
|
+
type NotificationTemplateAlias,
|
|
151
163
|
type NotificationTemplateCreateRequest,
|
|
152
164
|
type NotificationTemplatePayload,
|
|
153
165
|
type NotificationTemplatePublishRequest,
|
|
@@ -156,6 +168,7 @@ export {
|
|
|
156
168
|
type NotificationTemplateSummary,
|
|
157
169
|
type NotificationTemplateUpdateRequest,
|
|
158
170
|
type NotificationTemplateVersionListResponse,
|
|
171
|
+
type NotificationTemplateWritePayload,
|
|
159
172
|
type VersionNode,
|
|
160
173
|
type NotificationListResponse,
|
|
161
174
|
type NotificationRetrieveContentResponse,
|
|
@@ -44,7 +44,9 @@ export class Lists extends APIResource {
|
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```ts
|
|
47
|
-
* await client.lists.update('list_id', {
|
|
47
|
+
* await client.lists.update('list_id', {
|
|
48
|
+
* name: 'Product Updates',
|
|
49
|
+
* });
|
|
48
50
|
* ```
|
|
49
51
|
*/
|
|
50
52
|
update(listID: string, body: ListUpdateParams, options?: RequestOptions): APIPromise<void> {
|
|
@@ -38,7 +38,10 @@ export class Subscriptions extends APIResource {
|
|
|
38
38
|
* @example
|
|
39
39
|
* ```ts
|
|
40
40
|
* await client.lists.subscriptions.add('list_id', {
|
|
41
|
-
* recipients: [
|
|
41
|
+
* recipients: [
|
|
42
|
+
* { recipientId: 'user_abc' },
|
|
43
|
+
* { recipientId: 'user_def' },
|
|
44
|
+
* ],
|
|
42
45
|
* });
|
|
43
46
|
* ```
|
|
44
47
|
*/
|
|
@@ -71,7 +74,10 @@ export class Subscriptions extends APIResource {
|
|
|
71
74
|
* @example
|
|
72
75
|
* ```ts
|
|
73
76
|
* await client.lists.subscriptions.subscribe('list_id', {
|
|
74
|
-
* recipients: [
|
|
77
|
+
* recipients: [
|
|
78
|
+
* { recipientId: 'user_abc' },
|
|
79
|
+
* { recipientId: 'user_def' },
|
|
80
|
+
* ],
|
|
75
81
|
* });
|
|
76
82
|
* ```
|
|
77
83
|
*/
|
|
@@ -91,6 +97,11 @@ export class Subscriptions extends APIResource {
|
|
|
91
97
|
* ```ts
|
|
92
98
|
* await client.lists.subscriptions.subscribeUser('user_id', {
|
|
93
99
|
* list_id: 'list_id',
|
|
100
|
+
* preferences: {
|
|
101
|
+
* notifications: {
|
|
102
|
+
* nt_01kx4h2jdafq8bk9aftxak4b40: { status: 'OPTED_IN' },
|
|
103
|
+
* },
|
|
104
|
+
* },
|
|
94
105
|
* });
|
|
95
106
|
* ```
|
|
96
107
|
*/
|
|
@@ -19,6 +19,7 @@ export {
|
|
|
19
19
|
type NotificationElementPutRequest,
|
|
20
20
|
type NotificationGetContent,
|
|
21
21
|
type NotificationLocalePutRequest,
|
|
22
|
+
type NotificationTemplateAlias,
|
|
22
23
|
type NotificationTemplateCreateRequest,
|
|
23
24
|
type NotificationTemplatePayload,
|
|
24
25
|
type NotificationTemplatePublishRequest,
|
|
@@ -27,6 +28,7 @@ export {
|
|
|
27
28
|
type NotificationTemplateSummary,
|
|
28
29
|
type NotificationTemplateUpdateRequest,
|
|
29
30
|
type NotificationTemplateVersionListResponse,
|
|
31
|
+
type NotificationTemplateWritePayload,
|
|
30
32
|
type VersionNode,
|
|
31
33
|
type NotificationListResponse,
|
|
32
34
|
type NotificationRetrieveContentResponse,
|
|
@@ -44,6 +44,7 @@ export class Notifications extends APIResource {
|
|
|
44
44
|
* version: '2022-01-01',
|
|
45
45
|
* elements: [{ type: 'channel' }],
|
|
46
46
|
* },
|
|
47
|
+
* alias: 'welcome',
|
|
47
48
|
* },
|
|
48
49
|
* state: 'DRAFT',
|
|
49
50
|
* });
|
|
@@ -560,15 +561,24 @@ export namespace NotificationLocalePutRequest {
|
|
|
560
561
|
}
|
|
561
562
|
}
|
|
562
563
|
|
|
564
|
+
/**
|
|
565
|
+
* A template's send-time alias as returned by a read, omitted entirely when it has
|
|
566
|
+
* none. Usually a single string; an array for a template that resolves from
|
|
567
|
+
* several aliases, which writes through this API can no longer produce — only
|
|
568
|
+
* templates predating that restriction, or aliases attached outside this API, hold
|
|
569
|
+
* more than one.
|
|
570
|
+
*/
|
|
571
|
+
export type NotificationTemplateAlias = string | Array<string>;
|
|
572
|
+
|
|
563
573
|
/**
|
|
564
574
|
* Request body for creating a notification template.
|
|
565
575
|
*/
|
|
566
576
|
export interface NotificationTemplateCreateRequest {
|
|
567
577
|
/**
|
|
568
|
-
*
|
|
569
|
-
* `notification` key
|
|
578
|
+
* Template fields accepted in POST and PUT request bodies, nested under a
|
|
579
|
+
* `notification` key.
|
|
570
580
|
*/
|
|
571
|
-
notification:
|
|
581
|
+
notification: NotificationTemplateWritePayload;
|
|
572
582
|
|
|
573
583
|
/**
|
|
574
584
|
* Template state after creation. Case-insensitive input, normalized to uppercase
|
|
@@ -672,6 +682,15 @@ export interface NotificationTemplateResponse extends NotificationTemplatePayloa
|
|
|
672
682
|
*/
|
|
673
683
|
state: 'DRAFT' | 'PUBLISHED';
|
|
674
684
|
|
|
685
|
+
/**
|
|
686
|
+
* A template's send-time alias as returned by a read, omitted entirely when it has
|
|
687
|
+
* none. Usually a single string; an array for a template that resolves from
|
|
688
|
+
* several aliases, which writes through this API can no longer produce — only
|
|
689
|
+
* templates predating that restriction, or aliases attached outside this API, hold
|
|
690
|
+
* more than one.
|
|
691
|
+
*/
|
|
692
|
+
alias?: NotificationTemplateAlias;
|
|
693
|
+
|
|
675
694
|
/**
|
|
676
695
|
* Epoch milliseconds of last update.
|
|
677
696
|
*/
|
|
@@ -735,14 +754,15 @@ export interface NotificationTemplateSummary {
|
|
|
735
754
|
|
|
736
755
|
/**
|
|
737
756
|
* Request body for replacing a notification template. Same shape as create. All
|
|
738
|
-
* fields required (PUT = full replacement)
|
|
757
|
+
* fields required (PUT = full replacement), except `alias`, whose omission means
|
|
758
|
+
* "leave the existing aliases alone".
|
|
739
759
|
*/
|
|
740
760
|
export interface NotificationTemplateUpdateRequest {
|
|
741
761
|
/**
|
|
742
|
-
*
|
|
743
|
-
* `notification` key
|
|
762
|
+
* Template fields accepted in POST and PUT request bodies, nested under a
|
|
763
|
+
* `notification` key.
|
|
744
764
|
*/
|
|
745
|
-
notification:
|
|
765
|
+
notification: NotificationTemplateWritePayload;
|
|
746
766
|
|
|
747
767
|
/**
|
|
748
768
|
* Template state after update. Case-insensitive input, normalized to uppercase in
|
|
@@ -757,6 +777,23 @@ export interface NotificationTemplateVersionListResponse {
|
|
|
757
777
|
versions: Array<VersionNode>;
|
|
758
778
|
}
|
|
759
779
|
|
|
780
|
+
/**
|
|
781
|
+
* Template fields accepted in POST and PUT request bodies, nested under a
|
|
782
|
+
* `notification` key.
|
|
783
|
+
*/
|
|
784
|
+
export interface NotificationTemplateWritePayload extends NotificationTemplatePayload {
|
|
785
|
+
/**
|
|
786
|
+
* Send-time alias for this template — the value you pass as `event` to POST /send.
|
|
787
|
+
* Writes accept a single alias only. Optional, with three distinct meanings. Omit
|
|
788
|
+
* it to leave any existing aliases untouched. Send a string to make this the
|
|
789
|
+
* template's only alias — a template that already resolved from several aliases
|
|
790
|
+
* keeps just this one and the rest are detached. Send null to remove every alias
|
|
791
|
+
* from the template. An alias may not be claimed by another template — doing so
|
|
792
|
+
* returns 409 — and may not begin with "tenant/".
|
|
793
|
+
*/
|
|
794
|
+
alias?: string | null;
|
|
795
|
+
}
|
|
796
|
+
|
|
760
797
|
/**
|
|
761
798
|
* A version entry for a notification template.
|
|
762
799
|
*/
|
|
@@ -839,10 +876,10 @@ export type NotificationRetrieveContentResponse = NotificationContentGetResponse
|
|
|
839
876
|
|
|
840
877
|
export interface NotificationCreateParams {
|
|
841
878
|
/**
|
|
842
|
-
* Body param:
|
|
843
|
-
* under a `notification` key
|
|
879
|
+
* Body param: Template fields accepted in POST and PUT request bodies, nested
|
|
880
|
+
* under a `notification` key.
|
|
844
881
|
*/
|
|
845
|
-
notification:
|
|
882
|
+
notification: NotificationTemplateWritePayload;
|
|
846
883
|
|
|
847
884
|
/**
|
|
848
885
|
* Body param: Template state after creation. Case-insensitive input, normalized to
|
|
@@ -1033,10 +1070,10 @@ export namespace NotificationPutLocaleParams {
|
|
|
1033
1070
|
|
|
1034
1071
|
export interface NotificationReplaceParams {
|
|
1035
1072
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
* `notification` key
|
|
1073
|
+
* Template fields accepted in POST and PUT request bodies, nested under a
|
|
1074
|
+
* `notification` key.
|
|
1038
1075
|
*/
|
|
1039
|
-
notification:
|
|
1076
|
+
notification: NotificationTemplateWritePayload;
|
|
1040
1077
|
|
|
1041
1078
|
/**
|
|
1042
1079
|
* Template state after update. Case-insensitive input, normalized to uppercase in
|
|
@@ -1066,6 +1103,7 @@ export declare namespace Notifications {
|
|
|
1066
1103
|
type NotificationElementPutRequest as NotificationElementPutRequest,
|
|
1067
1104
|
type NotificationGetContent as NotificationGetContent,
|
|
1068
1105
|
type NotificationLocalePutRequest as NotificationLocalePutRequest,
|
|
1106
|
+
type NotificationTemplateAlias as NotificationTemplateAlias,
|
|
1069
1107
|
type NotificationTemplateCreateRequest as NotificationTemplateCreateRequest,
|
|
1070
1108
|
type NotificationTemplatePayload as NotificationTemplatePayload,
|
|
1071
1109
|
type NotificationTemplatePublishRequest as NotificationTemplatePublishRequest,
|
|
@@ -1074,6 +1112,7 @@ export declare namespace Notifications {
|
|
|
1074
1112
|
type NotificationTemplateSummary as NotificationTemplateSummary,
|
|
1075
1113
|
type NotificationTemplateUpdateRequest as NotificationTemplateUpdateRequest,
|
|
1076
1114
|
type NotificationTemplateVersionListResponse as NotificationTemplateVersionListResponse,
|
|
1115
|
+
type NotificationTemplateWritePayload as NotificationTemplateWritePayload,
|
|
1077
1116
|
type VersionNode as VersionNode,
|
|
1078
1117
|
type NotificationListResponse as NotificationListResponse,
|
|
1079
1118
|
type NotificationRetrieveContentResponse as NotificationRetrieveContentResponse,
|
|
@@ -29,7 +29,10 @@ export class Profiles extends APIResource {
|
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
31
|
* const profile = await client.profiles.create('user_id', {
|
|
32
|
-
* profile: {
|
|
32
|
+
* profile: {
|
|
33
|
+
* email: 'jdoe@example.com',
|
|
34
|
+
* phone_number: '+15558675309',
|
|
35
|
+
* },
|
|
33
36
|
* });
|
|
34
37
|
* ```
|
|
35
38
|
*/
|
|
@@ -80,9 +83,9 @@ export class Profiles extends APIResource {
|
|
|
80
83
|
* await client.profiles.update('user_id', {
|
|
81
84
|
* patch: [
|
|
82
85
|
* {
|
|
83
|
-
* op: '
|
|
84
|
-
* path: '
|
|
85
|
-
* value: '
|
|
86
|
+
* op: 'replace',
|
|
87
|
+
* path: '/email',
|
|
88
|
+
* value: 'jdoe@example.com',
|
|
86
89
|
* },
|
|
87
90
|
* ],
|
|
88
91
|
* });
|
|
@@ -119,7 +122,11 @@ export class Profiles extends APIResource {
|
|
|
119
122
|
* @example
|
|
120
123
|
* ```ts
|
|
121
124
|
* const response = await client.profiles.replace('user_id', {
|
|
122
|
-
* profile: {
|
|
125
|
+
* profile: {
|
|
126
|
+
* email: 'jdoe@example.com',
|
|
127
|
+
* phone_number: '+15558675309',
|
|
128
|
+
* locale: 'en-US',
|
|
129
|
+
* },
|
|
123
130
|
* });
|
|
124
131
|
* ```
|
|
125
132
|
*/
|
|
@@ -22,7 +22,9 @@ export class Providers extends APIResource {
|
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
24
|
* const provider = await client.providers.create({
|
|
25
|
-
* provider: '
|
|
25
|
+
* provider: 'sendgrid',
|
|
26
|
+
* settings: { api_key: 'SG.xxxxxxxx' },
|
|
27
|
+
* title: 'Production SendGrid',
|
|
26
28
|
* });
|
|
27
29
|
* ```
|
|
28
30
|
*/
|
|
@@ -67,7 +69,9 @@ export class Providers extends APIResource {
|
|
|
67
69
|
* @example
|
|
68
70
|
* ```ts
|
|
69
71
|
* const provider = await client.providers.update('id', {
|
|
70
|
-
* provider: '
|
|
72
|
+
* provider: 'sendgrid',
|
|
73
|
+
* settings: { api_key: 'SG.xxxxxxxx' },
|
|
74
|
+
* title: 'Production SendGrid',
|
|
71
75
|
* });
|
|
72
76
|
* ```
|
|
73
77
|
*/
|
package/src/resources/send.ts
CHANGED
|
@@ -12,7 +12,8 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
12
12
|
export class Send extends APIResource {
|
|
13
13
|
/**
|
|
14
14
|
* Sends a message to one or more recipients and returns a requestId. Courier
|
|
15
|
-
* routes it to email, SMS, push, chat, or in-app based on your rules.
|
|
15
|
+
* routes it to email, SMS, push, chat, or in-app based on your rules. Use the
|
|
16
|
+
* returned requestId to look up delivery status via the Messages API.
|
|
16
17
|
*
|
|
17
18
|
* @example
|
|
18
19
|
* ```ts
|
package/src/resources/shared.ts
CHANGED
|
@@ -135,6 +135,25 @@ export interface ElementalChannelNode extends ElementalBaseNode {
|
|
|
135
135
|
*/
|
|
136
136
|
channel?: string;
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Email only. Document-level base font size (CSS px, e.g. `16px`) for body content
|
|
140
|
+
* — text, quote, list and action button labels. Heading styles (`h1`/`h2`/`h3`)
|
|
141
|
+
* and `subtext` keep their preset sizes.
|
|
142
|
+
*/
|
|
143
|
+
font_size?: string | null;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Email only. Document-level line height (CSS px or unitless multiplier, e.g.
|
|
147
|
+
* `24px` or `1.5`) applied to all body content unless overridden per block.
|
|
148
|
+
*/
|
|
149
|
+
line_height?: string | null;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Email only. Document-level body padding applied once around the email body, as a
|
|
153
|
+
* CSS px shorthand (1–4 values), e.g. `48px 64px`.
|
|
154
|
+
*/
|
|
155
|
+
padding?: string | null;
|
|
156
|
+
|
|
138
157
|
/**
|
|
139
158
|
* Raw data to apply to the channel. If `elements` has not been specified, `raw` is
|
|
140
159
|
* required.
|
|
@@ -84,6 +84,7 @@ export class Templates extends APIResource {
|
|
|
84
84
|
* const postTenantTemplatePublishResponse =
|
|
85
85
|
* await client.tenants.templates.publish('template_id', {
|
|
86
86
|
* tenant_id: 'tenant_id',
|
|
87
|
+
* version: 'latest',
|
|
87
88
|
* });
|
|
88
89
|
* ```
|
|
89
90
|
*/
|
|
@@ -109,8 +110,13 @@ export class Templates extends APIResource {
|
|
|
109
110
|
* await client.tenants.templates.replace('template_id', {
|
|
110
111
|
* tenant_id: 'tenant_id',
|
|
111
112
|
* template: {
|
|
112
|
-
* content: {
|
|
113
|
+
* content: {
|
|
114
|
+
* version: '2022-01-01',
|
|
115
|
+
* elements: [{ type: 'text' }],
|
|
116
|
+
* },
|
|
117
|
+
* routing: { method: 'single', channels: ['email'] },
|
|
113
118
|
* },
|
|
119
|
+
* published: true,
|
|
114
120
|
* });
|
|
115
121
|
* ```
|
|
116
122
|
*/
|
|
@@ -47,7 +47,9 @@ export class Tenants extends APIResource {
|
|
|
47
47
|
* @example
|
|
48
48
|
* ```ts
|
|
49
49
|
* const tenant = await client.tenants.update('tenant_id', {
|
|
50
|
-
* name: '
|
|
50
|
+
* name: 'Acme Corp',
|
|
51
|
+
* brand_id: 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag',
|
|
52
|
+
* properties: { plan: 'enterprise' },
|
|
51
53
|
* });
|
|
52
54
|
* ```
|
|
53
55
|
*/
|
|
@@ -13,6 +13,14 @@ export class Translations extends APIResource {
|
|
|
13
13
|
/**
|
|
14
14
|
* Returns the translation strings stored for one domain and locale, for use in
|
|
15
15
|
* localized notification content.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const translation = await client.translations.retrieve(
|
|
20
|
+
* 'locale',
|
|
21
|
+
* { domain: 'domain' },
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
16
24
|
*/
|
|
17
25
|
retrieve(locale: string, params: TranslationRetrieveParams, options?: RequestOptions): APIPromise<string> {
|
|
18
26
|
const { domain } = params;
|
|
@@ -22,6 +30,14 @@ export class Translations extends APIResource {
|
|
|
22
30
|
/**
|
|
23
31
|
* Uploads the translation strings for one domain and locale. Courier uses them to
|
|
24
32
|
* render localized content for recipients in that locale.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* await client.translations.update('locale', {
|
|
37
|
+
* domain: 'domain',
|
|
38
|
+
* body: 'msgid "Hello"\nmsgstr "Hola"',
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
25
41
|
*/
|
|
26
42
|
update(locale: string, params: TranslationUpdateParams, options?: RequestOptions): APIPromise<void> {
|
|
27
43
|
const { domain, body } = params;
|