@trycourier/courier 7.11.0 → 7.19.2
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 +123 -0
- package/README.md +1 -0
- package/client.d.mts +10 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +10 -4
- package/client.d.ts.map +1 -1
- package/client.js +15 -1
- package/client.js.map +1 -1
- package/client.mjs +15 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/audiences.d.mts +5 -2
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +5 -2
- package/resources/audiences.d.ts.map +1 -1
- package/resources/brands.d.mts +35 -2
- package/resources/brands.d.mts.map +1 -1
- package/resources/brands.d.ts +35 -2
- package/resources/brands.d.ts.map +1 -1
- package/resources/brands.js +34 -1
- package/resources/brands.js.map +1 -1
- package/resources/brands.mjs +34 -1
- package/resources/brands.mjs.map +1 -1
- package/resources/digests/digests.d.mts +94 -0
- package/resources/digests/digests.d.mts.map +1 -0
- package/resources/digests/digests.d.ts +94 -0
- package/resources/digests/digests.d.ts.map +1 -0
- package/resources/digests/digests.js +17 -0
- package/resources/digests/digests.js.map +1 -0
- package/resources/digests/digests.mjs +12 -0
- package/resources/digests/digests.mjs.map +1 -0
- package/resources/digests/index.d.mts +3 -0
- package/resources/digests/index.d.mts.map +1 -0
- package/resources/digests/index.d.ts +3 -0
- package/resources/digests/index.d.ts.map +1 -0
- package/resources/digests/index.js +9 -0
- package/resources/digests/index.js.map +1 -0
- package/resources/digests/index.mjs +4 -0
- package/resources/digests/index.mjs.map +1 -0
- package/resources/digests/schedules.d.mts +32 -0
- package/resources/digests/schedules.d.mts.map +1 -0
- package/resources/digests/schedules.d.ts +32 -0
- package/resources/digests/schedules.d.ts.map +1 -0
- package/resources/digests/schedules.js +29 -0
- package/resources/digests/schedules.js.map +1 -0
- package/resources/digests/schedules.mjs +25 -0
- package/resources/digests/schedules.mjs.map +1 -0
- package/resources/digests.d.mts +2 -0
- package/resources/digests.d.mts.map +1 -0
- package/resources/digests.d.ts +2 -0
- package/resources/digests.d.ts.map +1 -0
- package/resources/digests.js +6 -0
- package/resources/digests.js.map +1 -0
- package/resources/digests.mjs +3 -0
- package/resources/digests.mjs.map +1 -0
- package/resources/index.d.mts +4 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/journeys/index.d.mts +2 -2
- package/resources/journeys/index.d.mts.map +1 -1
- package/resources/journeys/index.d.ts +2 -2
- package/resources/journeys/index.d.ts.map +1 -1
- package/resources/journeys/index.js.map +1 -1
- package/resources/journeys/index.mjs.map +1 -1
- package/resources/journeys/journeys.d.mts +198 -7
- package/resources/journeys/journeys.d.mts.map +1 -1
- package/resources/journeys/journeys.d.ts +198 -7
- package/resources/journeys/journeys.d.ts.map +1 -1
- package/resources/journeys/journeys.js +18 -0
- package/resources/journeys/journeys.js.map +1 -1
- package/resources/journeys/journeys.mjs +18 -0
- package/resources/journeys/journeys.mjs.map +1 -1
- package/resources/journeys/templates.d.mts +120 -1
- package/resources/journeys/templates.d.mts.map +1 -1
- package/resources/journeys/templates.d.ts +120 -1
- package/resources/journeys/templates.d.ts.map +1 -1
- package/resources/journeys/templates.js +71 -0
- package/resources/journeys/templates.js.map +1 -1
- package/resources/journeys/templates.mjs +71 -0
- package/resources/journeys/templates.mjs.map +1 -1
- package/resources/messages.d.mts +16 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +16 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +10 -0
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +10 -0
- package/resources/messages.mjs.map +1 -1
- package/resources/notifications/checks.d.mts +3 -3
- package/resources/notifications/checks.d.ts +3 -3
- package/resources/notifications/checks.js +3 -3
- package/resources/notifications/checks.mjs +3 -3
- package/resources/notifications/notifications.d.mts +7 -3
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +7 -3
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +7 -3
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +7 -3
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/shared.d.mts +6 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +6 -0
- package/resources/shared.d.ts.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/index.js.map +1 -1
- package/resources/users/index.mjs.map +1 -1
- package/resources/users/preferences.d.mts +211 -1
- package/resources/users/preferences.d.mts.map +1 -1
- package/resources/users/preferences.d.ts +211 -1
- package/resources/users/preferences.d.ts.map +1 -1
- package/resources/users/preferences.js +105 -0
- package/resources/users/preferences.js.map +1 -1
- package/resources/users/preferences.mjs +105 -0
- package/resources/users/preferences.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/resources/users/users.js.map +1 -1
- package/resources/users/users.mjs.map +1 -1
- package/resources/workspace-preferences/index.d.mts +3 -0
- package/resources/workspace-preferences/index.d.mts.map +1 -0
- package/resources/workspace-preferences/index.d.ts +3 -0
- package/resources/workspace-preferences/index.d.ts.map +1 -0
- package/resources/workspace-preferences/index.js +9 -0
- package/resources/workspace-preferences/index.js.map +1 -0
- package/resources/workspace-preferences/index.mjs +4 -0
- package/resources/workspace-preferences/index.mjs.map +1 -0
- package/resources/workspace-preferences/topics.d.mts +168 -0
- package/resources/workspace-preferences/topics.d.mts.map +1 -0
- package/resources/workspace-preferences/topics.d.ts +168 -0
- package/resources/workspace-preferences/topics.d.ts.map +1 -0
- package/resources/workspace-preferences/topics.js +103 -0
- package/resources/workspace-preferences/topics.js.map +1 -0
- package/resources/workspace-preferences/topics.mjs +99 -0
- package/resources/workspace-preferences/topics.mjs.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.d.mts +410 -0
- package/resources/workspace-preferences/workspace-preferences.d.mts.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.d.ts +410 -0
- package/resources/workspace-preferences/workspace-preferences.d.ts.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.js +104 -0
- package/resources/workspace-preferences/workspace-preferences.js.map +1 -0
- package/resources/workspace-preferences/workspace-preferences.mjs +99 -0
- package/resources/workspace-preferences/workspace-preferences.mjs.map +1 -0
- package/resources/workspace-preferences.d.mts +2 -0
- package/resources/workspace-preferences.d.mts.map +1 -0
- package/resources/workspace-preferences.d.ts +2 -0
- package/resources/workspace-preferences.d.ts.map +1 -0
- package/resources/workspace-preferences.js +6 -0
- package/resources/workspace-preferences.js.map +1 -0
- package/resources/workspace-preferences.mjs +3 -0
- package/resources/workspace-preferences.mjs.map +1 -0
- package/src/client.ts +71 -1
- package/src/resources/audiences.ts +5 -2
- package/src/resources/brands.ts +36 -3
- package/src/resources/digests/digests.ts +120 -0
- package/src/resources/digests/index.ts +9 -0
- package/src/resources/digests/schedules.ts +51 -0
- package/src/resources/digests.ts +3 -0
- package/src/resources/index.ts +28 -0
- package/src/resources/journeys/index.ts +8 -0
- package/src/resources/journeys/journeys.ts +246 -4
- package/src/resources/journeys/templates.ts +168 -0
- package/src/resources/messages.ts +20 -0
- package/src/resources/notifications/checks.ts +3 -3
- package/src/resources/notifications/notifications.ts +7 -3
- package/src/resources/shared.ts +7 -0
- package/src/resources/users/index.ts +6 -0
- package/src/resources/users/preferences.ts +269 -0
- package/src/resources/users/users.ts +12 -0
- package/src/resources/workspace-preferences/index.ts +25 -0
- package/src/resources/workspace-preferences/topics.ts +229 -0
- package/src/resources/workspace-preferences/workspace-preferences.ts +534 -0
- package/src/resources/workspace-preferences.ts +3 -0
- 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
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
TemplateListParams,
|
|
11
11
|
TemplateListVersionsParams,
|
|
12
12
|
TemplatePublishParams,
|
|
13
|
+
TemplatePutContentParams,
|
|
14
|
+
TemplatePutLocaleParams,
|
|
13
15
|
TemplateReplaceParams,
|
|
16
|
+
TemplateRetrieveContentParams,
|
|
14
17
|
TemplateRetrieveParams,
|
|
15
18
|
Templates,
|
|
16
19
|
} from './templates';
|
|
@@ -99,6 +102,25 @@ export class Journeys extends APIResource {
|
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Cancel journey runs. The request body must include EXACTLY ONE of
|
|
107
|
+
* `cancelation_token` (cancels every run associated with the token) or `run_id`
|
|
108
|
+
* (cancels a single tenant-scoped run). Supplying both or neither returns a `400`.
|
|
109
|
+
* A `run_id` that does not match a run for the tenant returns `404`. Cancelation
|
|
110
|
+
* is idempotent: a run that has already finished (`PROCESSED`/`ERROR`) or was
|
|
111
|
+
* already `CANCELED` is left unchanged and its current status is returned.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const cancelJourneyResponse = await client.journeys.cancel({
|
|
116
|
+
* cancelation_token: 'order-1234',
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
cancel(body: JourneyCancelParams, options?: RequestOptions): APIPromise<CancelJourneyResponse> {
|
|
121
|
+
return this._client.post('/journeys/cancel', { body, ...options });
|
|
122
|
+
}
|
|
123
|
+
|
|
102
124
|
/**
|
|
103
125
|
* Invoke a journey by id or alias to start a new run. The response includes a
|
|
104
126
|
* `runId` identifying the run.
|
|
@@ -179,6 +201,48 @@ export class Journeys extends APIResource {
|
|
|
179
201
|
}
|
|
180
202
|
}
|
|
181
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of
|
|
206
|
+
* `cancelation_token` (cancels every run associated with the token) or `run_id`
|
|
207
|
+
* (cancels a single tenant-scoped run).
|
|
208
|
+
*/
|
|
209
|
+
export type CancelJourneyRequest = CancelJourneyRequest.ByCancelationToken | CancelJourneyRequest.ByRunID;
|
|
210
|
+
|
|
211
|
+
export namespace CancelJourneyRequest {
|
|
212
|
+
export interface ByCancelationToken {
|
|
213
|
+
cancelation_token: string;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface ByRunID {
|
|
217
|
+
run_id: string;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* `202 Accepted` body for `POST /journeys/cancel`, returning the submitted
|
|
223
|
+
* identifier. When called with `cancelation_token`, returns
|
|
224
|
+
* `{ cancelation_token }`; when called with `run_id`, returns
|
|
225
|
+
* `{ run_id, status }`.
|
|
226
|
+
*/
|
|
227
|
+
export type CancelJourneyResponse = CancelJourneyResponse.TokenBranch | CancelJourneyResponse.RunIDBranch;
|
|
228
|
+
|
|
229
|
+
export namespace CancelJourneyResponse {
|
|
230
|
+
export interface TokenBranch {
|
|
231
|
+
cancelation_token: string;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface RunIDBranch {
|
|
235
|
+
run_id: string;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The run's resulting status. `CANCELED` when the run was active and has been
|
|
239
|
+
* canceled; `PROCESSED` or `ERROR` when the run had already finished and was left
|
|
240
|
+
* unchanged; `CANCELED` for an already-canceled run.
|
|
241
|
+
*/
|
|
242
|
+
status: string;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
182
246
|
/**
|
|
183
247
|
* Request body for creating a journey.
|
|
184
248
|
*/
|
|
@@ -379,6 +443,60 @@ export interface JourneyExitNode {
|
|
|
379
443
|
id?: string;
|
|
380
444
|
}
|
|
381
445
|
|
|
446
|
+
/**
|
|
447
|
+
* A/B experiment config for a send node. The recipient is deterministically
|
|
448
|
+
* bucketed by `bucketingKey` and routed to one of the `variants` in proportion to
|
|
449
|
+
* its `weight`. Present on a send node INSTEAD OF `message.template`.
|
|
450
|
+
*/
|
|
451
|
+
export interface JourneyExperiment {
|
|
452
|
+
/**
|
|
453
|
+
* The value used to deterministically assign a recipient to a variant. Must be
|
|
454
|
+
* non-empty with no leading or trailing whitespace.
|
|
455
|
+
*/
|
|
456
|
+
bucketingKey: string;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Between 2 and 10 weighted template variants.
|
|
460
|
+
*/
|
|
461
|
+
variants: Array<JourneyExperimentVariant>;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Unique experiment id (prefixed `exp_`). Omit to have one generated
|
|
465
|
+
* automatically; when supplied it must be a valid `exp_` id.
|
|
466
|
+
*/
|
|
467
|
+
id?: string;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Optional display name for the experiment.
|
|
471
|
+
*/
|
|
472
|
+
name?: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* A single weighted variant of an experiment. Variant ids must be unique within
|
|
477
|
+
* the experiment and the sum of all variant weights must be greater than 0.
|
|
478
|
+
* Weights are relative (no sum-to-100 requirement) — routing normalizes them
|
|
479
|
+
* proportionally.
|
|
480
|
+
*/
|
|
481
|
+
export interface JourneyExperimentVariant {
|
|
482
|
+
id: string;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* The notification template sent for this variant.
|
|
486
|
+
*/
|
|
487
|
+
templateId: string;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Relative routing weight. Must be non-negative.
|
|
491
|
+
*/
|
|
492
|
+
weight: number;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Optional display name for the variant.
|
|
496
|
+
*/
|
|
497
|
+
name?: string;
|
|
498
|
+
}
|
|
499
|
+
|
|
382
500
|
/**
|
|
383
501
|
* Issue an HTTP GET or DELETE request and merge the response into the journey
|
|
384
502
|
* state per `merge_strategy`.
|
|
@@ -472,10 +590,104 @@ export type JourneyNode =
|
|
|
472
590
|
| JourneyAINode
|
|
473
591
|
| JourneyThrottleStaticNode
|
|
474
592
|
| JourneyThrottleDynamicNode
|
|
593
|
+
| JourneyNode.JourneyBatchNode
|
|
594
|
+
| JourneyNode.JourneyAddToDigestNode
|
|
475
595
|
| JourneyExitNode
|
|
476
596
|
| JourneyNode.JourneyBranchNode;
|
|
477
597
|
|
|
478
598
|
export namespace JourneyNode {
|
|
599
|
+
/**
|
|
600
|
+
* Collect events arriving at the node into a single batch and fire one downstream
|
|
601
|
+
* step with the aggregated payload. The first event into a batch owns the run;
|
|
602
|
+
* later contributing events terminate at the batch step. The batch releases when
|
|
603
|
+
* any of `max_items` is reached, a quiet window of `wait_period` elapses, or the
|
|
604
|
+
* `max_wait_period` ceiling hits.
|
|
605
|
+
*/
|
|
606
|
+
export interface JourneyBatchNode {
|
|
607
|
+
/**
|
|
608
|
+
* ISO 8601 duration. Hard ceiling from the first event into the batch; releases
|
|
609
|
+
* the batch unconditionally when it elapses.
|
|
610
|
+
*/
|
|
611
|
+
max_wait_period: string;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* How to select which collected events to retain in the aggregated payload when
|
|
615
|
+
* the batch releases.
|
|
616
|
+
*/
|
|
617
|
+
retain: JourneyBatchNode.Retain;
|
|
618
|
+
|
|
619
|
+
scope: 'user';
|
|
620
|
+
|
|
621
|
+
type: 'batch';
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* ISO 8601 duration. Quiet window that releases the batch when it elapses with no
|
|
625
|
+
* new contributing events. Must be less than `max_wait_period`.
|
|
626
|
+
*/
|
|
627
|
+
wait_period: string;
|
|
628
|
+
|
|
629
|
+
id?: string;
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Optional partition key. Events with the same `category_key` are batched
|
|
633
|
+
* together; events with different values are batched separately.
|
|
634
|
+
*/
|
|
635
|
+
category_key?: string;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Condition spec for a journey node. Accepts a single condition atom, an AND/OR
|
|
639
|
+
* group, or an AND/OR nested group. Omit the `conditions` property entirely to
|
|
640
|
+
* express "no conditions".
|
|
641
|
+
*/
|
|
642
|
+
conditions?: JourneysAPI.JourneyConditionsField;
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Releases the batch once this many events have been collected.
|
|
646
|
+
*/
|
|
647
|
+
max_items?: number;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
export namespace JourneyBatchNode {
|
|
651
|
+
/**
|
|
652
|
+
* How to select which collected events to retain in the aggregated payload when
|
|
653
|
+
* the batch releases.
|
|
654
|
+
*/
|
|
655
|
+
export interface Retain {
|
|
656
|
+
count: number;
|
|
657
|
+
|
|
658
|
+
type: 'first' | 'last' | 'highest' | 'lowest';
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Dot-path into the event payload (e.g. `data.priority`). Required when `type` is
|
|
662
|
+
* `highest` or `lowest`.
|
|
663
|
+
*/
|
|
664
|
+
sort_key?: string;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Add the current event to a digest keyed by the given subscription topic. The
|
|
670
|
+
* digest accumulates events and releases them on the schedule configured for the
|
|
671
|
+
* topic.
|
|
672
|
+
*/
|
|
673
|
+
export interface JourneyAddToDigestNode {
|
|
674
|
+
/**
|
|
675
|
+
* The subscription topic that owns the digest the event is added to.
|
|
676
|
+
*/
|
|
677
|
+
subscription_topic_id: string;
|
|
678
|
+
|
|
679
|
+
type: 'add-to-digest';
|
|
680
|
+
|
|
681
|
+
id?: string;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Condition spec for a journey node. Accepts a single condition atom, an AND/OR
|
|
685
|
+
* group, or an AND/OR nested group. Omit the `conditions` property entirely to
|
|
686
|
+
* express "no conditions".
|
|
687
|
+
*/
|
|
688
|
+
conditions?: JourneysAPI.JourneyConditionsField;
|
|
689
|
+
}
|
|
690
|
+
|
|
479
691
|
/**
|
|
480
692
|
* Branch node. Routes to the first entry in `paths[]` whose `conditions` match,
|
|
481
693
|
* else falls through to `default.nodes`.
|
|
@@ -571,8 +783,11 @@ export interface JourneySegmentTriggerNode {
|
|
|
571
783
|
}
|
|
572
784
|
|
|
573
785
|
/**
|
|
574
|
-
* Send
|
|
575
|
-
*
|
|
786
|
+
* Send to the recipient. A send node sources its content from EXACTLY ONE of
|
|
787
|
+
* `message.template` (a single notification template) or `experiment` (an A/B
|
|
788
|
+
* split across weighted template variants) — supplying both, or neither, is
|
|
789
|
+
* rejected. Optionally override the recipient address, delay the send, or attach
|
|
790
|
+
* `data`.
|
|
576
791
|
*/
|
|
577
792
|
export interface JourneySendNode {
|
|
578
793
|
message: JourneySendNode.Message;
|
|
@@ -587,16 +802,23 @@ export interface JourneySendNode {
|
|
|
587
802
|
* express "no conditions".
|
|
588
803
|
*/
|
|
589
804
|
conditions?: JourneyConditionsField;
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* A/B experiment config for a send node. The recipient is deterministically
|
|
808
|
+
* bucketed by `bucketingKey` and routed to one of the `variants` in proportion to
|
|
809
|
+
* its `weight`. Present on a send node INSTEAD OF `message.template`.
|
|
810
|
+
*/
|
|
811
|
+
experiment?: JourneyExperiment;
|
|
590
812
|
}
|
|
591
813
|
|
|
592
814
|
export namespace JourneySendNode {
|
|
593
815
|
export interface Message {
|
|
594
|
-
template: string;
|
|
595
|
-
|
|
596
816
|
data?: { [key: string]: unknown };
|
|
597
817
|
|
|
598
818
|
delay?: Message.Delay;
|
|
599
819
|
|
|
820
|
+
template?: string;
|
|
821
|
+
|
|
600
822
|
to?: Message.To;
|
|
601
823
|
}
|
|
602
824
|
|
|
@@ -946,6 +1168,18 @@ export interface JourneyListParams {
|
|
|
946
1168
|
version?: 'published' | 'draft';
|
|
947
1169
|
}
|
|
948
1170
|
|
|
1171
|
+
export type JourneyCancelParams = JourneyCancelParams.ByCancelationToken | JourneyCancelParams.ByRunID;
|
|
1172
|
+
|
|
1173
|
+
export declare namespace JourneyCancelParams {
|
|
1174
|
+
export interface ByCancelationToken {
|
|
1175
|
+
cancelation_token: string;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
export interface ByRunID {
|
|
1179
|
+
run_id: string;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
|
|
949
1183
|
export interface JourneyInvokeParams {
|
|
950
1184
|
/**
|
|
951
1185
|
* Data payload passed to the journey. The expected shape can be predefined using
|
|
@@ -993,6 +1227,8 @@ Journeys.Templates = Templates;
|
|
|
993
1227
|
|
|
994
1228
|
export declare namespace Journeys {
|
|
995
1229
|
export {
|
|
1230
|
+
type CancelJourneyRequest as CancelJourneyRequest,
|
|
1231
|
+
type CancelJourneyResponse as CancelJourneyResponse,
|
|
996
1232
|
type CreateJourneyRequest as CreateJourneyRequest,
|
|
997
1233
|
type Journey as Journey,
|
|
998
1234
|
type JourneyAINode as JourneyAINode,
|
|
@@ -1004,6 +1240,8 @@ export declare namespace Journeys {
|
|
|
1004
1240
|
type JourneyDelayDurationNode as JourneyDelayDurationNode,
|
|
1005
1241
|
type JourneyDelayUntilNode as JourneyDelayUntilNode,
|
|
1006
1242
|
type JourneyExitNode as JourneyExitNode,
|
|
1243
|
+
type JourneyExperiment as JourneyExperiment,
|
|
1244
|
+
type JourneyExperimentVariant as JourneyExperimentVariant,
|
|
1007
1245
|
type JourneyFetchGetDeleteNode as JourneyFetchGetDeleteNode,
|
|
1008
1246
|
type JourneyFetchPostPutNode as JourneyFetchPostPutNode,
|
|
1009
1247
|
type JourneyMergeStrategy as JourneyMergeStrategy,
|
|
@@ -1029,6 +1267,7 @@ export declare namespace Journeys {
|
|
|
1029
1267
|
type JourneyCreateParams as JourneyCreateParams,
|
|
1030
1268
|
type JourneyRetrieveParams as JourneyRetrieveParams,
|
|
1031
1269
|
type JourneyListParams as JourneyListParams,
|
|
1270
|
+
type JourneyCancelParams as JourneyCancelParams,
|
|
1032
1271
|
type JourneyInvokeParams as JourneyInvokeParams,
|
|
1033
1272
|
type JourneyPublishParams as JourneyPublishParams,
|
|
1034
1273
|
type JourneyReplaceParams as JourneyReplaceParams,
|
|
@@ -1042,6 +1281,9 @@ export declare namespace Journeys {
|
|
|
1042
1281
|
type TemplateArchiveParams as TemplateArchiveParams,
|
|
1043
1282
|
type TemplateListVersionsParams as TemplateListVersionsParams,
|
|
1044
1283
|
type TemplatePublishParams as TemplatePublishParams,
|
|
1284
|
+
type TemplatePutContentParams as TemplatePutContentParams,
|
|
1285
|
+
type TemplatePutLocaleParams as TemplatePutLocaleParams,
|
|
1045
1286
|
type TemplateReplaceParams as TemplateReplaceParams,
|
|
1287
|
+
type TemplateRetrieveContentParams as TemplateRetrieveContentParams,
|
|
1046
1288
|
};
|
|
1047
1289
|
}
|
|
@@ -141,6 +141,65 @@ export class Templates extends APIResource {
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Replace the elemental content of a journey-scoped notification template.
|
|
146
|
+
* Overwrites all elements in the template draft with the provided content.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* const notificationContentMutationResponse =
|
|
151
|
+
* await client.journeys.templates.putContent('x', {
|
|
152
|
+
* templateId: 'x',
|
|
153
|
+
* content: {
|
|
154
|
+
* version: '2022-01-01',
|
|
155
|
+
* elements: [{ type: 'channel' }],
|
|
156
|
+
* },
|
|
157
|
+
* state: 'DRAFT',
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
putContent(
|
|
162
|
+
notificationID: string,
|
|
163
|
+
params: TemplatePutContentParams,
|
|
164
|
+
options?: RequestOptions,
|
|
165
|
+
): APIPromise<NotificationsAPI.NotificationContentMutationResponse> {
|
|
166
|
+
const { templateId, ...body } = params;
|
|
167
|
+
return this._client.put(path`/journeys/${templateId}/templates/${notificationID}/content`, {
|
|
168
|
+
body,
|
|
169
|
+
...options,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Set locale-specific content overrides for a journey-scoped notification
|
|
175
|
+
* template. Each element override must reference an existing element by ID.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* const notificationContentMutationResponse =
|
|
180
|
+
* await client.journeys.templates.putLocale('x', {
|
|
181
|
+
* templateId: 'x',
|
|
182
|
+
* notificationId: 'x',
|
|
183
|
+
* elements: [
|
|
184
|
+
* { id: 'elem_1', content: 'Hola {{data.name}}.' },
|
|
185
|
+
* { id: 'elem_2', title: 'Bienvenido!' },
|
|
186
|
+
* ],
|
|
187
|
+
* state: 'DRAFT',
|
|
188
|
+
* });
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
putLocale(
|
|
192
|
+
localeID: string,
|
|
193
|
+
params: TemplatePutLocaleParams,
|
|
194
|
+
options?: RequestOptions,
|
|
195
|
+
): APIPromise<NotificationsAPI.NotificationContentMutationResponse> {
|
|
196
|
+
const { templateId, notificationId, ...body } = params;
|
|
197
|
+
return this._client.put(path`/journeys/${templateId}/templates/${notificationId}/locales/${localeID}`, {
|
|
198
|
+
body,
|
|
199
|
+
...options,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
144
203
|
/**
|
|
145
204
|
* Replace the journey-scoped notification template draft.
|
|
146
205
|
*
|
|
@@ -167,6 +226,33 @@ export class Templates extends APIResource {
|
|
|
167
226
|
const { templateId, ...body } = params;
|
|
168
227
|
return this._client.put(path`/journeys/${templateId}/templates/${notificationID}`, { body, ...options });
|
|
169
228
|
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Retrieve the elemental content of a journey-scoped notification template. The
|
|
232
|
+
* response contains the versioned elements along with their content checksums,
|
|
233
|
+
* which can be used to detect changes between versions. Pass `?version=draft`
|
|
234
|
+
* (default `published`) to retrieve the working draft, or `?version=vN` for a
|
|
235
|
+
* historical version.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* const notificationContentGetResponse =
|
|
240
|
+
* await client.journeys.templates.retrieveContent('x', {
|
|
241
|
+
* templateId: 'x',
|
|
242
|
+
* });
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
retrieveContent(
|
|
246
|
+
notificationID: string,
|
|
247
|
+
params: TemplateRetrieveContentParams,
|
|
248
|
+
options?: RequestOptions,
|
|
249
|
+
): APIPromise<NotificationsAPI.NotificationContentGetResponse> {
|
|
250
|
+
const { templateId, ...query } = params;
|
|
251
|
+
return this._client.get(path`/journeys/${templateId}/templates/${notificationID}/content`, {
|
|
252
|
+
query,
|
|
253
|
+
...options,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
170
256
|
}
|
|
171
257
|
|
|
172
258
|
export interface TemplateCreateParams {
|
|
@@ -256,6 +342,72 @@ export interface TemplatePublishParams {
|
|
|
256
342
|
version?: string;
|
|
257
343
|
}
|
|
258
344
|
|
|
345
|
+
export interface TemplatePutContentParams {
|
|
346
|
+
/**
|
|
347
|
+
* Path param: Journey id
|
|
348
|
+
*/
|
|
349
|
+
templateId: string;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Body param: Elemental content payload. The server defaults `version` when
|
|
353
|
+
* omitted.
|
|
354
|
+
*/
|
|
355
|
+
content: TemplatePutContentParams.Content;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Body param: Template state. Defaults to `DRAFT`.
|
|
359
|
+
*/
|
|
360
|
+
state?: NotificationsAPI.NotificationTemplateState;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export namespace TemplatePutContentParams {
|
|
364
|
+
/**
|
|
365
|
+
* Elemental content payload. The server defaults `version` when omitted.
|
|
366
|
+
*/
|
|
367
|
+
export interface Content {
|
|
368
|
+
elements: Array<Shared.ElementalNode>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Content version identifier (e.g., `2022-01-01`). Optional; server defaults when
|
|
372
|
+
* omitted.
|
|
373
|
+
*/
|
|
374
|
+
version?: string;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface TemplatePutLocaleParams {
|
|
379
|
+
/**
|
|
380
|
+
* Path param: Journey id
|
|
381
|
+
*/
|
|
382
|
+
templateId: string;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Path param: Notification template id
|
|
386
|
+
*/
|
|
387
|
+
notificationId: string;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Body param: Elements with locale-specific content overrides.
|
|
391
|
+
*/
|
|
392
|
+
elements: Array<TemplatePutLocaleParams.Element>;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Body param: Template state. Defaults to `DRAFT`.
|
|
396
|
+
*/
|
|
397
|
+
state?: NotificationsAPI.NotificationTemplateState;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export namespace TemplatePutLocaleParams {
|
|
401
|
+
export interface Element {
|
|
402
|
+
/**
|
|
403
|
+
* Target element ID.
|
|
404
|
+
*/
|
|
405
|
+
id: string;
|
|
406
|
+
|
|
407
|
+
[k: string]: unknown;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
259
411
|
export interface TemplateReplaceParams {
|
|
260
412
|
/**
|
|
261
413
|
* Path param: Journey id
|
|
@@ -305,6 +457,19 @@ export namespace TemplateReplaceParams {
|
|
|
305
457
|
}
|
|
306
458
|
}
|
|
307
459
|
|
|
460
|
+
export interface TemplateRetrieveContentParams {
|
|
461
|
+
/**
|
|
462
|
+
* Path param: Journey id
|
|
463
|
+
*/
|
|
464
|
+
templateId: string;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Query param: Accepts `draft`, `published`, or a version string (e.g., `v001`).
|
|
468
|
+
* Defaults to `published`.
|
|
469
|
+
*/
|
|
470
|
+
version?: string;
|
|
471
|
+
}
|
|
472
|
+
|
|
308
473
|
export declare namespace Templates {
|
|
309
474
|
export {
|
|
310
475
|
type TemplateCreateParams as TemplateCreateParams,
|
|
@@ -313,6 +478,9 @@ export declare namespace Templates {
|
|
|
313
478
|
type TemplateArchiveParams as TemplateArchiveParams,
|
|
314
479
|
type TemplateListVersionsParams as TemplateListVersionsParams,
|
|
315
480
|
type TemplatePublishParams as TemplatePublishParams,
|
|
481
|
+
type TemplatePutContentParams as TemplatePutContentParams,
|
|
482
|
+
type TemplatePutLocaleParams as TemplatePutLocaleParams,
|
|
316
483
|
type TemplateReplaceParams as TemplateReplaceParams,
|
|
484
|
+
type TemplateRetrieveContentParams as TemplateRetrieveContentParams,
|
|
317
485
|
};
|
|
318
486
|
}
|
|
@@ -52,6 +52,17 @@ export class Messages extends APIResource {
|
|
|
52
52
|
): APIPromise<MessageHistoryResponse> {
|
|
53
53
|
return this._client.get(path`/messages/${messageID}/history`, { query, ...options });
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Resend a previously sent message. The original send request is loaded from
|
|
58
|
+
* storage and a brand-new send is enqueued for the same recipient and content,
|
|
59
|
+
* producing a **new** `messageId` — the original message is not modified.
|
|
60
|
+
* Throttled by a per-message rate limit; a repeat inside the limit window returns
|
|
61
|
+
* `429 Too Many Requests`.
|
|
62
|
+
*/
|
|
63
|
+
resend(messageID: string, options?: RequestOptions): APIPromise<MessageResendResponse> {
|
|
64
|
+
return this._client.post(path`/messages/${messageID}/resend`, options);
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
export interface MessageDetails {
|
|
@@ -244,6 +255,14 @@ export interface MessageHistoryResponse {
|
|
|
244
255
|
results: Array<{ [key: string]: unknown }>;
|
|
245
256
|
}
|
|
246
257
|
|
|
258
|
+
export interface MessageResendResponse {
|
|
259
|
+
/**
|
|
260
|
+
* The new message id for the resent message. It is distinct from the id of the
|
|
261
|
+
* original message that was resent.
|
|
262
|
+
*/
|
|
263
|
+
messageId: string;
|
|
264
|
+
}
|
|
265
|
+
|
|
247
266
|
export interface MessageListParams {
|
|
248
267
|
/**
|
|
249
268
|
* A boolean value that indicates whether archived messages should be included in
|
|
@@ -339,6 +358,7 @@ export declare namespace Messages {
|
|
|
339
358
|
type MessageListResponse as MessageListResponse,
|
|
340
359
|
type MessageContentResponse as MessageContentResponse,
|
|
341
360
|
type MessageHistoryResponse as MessageHistoryResponse,
|
|
361
|
+
type MessageResendResponse as MessageResendResponse,
|
|
342
362
|
type MessageListParams as MessageListParams,
|
|
343
363
|
type MessageHistoryParams as MessageHistoryParams,
|
|
344
364
|
};
|
|
@@ -9,7 +9,7 @@ import { path } from '../../internal/utils/path';
|
|
|
9
9
|
|
|
10
10
|
export class Checks extends APIResource {
|
|
11
11
|
/**
|
|
12
|
-
* Replace the checks for a notification template
|
|
12
|
+
* Replace the submission checks for a notification template.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```ts
|
|
@@ -38,7 +38,7 @@ export class Checks extends APIResource {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Retrieve the checks for a notification template
|
|
41
|
+
* Retrieve the submission checks for a notification template.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* ```ts
|
|
@@ -58,7 +58,7 @@ export class Checks extends APIResource {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Cancel a notification template
|
|
61
|
+
* Cancel a submission for a notification template.
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
* ```ts
|
|
@@ -30,9 +30,13 @@ export class Notifications extends APIResource {
|
|
|
30
30
|
* notification: {
|
|
31
31
|
* name: 'Welcome Email',
|
|
32
32
|
* tags: ['onboarding', 'welcome'],
|
|
33
|
-
* brand: { id: '
|
|
34
|
-
* subscription: {
|
|
35
|
-
*
|
|
33
|
+
* brand: { id: 'bnd_01kx4mrd0pfzw8wt7pn7p2fzag' },
|
|
34
|
+
* subscription: {
|
|
35
|
+
* topic_id: 'pt_01kx4h2jdafq8bk9a26x0kvd1t',
|
|
36
|
+
* },
|
|
37
|
+
* routing: {
|
|
38
|
+
* strategy_id: 'rs_01kx4h2jdafq8bk9amzvy6hbv0',
|
|
39
|
+
* },
|
|
36
40
|
* content: {
|
|
37
41
|
* version: '2022-01-01',
|
|
38
42
|
* elements: [{ type: 'channel' }],
|
package/src/resources/shared.ts
CHANGED
|
@@ -33,6 +33,13 @@ export interface AudienceFilterConfig {
|
|
|
33
33
|
* Array of filter rules (single conditions or nested groups)
|
|
34
34
|
*/
|
|
35
35
|
filters: Array<FilterConfig>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The logical operator (AND/OR) combining the rules in `filters`. Required when
|
|
39
|
+
* `filters` contains more than one rule. If omitted, the top-level `operator`
|
|
40
|
+
* field on the request is used instead.
|
|
41
|
+
*/
|
|
42
|
+
operator?: 'AND' | 'OR';
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
/**
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
4
|
Preferences,
|
|
5
|
+
type BulkPreferenceTopic,
|
|
5
6
|
type TopicPreference,
|
|
6
7
|
type PreferenceRetrieveResponse,
|
|
8
|
+
type PreferenceBulkReplaceResponse,
|
|
9
|
+
type PreferenceBulkUpdateResponse,
|
|
7
10
|
type PreferenceRetrieveTopicResponse,
|
|
8
11
|
type PreferenceUpdateOrCreateTopicResponse,
|
|
9
12
|
type PreferenceRetrieveParams,
|
|
13
|
+
type PreferenceBulkReplaceParams,
|
|
14
|
+
type PreferenceBulkUpdateParams,
|
|
15
|
+
type PreferenceDeleteTopicParams,
|
|
10
16
|
type PreferenceRetrieveTopicParams,
|
|
11
17
|
type PreferenceUpdateOrCreateTopicParams,
|
|
12
18
|
} from './preferences';
|