@trycourier/courier 3.8.0 → 3.10.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 +15 -1
- package/README.md +48 -2
- package/lib/bulk/types.d.ts +9 -1
- package/lib/client.js +2 -2
- package/lib/send/types.d.ts +9 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased][unreleased]
|
|
7
7
|
|
|
8
|
+
## [3.10.1] - 2022-03-20
|
|
9
|
+
- adds support for messages timeout (`message.timeout`)
|
|
10
|
+
|
|
11
|
+
## [3.10.0] - 2020-03-24
|
|
12
|
+
- adds support for messages brand_id (`message.brand_id`)
|
|
13
|
+
|
|
14
|
+
## [3.9.0] - 2022-03-17
|
|
15
|
+
|
|
16
|
+
- adds support for bulk messaging API v2 support
|
|
17
|
+
|
|
8
18
|
## [3.8.0] - 2022-03-14
|
|
9
19
|
|
|
10
20
|
- adds additional types for utm property (`message.metadata.utm`)
|
|
@@ -214,7 +224,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
214
224
|
|
|
215
225
|
## v1.0.1 - 2019-07-12
|
|
216
226
|
|
|
217
|
-
[unreleased]: https://github.com/trycourier/courier-node/compare/v3.
|
|
227
|
+
[unreleased]: https://github.com/trycourier/courier-node/compare/v3.9.0...HEAD
|
|
228
|
+
[v3.9.0]: https://github.com/trycourier/courier-node/compare/v3.8.0...v3.9.0
|
|
229
|
+
[v3.8.0]: https://github.com/trycourier/courier-node/compare/v3.7.0...v3.8.0
|
|
230
|
+
[v3.7.0]: https://github.com/trycourier/courier-node/compare/v3.6.0...v3.7.0
|
|
231
|
+
[v3.6.0]: https://github.com/trycourier/courier-node/compare/v3.5.0...v3.6.0
|
|
218
232
|
[v3.5.0]: https://github.com/trycourier/courier-node/compare/v3.4.0...v3.5.0
|
|
219
233
|
[v3.4.0]: https://github.com/trycourier/courier-node/compare/v3.3.0...v3.4.0
|
|
220
234
|
[v3.3.0]: https://github.com/trycourier/courier-node/compare/v3.2.1...v3.3.0
|
package/README.md
CHANGED
|
@@ -160,6 +160,29 @@ const { requestId } = await courier.send({
|
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
162
|
});
|
|
163
|
+
|
|
164
|
+
// Example: send a basic message that expires after the specified timeout
|
|
165
|
+
const { requestId } = await courier.send({
|
|
166
|
+
message: {
|
|
167
|
+
to: {
|
|
168
|
+
data: {
|
|
169
|
+
name: "Marty",
|
|
170
|
+
},
|
|
171
|
+
email: "marty_mcfly@email.com",
|
|
172
|
+
},
|
|
173
|
+
content: {
|
|
174
|
+
title: "Back to the Future",
|
|
175
|
+
body: "Oh my {{name}}, we need 1.21 Gigawatts!",
|
|
176
|
+
},
|
|
177
|
+
routing: {
|
|
178
|
+
method: "single",
|
|
179
|
+
channels: ["email"],
|
|
180
|
+
},
|
|
181
|
+
timeout: {
|
|
182
|
+
message: 3600000 // 1 hour in milliseconds
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
});
|
|
163
186
|
```
|
|
164
187
|
|
|
165
188
|
## Environment Variables
|
|
@@ -497,7 +520,7 @@ async function run() {
|
|
|
497
520
|
await courier.notifications.cancelSubmission("notification1", "submission1");
|
|
498
521
|
|
|
499
522
|
// Bulk Processing
|
|
500
|
-
// Example: create a job
|
|
523
|
+
// Example: create a job (API v1 semantics)
|
|
501
524
|
const response = await courier.bulk.createJob({
|
|
502
525
|
message: {
|
|
503
526
|
event: "RR4NDQ7NZ24A8TKPWVBEDGE15E9A",
|
|
@@ -505,13 +528,23 @@ async function run() {
|
|
|
505
528
|
});
|
|
506
529
|
console.log(response);
|
|
507
530
|
|
|
531
|
+
// Example: create a job (API v2 semantics)
|
|
532
|
+
const response = await courier.bulk.createJob({
|
|
533
|
+
message: {
|
|
534
|
+
message: {
|
|
535
|
+
template: "RR4NDQ7NZ24A8TKPWVBEDGE15E9A",
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
});
|
|
539
|
+
console.log(response);
|
|
540
|
+
|
|
508
541
|
// Example: get a job
|
|
509
542
|
const response = await courier.bulk.getJob({
|
|
510
543
|
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
|
511
544
|
});
|
|
512
545
|
console.log(response);
|
|
513
546
|
|
|
514
|
-
// Example: Ingest users in a job
|
|
547
|
+
// Example: Ingest users in a job (API v1 semantics)
|
|
515
548
|
const response = await courier.bulk.ingestUsers({
|
|
516
549
|
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
|
517
550
|
users: [
|
|
@@ -524,6 +557,19 @@ async function run() {
|
|
|
524
557
|
});
|
|
525
558
|
console.log(response);
|
|
526
559
|
|
|
560
|
+
// Example: Ingest users in a job (API v2 semantics)
|
|
561
|
+
const response = await courier.bulk.ingestUsers({
|
|
562
|
+
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
|
563
|
+
users: [
|
|
564
|
+
{
|
|
565
|
+
to: {
|
|
566
|
+
email: "tejas@courier.com",
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
],
|
|
570
|
+
});
|
|
571
|
+
console.log(response);
|
|
572
|
+
|
|
527
573
|
// Example: Run a job
|
|
528
574
|
await courier.bulk.runJob({
|
|
529
575
|
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
package/lib/bulk/types.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { IRecipientPreferences } from "../preferences/types";
|
|
2
|
-
|
|
2
|
+
import { Message, UserRecipient } from "../send/types";
|
|
3
|
+
interface IInboundBulkMessageApiV1 {
|
|
3
4
|
brand?: string;
|
|
4
5
|
data?: object;
|
|
5
6
|
event: string;
|
|
6
7
|
locale?: string;
|
|
7
8
|
override?: object;
|
|
8
9
|
}
|
|
10
|
+
declare type InboundBulkMessageApiV2 = Omit<Message, "to">;
|
|
11
|
+
export interface IInboundBulkMessage extends IInboundBulkMessageApiV1 {
|
|
12
|
+
message?: InboundBulkMessageApiV2;
|
|
13
|
+
}
|
|
14
|
+
export declare type InboundBulkMessage = IInboundBulkMessage;
|
|
9
15
|
export interface ICourierBulkConfig {
|
|
10
16
|
idempotencyKey?: string;
|
|
11
17
|
idempotencyExpiry?: number;
|
|
@@ -21,6 +27,7 @@ export interface IInboundBulkMessageUser {
|
|
|
21
27
|
profile?: object;
|
|
22
28
|
recipient?: string;
|
|
23
29
|
data?: object;
|
|
30
|
+
to?: UserRecipient;
|
|
24
31
|
}
|
|
25
32
|
export declare type InboundBulkMessageUser = IInboundBulkMessageUser;
|
|
26
33
|
export interface ICourierBulkIngestUsersParams {
|
|
@@ -74,3 +81,4 @@ export interface ICourierClientBulk {
|
|
|
74
81
|
getJob: (params: ICourierBulkGetJobParams) => Promise<ICourierBulkGetJobResponse>;
|
|
75
82
|
getJobUsers: (params: ICourierBulkGetJobUsersParams) => Promise<ICourierBulkGetJobUsersResponse>;
|
|
76
83
|
}
|
|
84
|
+
export {};
|
package/lib/client.js
CHANGED
|
@@ -98,8 +98,8 @@ var getMessages = function (options) {
|
|
|
98
98
|
notification: params === null || params === void 0 ? void 0 : params.notificationId,
|
|
99
99
|
recipient: params === null || params === void 0 ? void 0 : params.recipientId,
|
|
100
100
|
status: params === null || params === void 0 ? void 0 : params.status,
|
|
101
|
-
tags: params === null || params === void 0 ? void 0 : params.tags
|
|
102
|
-
}
|
|
101
|
+
tags: params === null || params === void 0 ? void 0 : params.tags
|
|
102
|
+
}
|
|
103
103
|
})];
|
|
104
104
|
case 1:
|
|
105
105
|
res = _a.sent();
|
package/lib/send/types.d.ts
CHANGED
|
@@ -236,13 +236,22 @@ export interface ElementalContentSugar {
|
|
|
236
236
|
body?: string;
|
|
237
237
|
title?: string;
|
|
238
238
|
}
|
|
239
|
+
export interface Timeout {
|
|
240
|
+
provider?: number;
|
|
241
|
+
channel?: number;
|
|
242
|
+
message?: number;
|
|
243
|
+
escalation?: number;
|
|
244
|
+
criteria?: "no-escalation" | "delivered" | "viewed" | "engaged";
|
|
245
|
+
}
|
|
239
246
|
export declare type Content = ElementalContentSugar | ElementalContent;
|
|
240
247
|
export interface BaseMessage {
|
|
248
|
+
brand_id?: string;
|
|
241
249
|
channels?: MessageChannels;
|
|
242
250
|
data?: MessageData;
|
|
243
251
|
metadata?: MessageMetadata;
|
|
244
252
|
providers?: MessageProviders;
|
|
245
253
|
routing?: Routing;
|
|
254
|
+
timeout?: Timeout;
|
|
246
255
|
to: MessageRecipient;
|
|
247
256
|
}
|
|
248
257
|
interface TrackingOverride {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/courier",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.1",
|
|
4
4
|
"description": "A node.js module for communicating with the Courier REST API.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"axios": "^0.21.1"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|