@trycourier/courier 7.3.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +136 -0
- package/LICENSE +1 -1
- package/README.md +34 -345
- package/client.d.mts +53 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +53 -8
- package/client.d.ts.map +1 -1
- package/client.js +26 -9
- package/client.js.map +1 -1
- package/client.mjs +27 -10
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/internal/utils/query.d.mts +2 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +10 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +12 -1
- package/resources/audiences.d.mts +11 -33
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +11 -33
- package/resources/audiences.d.ts.map +1 -1
- package/resources/automations/automations.d.mts +54 -1
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +54 -1
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.js +12 -0
- package/resources/automations/automations.js.map +1 -1
- package/resources/automations/automations.mjs +12 -0
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/index.d.mts +1 -1
- package/resources/automations/index.d.mts.map +1 -1
- package/resources/automations/index.d.ts +1 -1
- 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/bulk.d.mts +80 -39
- package/resources/bulk.d.mts.map +1 -1
- package/resources/bulk.d.ts +80 -39
- package/resources/bulk.d.ts.map +1 -1
- package/resources/bulk.js +12 -2
- package/resources/bulk.js.map +1 -1
- package/resources/bulk.mjs +12 -2
- package/resources/bulk.mjs.map +1 -1
- package/resources/inbound.d.mts +1 -1
- package/resources/inbound.d.ts +1 -1
- package/resources/index.d.mts +4 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- 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 +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/journeys.d.mts +143 -0
- package/resources/journeys.d.mts.map +1 -0
- package/resources/journeys.d.ts +143 -0
- package/resources/journeys.d.ts.map +1 -0
- package/resources/journeys.js +38 -0
- package/resources/journeys.js.map +1 -0
- package/resources/journeys.mjs +34 -0
- package/resources/journeys.mjs.map +1 -0
- package/resources/lists/subscriptions.d.mts +1 -1
- package/resources/lists/subscriptions.d.ts +1 -1
- package/resources/messages.d.mts +20 -20
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +20 -20
- package/resources/messages.d.ts.map +1 -1
- package/resources/notifications/checks.d.mts +2 -2
- package/resources/notifications/checks.d.ts +2 -2
- package/resources/send.d.mts +8 -2
- package/resources/send.d.mts.map +1 -1
- package/resources/send.d.ts +8 -2
- package/resources/send.d.ts.map +1 -1
- package/resources/send.js +1 -1
- package/resources/send.mjs +1 -1
- package/resources/shared.d.mts +290 -52
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +290 -52
- package/resources/shared.d.ts.map +1 -1
- package/resources/tenants/index.d.mts +2 -2
- package/resources/tenants/index.d.mts.map +1 -1
- package/resources/tenants/index.d.ts +2 -2
- package/resources/tenants/index.d.ts.map +1 -1
- package/resources/tenants/index.js +2 -2
- package/resources/tenants/index.js.map +1 -1
- package/resources/tenants/index.mjs +1 -1
- package/resources/tenants/index.mjs.map +1 -1
- package/resources/tenants/preferences/items.d.mts +2 -2
- package/resources/tenants/preferences/items.d.ts +2 -2
- package/resources/tenants/templates/index.d.mts +3 -0
- package/resources/tenants/templates/index.d.mts.map +1 -0
- package/resources/tenants/templates/index.d.ts +3 -0
- package/resources/tenants/templates/index.d.ts.map +1 -0
- package/resources/tenants/templates/index.js +9 -0
- package/resources/tenants/templates/index.js.map +1 -0
- package/resources/tenants/templates/index.mjs +4 -0
- package/resources/tenants/templates/index.mjs.map +1 -0
- package/resources/tenants/templates/templates.d.mts +159 -0
- package/resources/tenants/templates/templates.d.mts.map +1 -0
- package/resources/tenants/templates/templates.d.ts +159 -0
- package/resources/tenants/templates/templates.d.ts.map +1 -0
- package/resources/tenants/templates/templates.js +91 -0
- package/resources/tenants/templates/templates.js.map +1 -0
- package/resources/tenants/templates/templates.mjs +86 -0
- package/resources/tenants/templates/templates.mjs.map +1 -0
- package/resources/tenants/templates/versions.d.mts +39 -0
- package/resources/tenants/templates/versions.d.mts.map +1 -0
- package/resources/tenants/templates/versions.d.ts +39 -0
- package/resources/tenants/templates/versions.d.ts.map +1 -0
- package/resources/tenants/templates/versions.js +32 -0
- package/resources/tenants/templates/versions.js.map +1 -0
- package/resources/tenants/templates/versions.mjs +28 -0
- package/resources/tenants/templates/versions.mjs.map +1 -0
- package/resources/tenants/templates.d.mts +1 -90
- package/resources/tenants/templates.d.mts.map +1 -1
- package/resources/tenants/templates.d.ts +1 -90
- package/resources/tenants/templates.d.ts.map +1 -1
- package/resources/tenants/templates.js +2 -34
- package/resources/tenants/templates.js.map +1 -1
- package/resources/tenants/templates.mjs +1 -32
- package/resources/tenants/templates.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +147 -5
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +147 -5
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +2 -2
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +2 -2
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/translations.d.mts +1 -1
- package/resources/translations.d.ts +1 -1
- package/resources/users/preferences.d.mts +1 -1
- package/resources/users/preferences.d.ts +1 -1
- package/resources/users/tenants.d.mts +1 -1
- package/resources/users/tenants.d.ts +1 -1
- package/resources/users/tokens.d.mts +3 -8
- package/resources/users/tokens.d.mts.map +1 -1
- package/resources/users/tokens.d.ts +3 -8
- package/resources/users/tokens.d.ts.map +1 -1
- package/resources/users/tokens.js +2 -3
- package/resources/users/tokens.js.map +1 -1
- package/resources/users/tokens.mjs +2 -3
- package/resources/users/tokens.mjs.map +1 -1
- package/src/client.ts +115 -19
- package/src/internal/parse.ts +6 -0
- package/src/internal/utils/query.ts +7 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/audiences.ts +11 -69
- package/src/resources/automations/automations.ts +74 -1
- package/src/resources/automations/index.ts +7 -1
- package/src/resources/bulk.ts +71 -32
- package/src/resources/inbound.ts +1 -1
- package/src/resources/index.ts +21 -3
- package/src/resources/journeys.ts +174 -0
- package/src/resources/lists/subscriptions.ts +1 -1
- package/src/resources/messages.ts +24 -24
- package/src/resources/notifications/checks.ts +2 -2
- package/src/resources/send.ts +28 -2
- package/src/resources/shared.ts +391 -49
- package/src/resources/tenants/index.ts +8 -1
- package/src/resources/tenants/preferences/items.ts +2 -2
- package/src/resources/tenants/templates/index.ts +11 -0
- package/src/resources/tenants/templates/templates.ts +222 -0
- package/src/resources/tenants/templates/versions.ts +55 -0
- package/src/resources/tenants/templates.ts +1 -122
- package/src/resources/tenants/tenants.ts +179 -3
- package/src/resources/translations.ts +1 -1
- package/src/resources/users/preferences.ts +1 -1
- package/src/resources/users/tenants.ts +1 -1
- package/src/resources/users/tokens.ts +4 -10
- 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/bulk.ts
CHANGED
|
@@ -10,7 +10,11 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
|
|
11
11
|
export class Bulk extends APIResource {
|
|
12
12
|
/**
|
|
13
|
-
* Ingest user data into a Bulk Job
|
|
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.
|
|
14
18
|
*/
|
|
15
19
|
addUsers(jobID: string, body: BulkAddUsersParams, options?: RequestOptions): APIPromise<void> {
|
|
16
20
|
return this._client.post(path`/bulk/${jobID}`, {
|
|
@@ -21,7 +25,13 @@ export class Bulk extends APIResource {
|
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
/**
|
|
24
|
-
*
|
|
28
|
+
* Creates a new bulk job for sending messages to multiple recipients.
|
|
29
|
+
*
|
|
30
|
+
* **Required**: `message.event` (event ID or notification ID)
|
|
31
|
+
*
|
|
32
|
+
* **Optional (V2 format)**: `message.template` (notification ID) or
|
|
33
|
+
* `message.content` (Elemental content) can be provided to override the
|
|
34
|
+
* notification associated with the event.
|
|
25
35
|
*/
|
|
26
36
|
createJob(body: BulkCreateJobParams, options?: RequestOptions): APIPromise<BulkCreateJobResponse> {
|
|
27
37
|
return this._client.post('/bulk', { body, ...options });
|
|
@@ -56,52 +66,67 @@ export class Bulk extends APIResource {
|
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
locale?: { [key: string]: { [key: string]: unknown } } | null;
|
|
74
|
-
|
|
75
|
-
override?: { [key: string]: unknown } | null;
|
|
76
|
-
}
|
|
69
|
+
/**
|
|
70
|
+
* Bulk message definition. Supports two formats:
|
|
71
|
+
*
|
|
72
|
+
* - V1 format: Requires `event` field (event ID or notification ID)
|
|
73
|
+
* - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
|
|
74
|
+
* content) in addition to `event`
|
|
75
|
+
*/
|
|
76
|
+
export interface InboundBulkMessage {
|
|
77
|
+
/**
|
|
78
|
+
* Event ID or Notification ID (required). Can be either a Notification ID (e.g.,
|
|
79
|
+
* "FRH3QXM9E34W4RKP7MRC8NZ1T8V8") or a custom Event ID (e.g., "welcome-email")
|
|
80
|
+
* mapped to a notification.
|
|
81
|
+
*/
|
|
82
|
+
event: string;
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Syntactic sugar to provide a fast shorthand for Courier Elemental Blocks.
|
|
81
|
-
*/
|
|
82
|
-
content: Shared.ElementalContentSugar | Shared.ElementalContent;
|
|
84
|
+
brand?: string | null;
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Elemental content (optional, for V2 format). When provided, this will be used
|
|
88
|
+
* instead of the notification associated with the `event` field.
|
|
89
|
+
*/
|
|
90
|
+
content?: Shared.ElementalContentSugar | Shared.ElementalContent | null;
|
|
85
91
|
|
|
86
|
-
|
|
92
|
+
data?: { [key: string]: unknown } | null;
|
|
87
93
|
|
|
88
|
-
|
|
94
|
+
locale?: { [key: string]: { [key: string]: unknown } } | null;
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
override?: { [key: string]: unknown } | null;
|
|
91
97
|
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Notification ID or template ID (optional, for V2 format). When provided, this
|
|
100
|
+
* will be used instead of the notification associated with the `event` field.
|
|
101
|
+
*/
|
|
102
|
+
template?: string | null;
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
export interface InboundBulkMessageUser {
|
|
106
|
+
/**
|
|
107
|
+
* User-specific data that will be merged with message.data
|
|
108
|
+
*/
|
|
97
109
|
data?: unknown;
|
|
98
110
|
|
|
99
111
|
preferences?: Shared.RecipientPreferences | null;
|
|
100
112
|
|
|
101
|
-
|
|
113
|
+
/**
|
|
114
|
+
* User profile information. For email-based bulk jobs, `profile.email` is required
|
|
115
|
+
* for provider routing to determine if the message can be delivered. The email
|
|
116
|
+
* address should be provided here rather than in `to.email`.
|
|
117
|
+
*/
|
|
118
|
+
profile?: { [key: string]: unknown } | null;
|
|
102
119
|
|
|
120
|
+
/**
|
|
121
|
+
* User ID (legacy field, use profile or to.user_id instead)
|
|
122
|
+
*/
|
|
103
123
|
recipient?: string | null;
|
|
104
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Optional recipient information. Note: For email provider routing, use
|
|
127
|
+
* `profile.email` instead of `to.email`. The `to` field is primarily used for
|
|
128
|
+
* recipient identification and data merging.
|
|
129
|
+
*/
|
|
105
130
|
to?: Shared.UserRecipient | null;
|
|
106
131
|
}
|
|
107
132
|
|
|
@@ -129,6 +154,13 @@ export interface BulkRetrieveJobResponse {
|
|
|
129
154
|
|
|
130
155
|
export namespace BulkRetrieveJobResponse {
|
|
131
156
|
export interface Job {
|
|
157
|
+
/**
|
|
158
|
+
* Bulk message definition. Supports two formats:
|
|
159
|
+
*
|
|
160
|
+
* - V1 format: Requires `event` field (event ID or notification ID)
|
|
161
|
+
* - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
|
|
162
|
+
* content) in addition to `event`
|
|
163
|
+
*/
|
|
132
164
|
definition: BulkAPI.InboundBulkMessage;
|
|
133
165
|
|
|
134
166
|
enqueued: number;
|
|
@@ -146,6 +178,13 @@ export interface BulkAddUsersParams {
|
|
|
146
178
|
}
|
|
147
179
|
|
|
148
180
|
export interface BulkCreateJobParams {
|
|
181
|
+
/**
|
|
182
|
+
* Bulk message definition. Supports two formats:
|
|
183
|
+
*
|
|
184
|
+
* - V1 format: Requires `event` field (event ID or notification ID)
|
|
185
|
+
* - V2 format: Optionally use `template` (notification ID) or `content` (Elemental
|
|
186
|
+
* content) in addition to `event`
|
|
187
|
+
*/
|
|
149
188
|
message: InboundBulkMessage;
|
|
150
189
|
}
|
|
151
190
|
|
package/src/resources/inbound.ts
CHANGED
package/src/resources/index.ts
CHANGED
|
@@ -4,8 +4,6 @@ export * from './shared';
|
|
|
4
4
|
export {
|
|
5
5
|
Audiences,
|
|
6
6
|
type Audience,
|
|
7
|
-
type Filter,
|
|
8
|
-
type FilterConfig,
|
|
9
7
|
type AudienceUpdateResponse,
|
|
10
8
|
type AudienceListResponse,
|
|
11
9
|
type AudienceListMembersResponse,
|
|
@@ -20,7 +18,13 @@ export {
|
|
|
20
18
|
type AuditEventListParams,
|
|
21
19
|
} from './audit-events';
|
|
22
20
|
export { Auth, type AuthIssueTokenResponse, type AuthIssueTokenParams } from './auth';
|
|
23
|
-
export {
|
|
21
|
+
export {
|
|
22
|
+
Automations,
|
|
23
|
+
type AutomationInvokeResponse,
|
|
24
|
+
type AutomationTemplate,
|
|
25
|
+
type AutomationTemplateListResponse,
|
|
26
|
+
type AutomationListParams,
|
|
27
|
+
} from './automations/automations';
|
|
24
28
|
export {
|
|
25
29
|
Brands,
|
|
26
30
|
type Brand,
|
|
@@ -54,6 +58,15 @@ export {
|
|
|
54
58
|
type BulkListUsersParams,
|
|
55
59
|
} from './bulk';
|
|
56
60
|
export { Inbound, type InboundTrackEventResponse, type InboundTrackEventParams } from './inbound';
|
|
61
|
+
export {
|
|
62
|
+
Journeys,
|
|
63
|
+
type Journey,
|
|
64
|
+
type JourneysInvokeRequest,
|
|
65
|
+
type JourneysInvokeResponse,
|
|
66
|
+
type JourneysListResponse,
|
|
67
|
+
type JourneyListParams,
|
|
68
|
+
type JourneyInvokeParams,
|
|
69
|
+
} from './journeys';
|
|
57
70
|
export {
|
|
58
71
|
Lists,
|
|
59
72
|
type PutSubscriptionsRecipient,
|
|
@@ -97,9 +110,14 @@ export {
|
|
|
97
110
|
Tenants,
|
|
98
111
|
type BaseTemplateTenantAssociation,
|
|
99
112
|
type DefaultPreferences,
|
|
113
|
+
type PostTenantTemplatePublishRequest,
|
|
114
|
+
type PostTenantTemplatePublishResponse,
|
|
115
|
+
type PutTenantTemplateRequest,
|
|
116
|
+
type PutTenantTemplateResponse,
|
|
100
117
|
type SubscriptionTopicNew,
|
|
101
118
|
type Tenant,
|
|
102
119
|
type TenantAssociation,
|
|
120
|
+
type TenantTemplateInput,
|
|
103
121
|
type TenantListResponse,
|
|
104
122
|
type TenantListUsersResponse,
|
|
105
123
|
type TenantUpdateParams,
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../internal/request-options';
|
|
6
|
+
import { path } from '../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Journeys extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Get the list of journeys.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const journeysListResponse = await client.journeys.list();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
list(
|
|
18
|
+
query: JourneyListParams | null | undefined = {},
|
|
19
|
+
options?: RequestOptions,
|
|
20
|
+
): APIPromise<JourneysListResponse> {
|
|
21
|
+
return this._client.get('/journeys', { query, ...options });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Invoke a journey run from a journey template.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const journeysInvokeResponse = await client.journeys.invoke(
|
|
30
|
+
* 'templateId',
|
|
31
|
+
* {
|
|
32
|
+
* data: { order_id: 'order-456', amount: 99.99 },
|
|
33
|
+
* user_id: 'user-123',
|
|
34
|
+
* },
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
invoke(
|
|
39
|
+
templateID: string,
|
|
40
|
+
body: JourneyInvokeParams,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<JourneysInvokeResponse> {
|
|
43
|
+
return this._client.post(path`/journeys/${templateID}/invoke`, { body, ...options });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A journey template representing an automation workflow.
|
|
49
|
+
*/
|
|
50
|
+
export interface Journey {
|
|
51
|
+
/**
|
|
52
|
+
* The unique identifier of the journey.
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The name of the journey.
|
|
58
|
+
*/
|
|
59
|
+
name: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The version of the journey (published or draft).
|
|
63
|
+
*/
|
|
64
|
+
version: 'published' | 'draft';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* ISO 8601 timestamp when the journey was created.
|
|
68
|
+
*/
|
|
69
|
+
createdAt?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* ISO 8601 timestamp when the journey was last updated.
|
|
73
|
+
*/
|
|
74
|
+
updatedAt?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Request body for invoking a journey. Requires either a user identifier or a
|
|
79
|
+
* profile with contact information. User identifiers can be provided via user_id
|
|
80
|
+
* field, or resolved from profile/data objects (user_id, userId, or anonymousId
|
|
81
|
+
* fields).
|
|
82
|
+
*/
|
|
83
|
+
export interface JourneysInvokeRequest {
|
|
84
|
+
/**
|
|
85
|
+
* Data payload passed to the journey. The expected shape can be predefined using
|
|
86
|
+
* the schema builder in the journey editor. This data is available in journey
|
|
87
|
+
* steps for condition evaluation and template variable interpolation. Can also
|
|
88
|
+
* contain user identifiers (user_id, userId, anonymousId) if not provided
|
|
89
|
+
* elsewhere.
|
|
90
|
+
*/
|
|
91
|
+
data?: { [key: string]: unknown };
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Profile data for the user. Can contain contact information (email,
|
|
95
|
+
* phone_number), user identifiers (user_id, userId, anonymousId), or any custom
|
|
96
|
+
* profile fields. Profile fields are merged with any existing stored profile for
|
|
97
|
+
* the user. Include context.tenant_id to load a tenant-scoped profile for
|
|
98
|
+
* multi-tenant scenarios.
|
|
99
|
+
*/
|
|
100
|
+
profile?: { [key: string]: unknown };
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A unique identifier for the user. If not provided, the system will attempt to
|
|
104
|
+
* resolve the user identifier from profile or data objects.
|
|
105
|
+
*/
|
|
106
|
+
user_id?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface JourneysInvokeResponse {
|
|
110
|
+
/**
|
|
111
|
+
* A unique identifier for the journey run that was created.
|
|
112
|
+
*/
|
|
113
|
+
runId: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface JourneysListResponse {
|
|
117
|
+
/**
|
|
118
|
+
* A cursor token for pagination. Present when there are more results available.
|
|
119
|
+
*/
|
|
120
|
+
cursor?: string;
|
|
121
|
+
|
|
122
|
+
templates?: Array<Journey>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface JourneyListParams {
|
|
126
|
+
/**
|
|
127
|
+
* A cursor token for pagination. Use the cursor from the previous response to
|
|
128
|
+
* fetch the next page of results.
|
|
129
|
+
*/
|
|
130
|
+
cursor?: string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The version of journeys to retrieve. Accepted values are published (for
|
|
134
|
+
* published journeys) or draft (for draft journeys). Defaults to published.
|
|
135
|
+
*/
|
|
136
|
+
version?: 'published' | 'draft';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface JourneyInvokeParams {
|
|
140
|
+
/**
|
|
141
|
+
* Data payload passed to the journey. The expected shape can be predefined using
|
|
142
|
+
* the schema builder in the journey editor. This data is available in journey
|
|
143
|
+
* steps for condition evaluation and template variable interpolation. Can also
|
|
144
|
+
* contain user identifiers (user_id, userId, anonymousId) if not provided
|
|
145
|
+
* elsewhere.
|
|
146
|
+
*/
|
|
147
|
+
data?: { [key: string]: unknown };
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Profile data for the user. Can contain contact information (email,
|
|
151
|
+
* phone_number), user identifiers (user_id, userId, anonymousId), or any custom
|
|
152
|
+
* profile fields. Profile fields are merged with any existing stored profile for
|
|
153
|
+
* the user. Include context.tenant_id to load a tenant-scoped profile for
|
|
154
|
+
* multi-tenant scenarios.
|
|
155
|
+
*/
|
|
156
|
+
profile?: { [key: string]: unknown };
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* A unique identifier for the user. If not provided, the system will attempt to
|
|
160
|
+
* resolve the user identifier from profile or data objects.
|
|
161
|
+
*/
|
|
162
|
+
user_id?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export declare namespace Journeys {
|
|
166
|
+
export {
|
|
167
|
+
type Journey as Journey,
|
|
168
|
+
type JourneysInvokeRequest as JourneysInvokeRequest,
|
|
169
|
+
type JourneysInvokeResponse as JourneysInvokeResponse,
|
|
170
|
+
type JourneysListResponse as JourneysListResponse,
|
|
171
|
+
type JourneyListParams as JourneyListParams,
|
|
172
|
+
type JourneyInvokeParams as JourneyInvokeParams,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -61,18 +61,6 @@ export interface MessageDetails {
|
|
|
61
61
|
*/
|
|
62
62
|
id: string;
|
|
63
63
|
|
|
64
|
-
/**
|
|
65
|
-
* A UTC timestamp at which the recipient clicked on a tracked link for the first
|
|
66
|
-
* time. Stored as a millisecond representation of the Unix epoch.
|
|
67
|
-
*/
|
|
68
|
-
clicked: number;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* A UTC timestamp at which the Integration provider delivered the message. Stored
|
|
72
|
-
* as a millisecond representation of the Unix epoch.
|
|
73
|
-
*/
|
|
74
|
-
delivered: number;
|
|
75
|
-
|
|
76
64
|
/**
|
|
77
65
|
* A UTC timestamp at which Courier received the message request. Stored as a
|
|
78
66
|
* millisecond representation of the Unix epoch.
|
|
@@ -89,23 +77,11 @@ export interface MessageDetails {
|
|
|
89
77
|
*/
|
|
90
78
|
notification: string;
|
|
91
79
|
|
|
92
|
-
/**
|
|
93
|
-
* A UTC timestamp at which the recipient opened a message for the first time.
|
|
94
|
-
* Stored as a millisecond representation of the Unix epoch.
|
|
95
|
-
*/
|
|
96
|
-
opened: number;
|
|
97
|
-
|
|
98
80
|
/**
|
|
99
81
|
* A unique identifier associated with the recipient of the delivered message.
|
|
100
82
|
*/
|
|
101
83
|
recipient: string;
|
|
102
84
|
|
|
103
|
-
/**
|
|
104
|
-
* A UTC timestamp at which Courier passed the message to the Integration provider.
|
|
105
|
-
* Stored as a millisecond representation of the Unix epoch.
|
|
106
|
-
*/
|
|
107
|
-
sent: number;
|
|
108
|
-
|
|
109
85
|
/**
|
|
110
86
|
* The current status of the message.
|
|
111
87
|
*/
|
|
@@ -126,11 +102,29 @@ export interface MessageDetails {
|
|
|
126
102
|
| 'UNMAPPED'
|
|
127
103
|
| 'UNROUTABLE';
|
|
128
104
|
|
|
105
|
+
/**
|
|
106
|
+
* A UTC timestamp at which the recipient clicked on a tracked link for the first
|
|
107
|
+
* time. Stored as a millisecond representation of the Unix epoch.
|
|
108
|
+
*/
|
|
109
|
+
clicked?: number;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A UTC timestamp at which the Integration provider delivered the message. Stored
|
|
113
|
+
* as a millisecond representation of the Unix epoch.
|
|
114
|
+
*/
|
|
115
|
+
delivered?: number;
|
|
116
|
+
|
|
129
117
|
/**
|
|
130
118
|
* A message describing the error that occurred.
|
|
131
119
|
*/
|
|
132
120
|
error?: string | null;
|
|
133
121
|
|
|
122
|
+
/**
|
|
123
|
+
* A UTC timestamp at which the recipient opened a message for the first time.
|
|
124
|
+
* Stored as a millisecond representation of the Unix epoch.
|
|
125
|
+
*/
|
|
126
|
+
opened?: number;
|
|
127
|
+
|
|
134
128
|
/**
|
|
135
129
|
* The reason for the current status of the message.
|
|
136
130
|
*/
|
|
@@ -145,6 +139,12 @@ export interface MessageDetails {
|
|
|
145
139
|
| 'UNPUBLISHED'
|
|
146
140
|
| 'UNSUBSCRIBED'
|
|
147
141
|
| null;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A UTC timestamp at which Courier passed the message to the Integration provider.
|
|
145
|
+
* Stored as a millisecond representation of the Unix epoch.
|
|
146
|
+
*/
|
|
147
|
+
sent?: number;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export interface MessageRetrieveResponse extends MessageDetails {
|
package/src/resources/send.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class Send extends APIResource {
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* const response = await client.send.message({
|
|
15
15
|
* message: {
|
|
16
|
-
* to: { user_id: '
|
|
16
|
+
* to: { user_id: 'user_id' },
|
|
17
17
|
* template: 'template_id',
|
|
18
18
|
* data: { foo: 'bar' },
|
|
19
19
|
* },
|
|
@@ -89,7 +89,26 @@ export namespace SendMessageParams {
|
|
|
89
89
|
/**
|
|
90
90
|
* The recipient or a list of recipients of the message
|
|
91
91
|
*/
|
|
92
|
-
to?:
|
|
92
|
+
to?:
|
|
93
|
+
| Shared.UserRecipient
|
|
94
|
+
| Shared.AudienceRecipient
|
|
95
|
+
| Shared.ListRecipient
|
|
96
|
+
| Shared.ListPatternRecipient
|
|
97
|
+
| Shared.SlackRecipient
|
|
98
|
+
| Shared.MsTeamsRecipient
|
|
99
|
+
| Shared.PagerdutyRecipient
|
|
100
|
+
| Shared.WebhookRecipient
|
|
101
|
+
| Array<
|
|
102
|
+
| Shared.UserRecipient
|
|
103
|
+
| Shared.AudienceRecipient
|
|
104
|
+
| Shared.ListRecipient
|
|
105
|
+
| Shared.ListPatternRecipient
|
|
106
|
+
| Shared.SlackRecipient
|
|
107
|
+
| Shared.MsTeamsRecipient
|
|
108
|
+
| Shared.PagerdutyRecipient
|
|
109
|
+
| Shared.WebhookRecipient
|
|
110
|
+
>
|
|
111
|
+
| null;
|
|
93
112
|
}
|
|
94
113
|
|
|
95
114
|
export namespace Message {
|
|
@@ -142,6 +161,13 @@ export namespace SendMessageParams {
|
|
|
142
161
|
*/
|
|
143
162
|
duration?: number | null;
|
|
144
163
|
|
|
164
|
+
/**
|
|
165
|
+
* IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Used when
|
|
166
|
+
* resolving opening hours expressions. Takes precedence over user profile timezone
|
|
167
|
+
* settings.
|
|
168
|
+
*/
|
|
169
|
+
timezone?: string | null;
|
|
170
|
+
|
|
145
171
|
/**
|
|
146
172
|
* ISO 8601 timestamp or opening_hours-like format.
|
|
147
173
|
*/
|