@trycourier/courier 9.0.0 → 9.2.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 +15 -0
- package/client.d.mts +6 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -6
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/automations/automations.d.mts +82 -1
- package/resources/automations/automations.d.mts.map +1 -1
- package/resources/automations/automations.d.ts +82 -1
- package/resources/automations/automations.d.ts.map +1 -1
- package/resources/automations/automations.js +4 -0
- package/resources/automations/automations.js.map +1 -1
- package/resources/automations/automations.mjs +4 -0
- package/resources/automations/automations.mjs.map +1 -1
- package/resources/automations/index.d.mts +2 -1
- package/resources/automations/index.d.mts.map +1 -1
- package/resources/automations/index.d.ts +2 -1
- package/resources/automations/index.d.ts.map +1 -1
- package/resources/automations/index.js +3 -1
- package/resources/automations/index.js.map +1 -1
- package/resources/automations/index.mjs +1 -0
- package/resources/automations/index.mjs.map +1 -1
- package/resources/automations/runs.d.mts +69 -0
- package/resources/automations/runs.d.mts.map +1 -0
- package/resources/automations/runs.d.ts +69 -0
- package/resources/automations/runs.d.ts.map +1 -0
- package/resources/automations/runs.js +43 -0
- package/resources/automations/runs.js.map +1 -0
- package/resources/automations/runs.mjs +39 -0
- package/resources/automations/runs.mjs.map +1 -0
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/journeys/index.d.mts +2 -1
- package/resources/journeys/index.d.mts.map +1 -1
- package/resources/journeys/index.d.ts +2 -1
- package/resources/journeys/index.d.ts.map +1 -1
- package/resources/journeys/index.js +3 -1
- package/resources/journeys/index.js.map +1 -1
- package/resources/journeys/index.mjs +1 -0
- package/resources/journeys/index.mjs.map +1 -1
- package/resources/journeys/journeys.d.mts +183 -4
- package/resources/journeys/journeys.d.mts.map +1 -1
- package/resources/journeys/journeys.d.ts +183 -4
- package/resources/journeys/journeys.d.ts.map +1 -1
- package/resources/journeys/journeys.js +4 -0
- package/resources/journeys/journeys.js.map +1 -1
- package/resources/journeys/journeys.mjs +4 -0
- package/resources/journeys/journeys.mjs.map +1 -1
- package/resources/journeys/runs.d.mts +83 -0
- package/resources/journeys/runs.d.mts.map +1 -0
- package/resources/journeys/runs.d.ts +83 -0
- package/resources/journeys/runs.d.ts.map +1 -0
- package/resources/journeys/runs.js +59 -0
- package/resources/journeys/runs.js.map +1 -0
- package/resources/journeys/runs.mjs +55 -0
- package/resources/journeys/runs.mjs.map +1 -0
- 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 +133 -1
- package/resources/notifications/notifications.d.mts.map +1 -1
- package/resources/notifications/notifications.d.ts +133 -1
- package/resources/notifications/notifications.d.ts.map +1 -1
- package/resources/notifications/notifications.js +31 -0
- package/resources/notifications/notifications.js.map +1 -1
- package/resources/notifications/notifications.mjs +31 -0
- package/resources/notifications/notifications.mjs.map +1 -1
- package/resources/users/preferences.d.mts +12 -0
- package/resources/users/preferences.d.mts.map +1 -1
- package/resources/users/preferences.d.ts +12 -0
- package/resources/users/preferences.d.ts.map +1 -1
- package/src/client.ts +28 -0
- package/src/resources/automations/automations.ts +101 -0
- package/src/resources/automations/index.ts +5 -0
- package/src/resources/automations/runs.ts +87 -0
- package/src/resources/index.ts +14 -0
- package/src/resources/journeys/index.ts +9 -0
- package/src/resources/journeys/journeys.ts +226 -2
- package/src/resources/journeys/runs.ts +104 -0
- package/src/resources/notifications/index.ts +2 -0
- package/src/resources/notifications/notifications.ts +160 -0
- package/src/resources/users/preferences.ts +14 -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
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as JourneysAPI from './journeys';
|
|
5
5
|
import * as Shared from '../shared';
|
|
6
|
+
import * as RunsAPI from './runs';
|
|
7
|
+
import { RunListParams, Runs } from './runs';
|
|
6
8
|
import * as TemplatesAPI from './templates';
|
|
7
9
|
import {
|
|
8
10
|
TemplateArchiveParams,
|
|
@@ -27,6 +29,7 @@ import { path } from '../../internal/utils/path';
|
|
|
27
29
|
*/
|
|
28
30
|
export class Journeys extends APIResource {
|
|
29
31
|
templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client);
|
|
32
|
+
runs: RunsAPI.Runs = new RunsAPI.Runs(this._client);
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
35
|
* Creates a journey from a set of nodes, in draft state unless you pass a
|
|
@@ -409,6 +412,34 @@ export interface JourneyAPIInvokeTriggerNode {
|
|
|
409
412
|
schema?: { [key: string]: unknown };
|
|
410
413
|
}
|
|
411
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Trigger fired when a user newly matches an Audience. Leaving and re-joining the
|
|
417
|
+
* Audience re-enters the Journey. Membership is new-members-only: users already in
|
|
418
|
+
* the Audience when the Journey is published do not enter. Unlike the v2
|
|
419
|
+
* Automations audience trigger, there is no member scope, event type, or frequency
|
|
420
|
+
* mode to configure, and `audience_id` must name one Audience — wildcards are not
|
|
421
|
+
* supported.
|
|
422
|
+
*/
|
|
423
|
+
export interface JourneyAudienceTriggerNode {
|
|
424
|
+
/**
|
|
425
|
+
* The Audience to watch. Must name a single Audience; wildcards are not supported.
|
|
426
|
+
*/
|
|
427
|
+
audience_id: string;
|
|
428
|
+
|
|
429
|
+
trigger_type: 'audience';
|
|
430
|
+
|
|
431
|
+
type: 'trigger';
|
|
432
|
+
|
|
433
|
+
id?: string;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Condition spec for a journey node. Accepts a single condition atom, an AND/OR
|
|
437
|
+
* group, or an AND/OR nested group. Omit the `conditions` property entirely to
|
|
438
|
+
* express "no conditions".
|
|
439
|
+
*/
|
|
440
|
+
conditions?: JourneyConditionsField;
|
|
441
|
+
}
|
|
442
|
+
|
|
412
443
|
/**
|
|
413
444
|
* A single condition expressed as a positional tuple of strings.
|
|
414
445
|
*
|
|
@@ -650,6 +681,8 @@ export type JourneyMergeStrategy = 'overwrite' | 'soft-merge' | 'replace' | 'non
|
|
|
650
681
|
export type JourneyNode =
|
|
651
682
|
| JourneyAPIInvokeTriggerNode
|
|
652
683
|
| JourneySegmentTriggerNode
|
|
684
|
+
| JourneyAudienceTriggerNode
|
|
685
|
+
| JourneyWebhookTriggerNode
|
|
653
686
|
| JourneySendNode
|
|
654
687
|
| JourneyDelayDurationNode
|
|
655
688
|
| JourneyDelayUntilNode
|
|
@@ -829,10 +862,157 @@ export interface JourneyResponse {
|
|
|
829
862
|
}
|
|
830
863
|
|
|
831
864
|
/**
|
|
832
|
-
*
|
|
865
|
+
* One run of a Journey. `status` and `created_at` are absent on a small number of
|
|
866
|
+
* legacy runs stored without them.
|
|
867
|
+
*/
|
|
868
|
+
export interface JourneyRun {
|
|
869
|
+
/**
|
|
870
|
+
* A unique identifier representing the run.
|
|
871
|
+
*/
|
|
872
|
+
run_id: string;
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Internal provenance strings describing what started the run, e.g.
|
|
876
|
+
* `invoke/<journey_id>` or `segment/page/Pricing Page`. Diagnostic only — the
|
|
877
|
+
* format is unstable and should not be parsed.
|
|
878
|
+
*/
|
|
879
|
+
source: Array<string>;
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* When the run started, as an ISO 8601 timestamp.
|
|
883
|
+
*/
|
|
884
|
+
created_at?: string;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* The state of the run: `PROCESSING`, `PROCESSED`, `WAITING`, `CANCELED`, `ERROR`,
|
|
888
|
+
* `THROTTLED`, or `NOT PROCESSED`. Not an enum — new values have been added
|
|
889
|
+
* before.
|
|
890
|
+
*/
|
|
891
|
+
status?: string;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* The id of the Journey this run belongs to.
|
|
895
|
+
*/
|
|
896
|
+
template_id?: string;
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* When the run last changed state, as an ISO 8601 timestamp.
|
|
900
|
+
*/
|
|
901
|
+
updated_at?: string;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* A Journey run as it appears in a list response, without `updated_at`.
|
|
906
|
+
*/
|
|
907
|
+
export interface JourneyRunListItem {
|
|
908
|
+
/**
|
|
909
|
+
* A unique identifier representing the run.
|
|
910
|
+
*/
|
|
911
|
+
run_id: string;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Internal provenance strings describing what started the run. Diagnostic only.
|
|
915
|
+
*/
|
|
916
|
+
source: Array<string>;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* When the run started, as an ISO 8601 timestamp.
|
|
920
|
+
*/
|
|
921
|
+
created_at?: string;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* The state of the run. See `JourneyRun.status` for the values it takes.
|
|
925
|
+
*/
|
|
926
|
+
status?: string;
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* The id of the Journey this run belongs to.
|
|
930
|
+
*/
|
|
931
|
+
template_id?: string;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* A page of Journey runs.
|
|
936
|
+
*/
|
|
937
|
+
export interface JourneyRunListResponse {
|
|
938
|
+
runs: Array<JourneyRunListItem>;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Pass back as `cursor` to fetch the next page. Absent on the last page.
|
|
942
|
+
*/
|
|
943
|
+
next_cursor?: string;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Pass back as `cursor` to fetch the previous page. Absent on the first page.
|
|
947
|
+
*/
|
|
948
|
+
prev_cursor?: string;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* A single Journey run.
|
|
953
|
+
*/
|
|
954
|
+
export interface JourneyRunResponse {
|
|
955
|
+
/**
|
|
956
|
+
* One run of a Journey. `status` and `created_at` are absent on a small number of
|
|
957
|
+
* legacy runs stored without them.
|
|
958
|
+
*/
|
|
959
|
+
run: JourneyRun;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* One executed node of a Journey run. `node_id` is the id of the node in the
|
|
964
|
+
* published Journey, so a step maps directly onto the Journey graph.
|
|
965
|
+
*/
|
|
966
|
+
export interface JourneyRunStep {
|
|
967
|
+
/**
|
|
968
|
+
* The kind of node that ran, e.g. `send`, `delay`, or `exit`.
|
|
969
|
+
*/
|
|
970
|
+
action: string;
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* The state of the step: the seven run statuses, plus `SKIPPED` and `COMPUTING`.
|
|
974
|
+
* Not an enum — new values have been added before.
|
|
975
|
+
*/
|
|
976
|
+
status: string;
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* When the step started, as an ISO 8601 timestamp.
|
|
980
|
+
*/
|
|
981
|
+
created_at?: string;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* The message this step produced, present on send steps. Pass it to
|
|
985
|
+
* `GET /messages/{message_id}` for delivery status. A send to a List or an
|
|
986
|
+
* Audience yields one id for the request, not one per recipient.
|
|
987
|
+
*/
|
|
988
|
+
message_id?: string;
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* The id of the node in the published Journey that this step executed.
|
|
992
|
+
*/
|
|
993
|
+
node_id?: string;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* When the step last changed state, as an ISO 8601 timestamp.
|
|
997
|
+
*/
|
|
998
|
+
updated_at?: string;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Every step of a Journey run. Not paginated.
|
|
1003
|
+
*/
|
|
1004
|
+
export interface JourneyRunStepsResponse {
|
|
1005
|
+
steps: Array<JourneyRunStep>;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Trigger fired by a segment event (`identify`, `group`, `track`, or `page`). A
|
|
1010
|
+
* trigger with no `event_id` fires on any event of its type — the only shape
|
|
1011
|
+
* `identify` and `group` can take, and the one that catches a stock
|
|
1012
|
+
* `analytics.page()` call.
|
|
833
1013
|
*/
|
|
834
1014
|
export interface JourneySegmentTriggerNode {
|
|
835
|
-
request_type: 'identify' | 'group' | 'track';
|
|
1015
|
+
request_type: 'identify' | 'group' | 'track' | 'page';
|
|
836
1016
|
|
|
837
1017
|
trigger_type: 'segment';
|
|
838
1018
|
|
|
@@ -1181,6 +1361,39 @@ export interface JourneyVersionsListResponse {
|
|
|
1181
1361
|
results: Array<JourneyVersionItem>;
|
|
1182
1362
|
}
|
|
1183
1363
|
|
|
1364
|
+
/**
|
|
1365
|
+
* Trigger fired when an external system POSTs to the webhook URL minted for
|
|
1366
|
+
* `event_source`. Narrow it to one event with `event_id`, or omit `event_id` to
|
|
1367
|
+
* accept every event delivered to the URL.
|
|
1368
|
+
*/
|
|
1369
|
+
export interface JourneyWebhookTriggerNode {
|
|
1370
|
+
/**
|
|
1371
|
+
* The provider key the webhook URL is minted for. Required, and must not contain a
|
|
1372
|
+
* forward slash.
|
|
1373
|
+
*/
|
|
1374
|
+
event_source: string;
|
|
1375
|
+
|
|
1376
|
+
trigger_type: 'webhook';
|
|
1377
|
+
|
|
1378
|
+
type: 'trigger';
|
|
1379
|
+
|
|
1380
|
+
id?: string;
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* Condition spec for a journey node. Accepts a single condition atom, an AND/OR
|
|
1384
|
+
* group, or an AND/OR nested group. Omit the `conditions` property entirely to
|
|
1385
|
+
* express "no conditions".
|
|
1386
|
+
*/
|
|
1387
|
+
conditions?: JourneyConditionsField;
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* An optional event filter, matched against the payload's `event` field. A sender
|
|
1391
|
+
* that supplies no `event` matches the literal `custom`. Must not contain a
|
|
1392
|
+
* forward slash. Omit to accept every event delivered to the URL.
|
|
1393
|
+
*/
|
|
1394
|
+
event_id?: string;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1184
1397
|
/**
|
|
1185
1398
|
* Request body for invoking a journey. Requires either a user identifier or a
|
|
1186
1399
|
* profile with contact information. User identifiers can be provided via user_id
|
|
@@ -1427,6 +1640,7 @@ export interface JourneyReplaceParams {
|
|
|
1427
1640
|
}
|
|
1428
1641
|
|
|
1429
1642
|
Journeys.Templates = Templates;
|
|
1643
|
+
Journeys.Runs = Runs;
|
|
1430
1644
|
|
|
1431
1645
|
export declare namespace Journeys {
|
|
1432
1646
|
export {
|
|
@@ -1436,6 +1650,7 @@ export declare namespace Journeys {
|
|
|
1436
1650
|
type Journey as Journey,
|
|
1437
1651
|
type JourneyAINode as JourneyAINode,
|
|
1438
1652
|
type JourneyAPIInvokeTriggerNode as JourneyAPIInvokeTriggerNode,
|
|
1653
|
+
type JourneyAudienceTriggerNode as JourneyAudienceTriggerNode,
|
|
1439
1654
|
type JourneyConditionAtom as JourneyConditionAtom,
|
|
1440
1655
|
type JourneyConditionGroup as JourneyConditionGroup,
|
|
1441
1656
|
type JourneyConditionNestedGroup as JourneyConditionNestedGroup,
|
|
@@ -1451,6 +1666,12 @@ export declare namespace Journeys {
|
|
|
1451
1666
|
type JourneyNode as JourneyNode,
|
|
1452
1667
|
type JourneyPublishRequest as JourneyPublishRequest,
|
|
1453
1668
|
type JourneyResponse as JourneyResponse,
|
|
1669
|
+
type JourneyRun as JourneyRun,
|
|
1670
|
+
type JourneyRunListItem as JourneyRunListItem,
|
|
1671
|
+
type JourneyRunListResponse as JourneyRunListResponse,
|
|
1672
|
+
type JourneyRunResponse as JourneyRunResponse,
|
|
1673
|
+
type JourneyRunStep as JourneyRunStep,
|
|
1674
|
+
type JourneyRunStepsResponse as JourneyRunStepsResponse,
|
|
1454
1675
|
type JourneySegmentTriggerNode as JourneySegmentTriggerNode,
|
|
1455
1676
|
type JourneySendNode as JourneySendNode,
|
|
1456
1677
|
type JourneyState as JourneyState,
|
|
@@ -1464,6 +1685,7 @@ export declare namespace Journeys {
|
|
|
1464
1685
|
type JourneyThrottleStaticNode as JourneyThrottleStaticNode,
|
|
1465
1686
|
type JourneyVersionItem as JourneyVersionItem,
|
|
1466
1687
|
type JourneyVersionsListResponse as JourneyVersionsListResponse,
|
|
1688
|
+
type JourneyWebhookTriggerNode as JourneyWebhookTriggerNode,
|
|
1467
1689
|
type JourneysInvokeRequest as JourneysInvokeRequest,
|
|
1468
1690
|
type JourneysInvokeResponse as JourneysInvokeResponse,
|
|
1469
1691
|
type JourneysListResponse as JourneysListResponse,
|
|
@@ -1489,4 +1711,6 @@ export declare namespace Journeys {
|
|
|
1489
1711
|
type TemplateReplaceParams as TemplateReplaceParams,
|
|
1490
1712
|
type TemplateRetrieveContentParams as TemplateRetrieveContentParams,
|
|
1491
1713
|
};
|
|
1714
|
+
|
|
1715
|
+
export { Runs as Runs, type RunListParams as RunListParams };
|
|
1492
1716
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as JourneysAPI from './journeys';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Build, version, publish, invoke, and cancel multi-step notification workflows, along with the templates scoped to them.
|
|
11
|
+
*/
|
|
12
|
+
export class Runs extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* Fetch one Journey run by id. Returns `404` for an unknown run, a run belonging
|
|
15
|
+
* to another workspace, a run past the 95-day retention window, or an Automation
|
|
16
|
+
* run id — the same body in every case, so the response never reveals whether a
|
|
17
|
+
* run exists elsewhere.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const journeyRunResponse =
|
|
22
|
+
* await client.journeys.runs.retrieve('x');
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
retrieve(runID: string, options?: RequestOptions): APIPromise<JourneysAPI.JourneyRunResponse> {
|
|
26
|
+
return this._client.get(path`/journeys/runs/${runID}`, options);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List runs of the workspace's Journeys, newest first, filtered by status,
|
|
31
|
+
* Journey, or date range and paged by cursor. Runs of v2 Automations are listed by
|
|
32
|
+
* `GET /automations/runs` instead — the two surfaces never return each other's
|
|
33
|
+
* runs. Runs are retained for 95 days.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const journeyRunListResponse =
|
|
38
|
+
* await client.journeys.runs.list();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
list(
|
|
42
|
+
query: RunListParams | null | undefined = {},
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<JourneysAPI.JourneyRunListResponse> {
|
|
45
|
+
return this._client.get('/journeys/runs', { query, ...options });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* List the per-node state of one Journey run, in full — this endpoint is not
|
|
50
|
+
* paginated. Each step's `node_id` is the id of the node in the published Journey,
|
|
51
|
+
* so a step maps directly onto the Journey graph. `message_id` is present on send
|
|
52
|
+
* steps that produced a message; follow it to `GET /messages/{message_id}` for
|
|
53
|
+
* delivery status.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const journeyRunStepsResponse =
|
|
58
|
+
* await client.journeys.runs.listSteps('x');
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
listSteps(runID: string, options?: RequestOptions): APIPromise<JourneysAPI.JourneyRunStepsResponse> {
|
|
62
|
+
return this._client.get(path`/journeys/runs/${runID}/steps`, options);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface RunListParams {
|
|
67
|
+
/**
|
|
68
|
+
* A cursor token for pagination. Use the `next_cursor` from the previous response
|
|
69
|
+
* to fetch the next page of results. Treat it as opaque.
|
|
70
|
+
*/
|
|
71
|
+
cursor?: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* An inclusive upper bound on `created_at`, in the same format as `start_date`.
|
|
75
|
+
*/
|
|
76
|
+
end_date?: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The number of runs to return per page, between `1` and `50`. Defaults to `20`.
|
|
80
|
+
* Values outside the range are clamped, and a non-numeric value falls back to
|
|
81
|
+
* `20`.
|
|
82
|
+
*/
|
|
83
|
+
limit?: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* An inclusive lower bound on `created_at`, as an ISO 8601 date or timestamp (e.g.
|
|
87
|
+
* `2026-08-18` or `2026-08-18T20:06:36.259Z`). Any other format returns `400`.
|
|
88
|
+
*/
|
|
89
|
+
start_date?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A comma-separated list of run statuses to filter on, e.g. `PROCESSED,ERROR`.
|
|
93
|
+
*/
|
|
94
|
+
status?: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A comma-separated list of Journey ids to filter on.
|
|
98
|
+
*/
|
|
99
|
+
template_id?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export declare namespace Runs {
|
|
103
|
+
export { type RunListParams as RunListParams };
|
|
104
|
+
}
|
|
@@ -19,6 +19,7 @@ export {
|
|
|
19
19
|
type NotificationElementPutRequest,
|
|
20
20
|
type NotificationGetContent,
|
|
21
21
|
type NotificationLocalePutRequest,
|
|
22
|
+
type NotificationMetricsResponse,
|
|
22
23
|
type NotificationTemplateAlias,
|
|
23
24
|
type NotificationTemplateCreateRequest,
|
|
24
25
|
type NotificationTemplatePayload,
|
|
@@ -35,6 +36,7 @@ export {
|
|
|
35
36
|
type NotificationCreateParams,
|
|
36
37
|
type NotificationRetrieveParams,
|
|
37
38
|
type NotificationListParams,
|
|
39
|
+
type NotificationGetMetricsParams,
|
|
38
40
|
type NotificationListVersionsParams,
|
|
39
41
|
type NotificationPublishParams,
|
|
40
42
|
type NotificationPutContentParams,
|
|
@@ -124,6 +124,42 @@ export class Notifications extends APIResource {
|
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Fetch the delivery funnel for one Notification Template as a time series — sent,
|
|
129
|
+
* delivered, opened, clicked, errors, and undeliverable — broken out per provider
|
|
130
|
+
* and channel inside each bucket. Sum the entries in a bucket for its totals;
|
|
131
|
+
* there is no bucket-level total.
|
|
132
|
+
*
|
|
133
|
+
* Choose the window absolutely with `start` and `end`, or relatively with
|
|
134
|
+
* `lookback` (an ISO 8601 duration). `start` and `end` take precedence when both
|
|
135
|
+
* are supplied, and a request carrying neither defaults to `lookback=P30D`. The
|
|
136
|
+
* window is snapped outwards onto the `granularity` grid so every bucket it
|
|
137
|
+
* overlaps is returned whole, and the snapped boundaries come back as `start` and
|
|
138
|
+
* `end` — align a chart on those rather than on what was requested. Every boundary
|
|
139
|
+
* is UTC; there is no timezone support.
|
|
140
|
+
*
|
|
141
|
+
* Every bucket in the window is returned, including the quiet ones, whose `data`
|
|
142
|
+
* array is empty, so a series is directly plottable with no gap filling
|
|
143
|
+
* client-side. An unknown template id returns `200` with an all-empty series
|
|
144
|
+
* rather than `404`, and messages sent without a Notification Template never
|
|
145
|
+
* appear here.
|
|
146
|
+
*
|
|
147
|
+
* Available in the US region only.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const notificationMetricsResponse =
|
|
152
|
+
* await client.notifications.getMetrics('x');
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
getMetrics(
|
|
156
|
+
id: string,
|
|
157
|
+
query: NotificationGetMetricsParams | null | undefined = {},
|
|
158
|
+
options?: RequestOptions,
|
|
159
|
+
): APIPromise<NotificationMetricsResponse> {
|
|
160
|
+
return this._client.get(path`/notifications/${id}/metrics`, { query, ...options });
|
|
161
|
+
}
|
|
162
|
+
|
|
127
163
|
/**
|
|
128
164
|
* Returns a notification template's published versions, most recent first, for
|
|
129
165
|
* comparison or rollback. Paged.
|
|
@@ -546,6 +582,96 @@ export namespace NotificationLocalePutRequest {
|
|
|
546
582
|
}
|
|
547
583
|
}
|
|
548
584
|
|
|
585
|
+
export interface NotificationMetricsResponse {
|
|
586
|
+
/**
|
|
587
|
+
* End of the window actually queried, ceiled onto the granularity grid.
|
|
588
|
+
* Second-precision UTC.
|
|
589
|
+
*/
|
|
590
|
+
end: string;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Bucket size the series was built at.
|
|
594
|
+
*/
|
|
595
|
+
granularity: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH';
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* The template the series describes, echoed from the request.
|
|
599
|
+
*/
|
|
600
|
+
notificationId: string;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* One entry per bucket between `start` and `end`, oldest first, including buckets
|
|
604
|
+
* with no activity.
|
|
605
|
+
*/
|
|
606
|
+
series: Array<NotificationMetricsResponse.Series>;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Inclusive start of the window actually queried, floored onto the granularity
|
|
610
|
+
* grid. Second-precision UTC.
|
|
611
|
+
*/
|
|
612
|
+
start: string;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
export namespace NotificationMetricsResponse {
|
|
616
|
+
export interface Series {
|
|
617
|
+
/**
|
|
618
|
+
* One entry per provider and channel that handled a message in this bucket. Empty
|
|
619
|
+
* when nothing was sent.
|
|
620
|
+
*/
|
|
621
|
+
data: Array<Series.Data>;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Start of the bucket, second-precision UTC.
|
|
625
|
+
*/
|
|
626
|
+
period: string;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export namespace Series {
|
|
630
|
+
export interface Data {
|
|
631
|
+
/**
|
|
632
|
+
* Channel the provider delivered on, e.g. `email`.
|
|
633
|
+
*/
|
|
634
|
+
channel: string;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Messages with at least one tracked link click.
|
|
638
|
+
*/
|
|
639
|
+
clicked: number;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Messages the provider confirmed as delivered.
|
|
643
|
+
*/
|
|
644
|
+
delivered: number;
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Messages the provider rejected or failed on, including ones a later provider
|
|
648
|
+
* then delivered.
|
|
649
|
+
*/
|
|
650
|
+
errors: number;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Messages opened at least once. Always `0` on channels with no open tracking.
|
|
654
|
+
*/
|
|
655
|
+
opened: number;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Provider that handled the messages, e.g. `sendgrid`.
|
|
659
|
+
*/
|
|
660
|
+
provider: string;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Messages handed to the provider.
|
|
664
|
+
*/
|
|
665
|
+
sent: number;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Messages Courier could not deliver on any provider for the channel.
|
|
669
|
+
*/
|
|
670
|
+
undeliverable: number;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
549
675
|
/**
|
|
550
676
|
* A template's send-time alias as returned by a read, omitted entirely when it has
|
|
551
677
|
* none. Usually a single string; an array for a template that resolves from
|
|
@@ -916,6 +1042,38 @@ export interface NotificationListParams {
|
|
|
916
1042
|
notes?: boolean | null;
|
|
917
1043
|
}
|
|
918
1044
|
|
|
1045
|
+
export interface NotificationGetMetricsParams {
|
|
1046
|
+
/**
|
|
1047
|
+
* The end of the window, as an ISO 8601 timestamp with an offset. Must be supplied
|
|
1048
|
+
* together with `start`. An `end` in the future is accepted and not clamped — the
|
|
1049
|
+
* trailing buckets come back empty.
|
|
1050
|
+
*/
|
|
1051
|
+
end?: string;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* The size of each bucket in the series. Defaults to `DAY`. `WEEK` buckets start
|
|
1055
|
+
* on Sunday. A fine granularity caps the window it can cover: `HOUR` spans at most
|
|
1056
|
+
* 7 days and `DAY` at most 90 days, and a wider window returns `400` — request a
|
|
1057
|
+
* coarser granularity instead. `WEEK` and `MONTH` are uncapped, subject to the
|
|
1058
|
+
* 1000-bucket limit on a single response.
|
|
1059
|
+
*/
|
|
1060
|
+
granularity?: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH';
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* The length of the window, counted back from now, as an ISO 8601 duration
|
|
1064
|
+
* (`P30D`, `P12W`, `PT12H`). Defaults to `P30D`, and is ignored when `start` and
|
|
1065
|
+
* `end` are supplied. A malformed or non-positive duration returns `400`.
|
|
1066
|
+
*/
|
|
1067
|
+
lookback?: string;
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* The inclusive start of the window, as an ISO 8601 timestamp with an offset
|
|
1071
|
+
* (`2026-04-01T00:00:00Z`). Must be supplied together with `end` and be earlier
|
|
1072
|
+
* than it; either one alone returns `400`.
|
|
1073
|
+
*/
|
|
1074
|
+
start?: string;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
919
1077
|
export interface NotificationListVersionsParams {
|
|
920
1078
|
/**
|
|
921
1079
|
* Opaque pagination cursor from a previous response. Omit for the first page.
|
|
@@ -1088,6 +1246,7 @@ export declare namespace Notifications {
|
|
|
1088
1246
|
type NotificationElementPutRequest as NotificationElementPutRequest,
|
|
1089
1247
|
type NotificationGetContent as NotificationGetContent,
|
|
1090
1248
|
type NotificationLocalePutRequest as NotificationLocalePutRequest,
|
|
1249
|
+
type NotificationMetricsResponse as NotificationMetricsResponse,
|
|
1091
1250
|
type NotificationTemplateAlias as NotificationTemplateAlias,
|
|
1092
1251
|
type NotificationTemplateCreateRequest as NotificationTemplateCreateRequest,
|
|
1093
1252
|
type NotificationTemplatePayload as NotificationTemplatePayload,
|
|
@@ -1104,6 +1263,7 @@ export declare namespace Notifications {
|
|
|
1104
1263
|
type NotificationCreateParams as NotificationCreateParams,
|
|
1105
1264
|
type NotificationRetrieveParams as NotificationRetrieveParams,
|
|
1106
1265
|
type NotificationListParams as NotificationListParams,
|
|
1266
|
+
type NotificationGetMetricsParams as NotificationGetMetricsParams,
|
|
1107
1267
|
type NotificationListVersionsParams as NotificationListVersionsParams,
|
|
1108
1268
|
type NotificationPublishParams as NotificationPublishParams,
|
|
1109
1269
|
type NotificationPutContentParams as NotificationPutContentParams,
|
|
@@ -244,6 +244,20 @@ export interface TopicPreference {
|
|
|
244
244
|
* custom_routing) rather than the topic's default routing.
|
|
245
245
|
*/
|
|
246
246
|
has_custom_routing?: boolean | null;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The unique identifier of the section this topic belongs to. Always present when
|
|
250
|
+
* listing a user's preferences; omitted by the single-topic read when the topic
|
|
251
|
+
* has no resolvable section.
|
|
252
|
+
*/
|
|
253
|
+
section_id?: string;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* The display name of the section this topic belongs to. Always present when
|
|
257
|
+
* listing a user's preferences; omitted by the single-topic read when the topic
|
|
258
|
+
* has no resolvable section.
|
|
259
|
+
*/
|
|
260
|
+
section_name?: string;
|
|
247
261
|
}
|
|
248
262
|
|
|
249
263
|
export interface PreferenceRetrieveResponse {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '9.
|
|
1
|
+
export const VERSION = '9.2.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "9.
|
|
1
|
+
export declare const VERSION = "9.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "9.
|
|
1
|
+
export declare const VERSION = "9.2.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '9.
|
|
1
|
+
export const VERSION = '9.2.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|