@trycourier/courier 3.10.1 → 3.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/README.md +123 -0
- package/lib/audiences/index.d.ts +9 -0
- package/lib/audiences/index.js +108 -0
- package/lib/audiences/types.d.ts +61 -0
- package/lib/audiences/types.js +2 -0
- package/lib/client.js +5 -3
- package/lib/send/types.d.ts +26 -10
- package/lib/types.d.ts +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,10 +5,24 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased][unreleased]
|
|
7
7
|
|
|
8
|
+
## [3.13.1] - 2022-06-03
|
|
9
|
+
|
|
10
|
+
- adds provider and channel timeout
|
|
11
|
+
|
|
12
|
+
## [3.12.0] - 2022-03-31
|
|
13
|
+
|
|
14
|
+
- adds support for message trace id (`message.metadata.trace_id`)
|
|
15
|
+
|
|
16
|
+
## [3.11.0] - 2022-03-23
|
|
17
|
+
|
|
18
|
+
- adds support for `audiences`
|
|
19
|
+
|
|
8
20
|
## [3.10.1] - 2022-03-20
|
|
21
|
+
|
|
9
22
|
- adds support for messages timeout (`message.timeout`)
|
|
10
23
|
|
|
11
24
|
## [3.10.0] - 2020-03-24
|
|
25
|
+
|
|
12
26
|
- adds support for messages brand_id (`message.brand_id`)
|
|
13
27
|
|
|
14
28
|
## [3.9.0] - 2022-03-17
|
|
@@ -224,7 +238,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
224
238
|
|
|
225
239
|
## v1.0.1 - 2019-07-12
|
|
226
240
|
|
|
227
|
-
[unreleased]: https://github.com/trycourier/courier-node/compare/v3.
|
|
241
|
+
[unreleased]: https://github.com/trycourier/courier-node/compare/v3.11.0...HEAD
|
|
242
|
+
[v3.11.0]: https://github.com/trycourier/courier-node/compare/v3.10.0...v3.11.0
|
|
243
|
+
[v3.10.0]: https://github.com/trycourier/courier-node/compare/v3.9.0...v3.10.0
|
|
228
244
|
[v3.9.0]: https://github.com/trycourier/courier-node/compare/v3.8.0...v3.9.0
|
|
229
245
|
[v3.8.0]: https://github.com/trycourier/courier-node/compare/v3.7.0...v3.8.0
|
|
230
246
|
[v3.7.0]: https://github.com/trycourier/courier-node/compare/v3.6.0...v3.7.0
|
package/README.md
CHANGED
|
@@ -183,6 +183,29 @@ const { requestId } = await courier.send({
|
|
|
183
183
|
},
|
|
184
184
|
},
|
|
185
185
|
});
|
|
186
|
+
|
|
187
|
+
// Example: send a basic message with a trace id
|
|
188
|
+
const { requestId } = await courier.send({
|
|
189
|
+
message: {
|
|
190
|
+
to: {
|
|
191
|
+
data: {
|
|
192
|
+
name: "Marty",
|
|
193
|
+
},
|
|
194
|
+
email: "marty_mcfly@email.com",
|
|
195
|
+
},
|
|
196
|
+
content: {
|
|
197
|
+
title: "Back to the Future",
|
|
198
|
+
body: "Oh my {{name}}, we need 1.21 Gigawatts!",
|
|
199
|
+
},
|
|
200
|
+
routing: {
|
|
201
|
+
method: "single",
|
|
202
|
+
channels: ["email"],
|
|
203
|
+
},
|
|
204
|
+
metadata: {
|
|
205
|
+
trace_id: "ravenclaw-for-the-win"
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
});
|
|
186
209
|
```
|
|
187
210
|
|
|
188
211
|
## Environment Variables
|
|
@@ -217,6 +240,70 @@ async function run() {
|
|
|
217
240
|
});
|
|
218
241
|
console.log(requestId);
|
|
219
242
|
|
|
243
|
+
// Example: send message with utm metadata
|
|
244
|
+
const { requestId } = await courier.send({
|
|
245
|
+
message: {
|
|
246
|
+
template: "<TEMPLATE_OR_EVENT_ID>",
|
|
247
|
+
to: {...},
|
|
248
|
+
routing: {
|
|
249
|
+
method: "single",
|
|
250
|
+
channels: ["email"],
|
|
251
|
+
},
|
|
252
|
+
channels: {
|
|
253
|
+
email: {
|
|
254
|
+
routing_method: "all",
|
|
255
|
+
providers: ["sendgrid", "sns"],
|
|
256
|
+
metadata: {
|
|
257
|
+
utm: {
|
|
258
|
+
medium: "f",
|
|
259
|
+
campaign: "g",
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
providers: {
|
|
265
|
+
sns: {
|
|
266
|
+
metadata: {
|
|
267
|
+
utm: {
|
|
268
|
+
medium: "h",
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
}, // optional
|
|
273
|
+
metadata: {
|
|
274
|
+
utm: {
|
|
275
|
+
source: "a",
|
|
276
|
+
medium: "b",
|
|
277
|
+
campaign: "c",
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
timeout: {
|
|
281
|
+
message: 300000,
|
|
282
|
+
channel: {
|
|
283
|
+
email: 1000 // 1 second
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* If the template or content contains any action blocks, the hyperlinks will be augmented with utm compliant query parameters.
|
|
291
|
+
*
|
|
292
|
+
* The resulting link of an action block sent through sendgrid would be:
|
|
293
|
+
* www.example.com?utm_source=a&utm_medium=f&utm_campaign=g
|
|
294
|
+
*
|
|
295
|
+
* While the resulting link of an action block sent through sns would be:
|
|
296
|
+
* www.example.com?utm_source=a&utm_medium=h&utm_campaign=g
|
|
297
|
+
*
|
|
298
|
+
* Notice that provider metadata supersedes channel metadata and channel metadata supersedes message metadata
|
|
299
|
+
*
|
|
300
|
+
**/
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* If the message includes a timeout property we will start timing out messages after the first attempt.
|
|
304
|
+
* We are able to timeout complete channels or specific providers.
|
|
305
|
+
**/
|
|
306
|
+
|
|
220
307
|
// Example: get a message status
|
|
221
308
|
const messageStatus = await courier.getMessage(requestId);
|
|
222
309
|
console.log(messageStatus);
|
|
@@ -619,6 +706,42 @@ async function run() {
|
|
|
619
706
|
run();
|
|
620
707
|
```
|
|
621
708
|
|
|
709
|
+
### Audiences
|
|
710
|
+
|
|
711
|
+
Audiences APIs are used to create, get, update, and delete audiences. A Courier Audience is a dynamic group of users (created using Courier's Profile API) that matches a set of criteria. Audience is reactive to changes in the user's profile. As you change user profile using `profiles` API, the audience will be updated accordingly. You will not have to maintain a list of users in your audience. Courier takes care of that for you. If you have potentially large set of users, you first create an audience and then use the audience's id to retrieve the list of users. Once you satified with the calculated list of users, you can use the `audienceId` to send notification using `send` API.
|
|
712
|
+
|
|
713
|
+
```ts
|
|
714
|
+
// Example: create audience which would allow sending notification to all users that match the given filter criteria
|
|
715
|
+
const { audienceId } = await courier.audiences.put({
|
|
716
|
+
id: "<AUDIENCE_ID>",
|
|
717
|
+
filter: {
|
|
718
|
+
operator: "EQ",
|
|
719
|
+
path: "title",
|
|
720
|
+
value: "Software Engineer",
|
|
721
|
+
},
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// To retrieve list of members in a given audience, you can use the following:
|
|
725
|
+
const { items: audienceMembers } = await courier.audiences.listMembers(
|
|
726
|
+
audienceId
|
|
727
|
+
);
|
|
728
|
+
|
|
729
|
+
// To send a notification to all users that match the given filter criteria, you can use the following:
|
|
730
|
+
const { requestId } = await courier.send({
|
|
731
|
+
message: {
|
|
732
|
+
template: "<TEMPLATE_OR_EVENT_ID>", // This can be inline content as well
|
|
733
|
+
to: {
|
|
734
|
+
audience_id: audienceId,
|
|
735
|
+
},
|
|
736
|
+
data: {}, // optional
|
|
737
|
+
brand_id: "<BRAND_ID>", //optional
|
|
738
|
+
routing: {},
|
|
739
|
+
channels: {}, // optional
|
|
740
|
+
providers: {}, // optional
|
|
741
|
+
},
|
|
742
|
+
});
|
|
743
|
+
```
|
|
744
|
+
|
|
622
745
|
## License
|
|
623
746
|
|
|
624
747
|
[MIT License](http://www.opensource.org/licenses/mit-license.php)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICourierClientConfiguration } from "../types";
|
|
2
|
+
import * as AudienceTypes from "./types";
|
|
3
|
+
export declare const audiences: (options: ICourierClientConfiguration) => {
|
|
4
|
+
delete: (audienceId: string) => Promise<void>;
|
|
5
|
+
get: (audienceId: string) => Promise<AudienceTypes.IAudience>;
|
|
6
|
+
listAudiences: () => Promise<AudienceTypes.IAudienceListResponse>;
|
|
7
|
+
listMembers: (audienceId: string) => Promise<AudienceTypes.IAudienceMemberListResponse>;
|
|
8
|
+
put: (audience: Omit<AudienceTypes.IAudience, "created_at" | "updated_at">) => Promise<AudienceTypes.IAudience>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.audiences = void 0;
|
|
40
|
+
var deleteAudience = function (options) { return function (audienceId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
return __generator(this, function (_a) {
|
|
42
|
+
switch (_a.label) {
|
|
43
|
+
case 0: return [4 /*yield*/, options.httpClient.delete("/audiences/" + audienceId)];
|
|
44
|
+
case 1:
|
|
45
|
+
_a.sent();
|
|
46
|
+
return [2 /*return*/];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}); }; };
|
|
50
|
+
var getAudience = function (options) {
|
|
51
|
+
return function (audienceId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var response;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audienceId)];
|
|
56
|
+
case 1:
|
|
57
|
+
response = _a.sent();
|
|
58
|
+
return [2 /*return*/, response.data.audience];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}); };
|
|
62
|
+
};
|
|
63
|
+
var listAudiences = function (options) {
|
|
64
|
+
return function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
+
var response;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/audiences")];
|
|
69
|
+
case 1:
|
|
70
|
+
response = _a.sent();
|
|
71
|
+
return [2 /*return*/, response.data];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}); };
|
|
75
|
+
};
|
|
76
|
+
var listMembers = function (options) {
|
|
77
|
+
return function (audienceId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
+
var response;
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
switch (_a.label) {
|
|
81
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audienceId + "/members")];
|
|
82
|
+
case 1:
|
|
83
|
+
response = _a.sent();
|
|
84
|
+
return [2 /*return*/, response.data];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); };
|
|
88
|
+
};
|
|
89
|
+
var putAudience = function (options) {
|
|
90
|
+
return function (audience) { return __awaiter(void 0, void 0, void 0, function () {
|
|
91
|
+
var response;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, options.httpClient.get("/audiences/" + audience.id)];
|
|
95
|
+
case 1:
|
|
96
|
+
response = _a.sent();
|
|
97
|
+
return [2 /*return*/, response.data.audience];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); };
|
|
101
|
+
};
|
|
102
|
+
exports.audiences = function (options) { return ({
|
|
103
|
+
delete: deleteAudience(options),
|
|
104
|
+
get: getAudience(options),
|
|
105
|
+
listAudiences: listAudiences(options),
|
|
106
|
+
listMembers: listMembers(options),
|
|
107
|
+
put: putAudience(options),
|
|
108
|
+
}); };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare type ComparisonOperator = "EQ" | "GT" | "GTE" | "INCLUDES" | "LT" | "LTE" | "NEQ" | "OMIT";
|
|
2
|
+
export declare type LogicalOperator = "AND" | "OR";
|
|
3
|
+
export declare type Operator = ComparisonOperator | LogicalOperator;
|
|
4
|
+
declare type Without<T, U> = {
|
|
5
|
+
[P in Exclude<keyof T, keyof U>]?: never;
|
|
6
|
+
};
|
|
7
|
+
declare type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
|
8
|
+
interface IBaseFilterConfig {
|
|
9
|
+
operator: Operator;
|
|
10
|
+
}
|
|
11
|
+
interface ISingleFilterConfig extends IBaseFilterConfig {
|
|
12
|
+
path: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
interface INestedFilterConfig extends IBaseFilterConfig {
|
|
16
|
+
rules: FilterConfig[];
|
|
17
|
+
}
|
|
18
|
+
export declare type FilterConfig = XOR<ISingleFilterConfig, INestedFilterConfig>;
|
|
19
|
+
export interface IAudience {
|
|
20
|
+
created_at: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
id: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
filter: FilterConfig;
|
|
25
|
+
updated_at: string;
|
|
26
|
+
}
|
|
27
|
+
export interface IAudienceMember {
|
|
28
|
+
added_at: string;
|
|
29
|
+
audience_id: string;
|
|
30
|
+
audience_version: number;
|
|
31
|
+
member_id: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
}
|
|
34
|
+
export interface IAudienceListResponse {
|
|
35
|
+
items: IAudience[];
|
|
36
|
+
paging: {
|
|
37
|
+
cursor: string;
|
|
38
|
+
more: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface IAudienceMemberGetResponse {
|
|
42
|
+
audienceMember: IAudienceMember;
|
|
43
|
+
}
|
|
44
|
+
export interface IAudienceMemberListResponse {
|
|
45
|
+
items: IAudienceMember[];
|
|
46
|
+
paging: {
|
|
47
|
+
cursor: string;
|
|
48
|
+
more: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface IAudiencePutResponse {
|
|
52
|
+
audience: IAudience;
|
|
53
|
+
}
|
|
54
|
+
export interface ICourierClientAudiences {
|
|
55
|
+
delete: (id: string) => Promise<void>;
|
|
56
|
+
get: (id: string) => Promise<IAudience>;
|
|
57
|
+
listAudiences: () => Promise<IAudienceListResponse>;
|
|
58
|
+
listMembers: (id: string) => Promise<IAudienceMemberListResponse>;
|
|
59
|
+
put: (audience: Omit<IAudience, "created_at" | "updated_at">) => Promise<IAudience>;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
package/lib/client.js
CHANGED
|
@@ -37,6 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.client = void 0;
|
|
40
|
+
var audiences_1 = require("./audiences");
|
|
40
41
|
var automations_1 = require("./automations");
|
|
41
42
|
var brands_1 = require("./brands");
|
|
42
43
|
var bulk_1 = require("./bulk");
|
|
@@ -98,8 +99,8 @@ var getMessages = function (options) {
|
|
|
98
99
|
notification: params === null || params === void 0 ? void 0 : params.notificationId,
|
|
99
100
|
recipient: params === null || params === void 0 ? void 0 : params.recipientId,
|
|
100
101
|
status: params === null || params === void 0 ? void 0 : params.status,
|
|
101
|
-
tags: params === null || params === void 0 ? void 0 : params.tags
|
|
102
|
-
}
|
|
102
|
+
tags: params === null || params === void 0 ? void 0 : params.tags,
|
|
103
|
+
},
|
|
103
104
|
})];
|
|
104
105
|
case 1:
|
|
105
106
|
res = _a.sent();
|
|
@@ -111,6 +112,7 @@ var getMessages = function (options) {
|
|
|
111
112
|
exports.client = function (options) {
|
|
112
113
|
return {
|
|
113
114
|
addRecipientToLists: profile_1.addRecipientToLists(options),
|
|
115
|
+
audiences: audiences_1.audiences(options),
|
|
114
116
|
automations: automations_1.automations(options),
|
|
115
117
|
bulk: bulk_1.bulk(options),
|
|
116
118
|
createBrand: brands_1.createBrand(options),
|
|
@@ -131,6 +133,6 @@ exports.client = function (options) {
|
|
|
131
133
|
removeRecipientFromAllLists: profile_1.removeRecipientFromAllLists(options),
|
|
132
134
|
replaceBrand: brands_1.replaceBrand(options),
|
|
133
135
|
replaceProfile: profile_1.replaceProfile(options),
|
|
134
|
-
send: send_1.send(options)
|
|
136
|
+
send: send_1.send(options),
|
|
135
137
|
};
|
|
136
138
|
};
|
package/lib/send/types.d.ts
CHANGED
|
@@ -222,6 +222,10 @@ interface InvalidUserRecipient {
|
|
|
222
222
|
declare type UserRecipientType = Record<string, unknown> & {
|
|
223
223
|
[key in keyof InvalidUserRecipient]?: never;
|
|
224
224
|
};
|
|
225
|
+
export interface AudienceRecipient {
|
|
226
|
+
audience_id: string;
|
|
227
|
+
data?: MessageData;
|
|
228
|
+
}
|
|
225
229
|
export interface UserRecipient extends UserRecipientType {
|
|
226
230
|
data?: MessageData;
|
|
227
231
|
email?: string;
|
|
@@ -230,15 +234,19 @@ export interface UserRecipient extends UserRecipientType {
|
|
|
230
234
|
phone_number?: string;
|
|
231
235
|
preferences?: IProfilePreferences;
|
|
232
236
|
}
|
|
233
|
-
export declare type Recipient = ListRecipient | ListPatternRecipient | UserRecipient;
|
|
237
|
+
export declare type Recipient = AudienceRecipient | ListRecipient | ListPatternRecipient | UserRecipient;
|
|
234
238
|
export declare type MessageRecipient = Recipient | Recipient[];
|
|
235
239
|
export interface ElementalContentSugar {
|
|
236
240
|
body?: string;
|
|
237
241
|
title?: string;
|
|
238
242
|
}
|
|
239
243
|
export interface Timeout {
|
|
240
|
-
provider?:
|
|
241
|
-
|
|
244
|
+
provider?: {
|
|
245
|
+
[provider: string]: number;
|
|
246
|
+
};
|
|
247
|
+
channel?: {
|
|
248
|
+
[channel: string]: number;
|
|
249
|
+
};
|
|
242
250
|
message?: number;
|
|
243
251
|
escalation?: number;
|
|
244
252
|
criteria?: "no-escalation" | "delivered" | "viewed" | "engaged";
|
|
@@ -307,6 +315,9 @@ export interface MessageChannels {
|
|
|
307
315
|
channel?: number;
|
|
308
316
|
};
|
|
309
317
|
override?: MessageChannelEmailOverride | MessageChannelPushOverride;
|
|
318
|
+
metadata?: {
|
|
319
|
+
utm?: UTM;
|
|
320
|
+
};
|
|
310
321
|
};
|
|
311
322
|
}
|
|
312
323
|
export interface Routing {
|
|
@@ -325,17 +336,22 @@ export interface RoutingStrategyProvider<T = Record<string, any>> {
|
|
|
325
336
|
name: string;
|
|
326
337
|
config?: T;
|
|
327
338
|
if?: string;
|
|
339
|
+
metadata?: {
|
|
340
|
+
utm?: UTM;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
export interface UTM {
|
|
344
|
+
source?: string;
|
|
345
|
+
medium?: string;
|
|
346
|
+
campaign?: string;
|
|
347
|
+
term?: string;
|
|
348
|
+
content?: string;
|
|
328
349
|
}
|
|
329
350
|
export interface MessageMetadata {
|
|
330
351
|
event?: string;
|
|
331
352
|
tags?: string[];
|
|
332
|
-
utm?:
|
|
333
|
-
|
|
334
|
-
medium?: string;
|
|
335
|
-
campaign?: string;
|
|
336
|
-
term?: string;
|
|
337
|
-
content?: string;
|
|
338
|
-
};
|
|
353
|
+
utm?: UTM;
|
|
354
|
+
trace_id?: string;
|
|
339
355
|
}
|
|
340
356
|
export interface ContentMessage extends BaseMessage {
|
|
341
357
|
content: Content;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { ICourierClientAudiences } from "./audiences/types";
|
|
2
3
|
import { ICourierClientAutomations } from "./automations/types";
|
|
3
4
|
import { ICourierClientBulk } from "./bulk/types";
|
|
4
5
|
import { ICourierClientLists, ICourierList, ICourierRecipientSubscriptionsResponse } from "./lists/types";
|
|
@@ -286,6 +287,7 @@ export interface ICourierBrandGetAllResponse {
|
|
|
286
287
|
export declare type SendResponse<T extends ICourierSendParameters | ICourierSendMessageParameters> = T extends ICourierSendParameters ? ICourierSendResponse : ICourierSendMessageResponse;
|
|
287
288
|
export interface ICourierClient {
|
|
288
289
|
addRecipientToLists: (params: ICourierProfileListsPostParameters) => Promise<ICourierProfilePostResponse>;
|
|
290
|
+
audiences: ICourierClientAudiences;
|
|
289
291
|
automations: ICourierClientAutomations;
|
|
290
292
|
bulk: ICourierClientBulk;
|
|
291
293
|
createBrand: (params: ICourierBrandParameters, config?: ICourierBrandPostConfig) => Promise<ICourierBrand>;
|