@trycourier/courier 3.8.0 → 3.9.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 +9 -1
- package/README.md +25 -2
- package/lib/bulk/types.d.ts +9 -1
- package/lib/client.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased][unreleased]
|
|
7
7
|
|
|
8
|
+
## [3.9.0] - 2022-03-17
|
|
9
|
+
|
|
10
|
+
- adds support for bulk messaging API v2 support
|
|
11
|
+
|
|
8
12
|
## [3.8.0] - 2022-03-14
|
|
9
13
|
|
|
10
14
|
- adds additional types for utm property (`message.metadata.utm`)
|
|
@@ -214,7 +218,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
214
218
|
|
|
215
219
|
## v1.0.1 - 2019-07-12
|
|
216
220
|
|
|
217
|
-
[unreleased]: https://github.com/trycourier/courier-node/compare/v3.
|
|
221
|
+
[unreleased]: https://github.com/trycourier/courier-node/compare/v3.9.0...HEAD
|
|
222
|
+
[v3.9.0]: https://github.com/trycourier/courier-node/compare/v3.8.0...v3.9.0
|
|
223
|
+
[v3.8.0]: https://github.com/trycourier/courier-node/compare/v3.7.0...v3.8.0
|
|
224
|
+
[v3.7.0]: https://github.com/trycourier/courier-node/compare/v3.6.0...v3.7.0
|
|
225
|
+
[v3.6.0]: https://github.com/trycourier/courier-node/compare/v3.5.0...v3.6.0
|
|
218
226
|
[v3.5.0]: https://github.com/trycourier/courier-node/compare/v3.4.0...v3.5.0
|
|
219
227
|
[v3.4.0]: https://github.com/trycourier/courier-node/compare/v3.3.0...v3.4.0
|
|
220
228
|
[v3.3.0]: https://github.com/trycourier/courier-node/compare/v3.2.1...v3.3.0
|
package/README.md
CHANGED
|
@@ -497,7 +497,7 @@ async function run() {
|
|
|
497
497
|
await courier.notifications.cancelSubmission("notification1", "submission1");
|
|
498
498
|
|
|
499
499
|
// Bulk Processing
|
|
500
|
-
// Example: create a job
|
|
500
|
+
// Example: create a job (API v1 semantics)
|
|
501
501
|
const response = await courier.bulk.createJob({
|
|
502
502
|
message: {
|
|
503
503
|
event: "RR4NDQ7NZ24A8TKPWVBEDGE15E9A",
|
|
@@ -505,13 +505,23 @@ async function run() {
|
|
|
505
505
|
});
|
|
506
506
|
console.log(response);
|
|
507
507
|
|
|
508
|
+
// Example: create a job (API v2 semantics)
|
|
509
|
+
const response = await courier.bulk.createJob({
|
|
510
|
+
message: {
|
|
511
|
+
message: {
|
|
512
|
+
template: "RR4NDQ7NZ24A8TKPWVBEDGE15E9A",
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
});
|
|
516
|
+
console.log(response);
|
|
517
|
+
|
|
508
518
|
// Example: get a job
|
|
509
519
|
const response = await courier.bulk.getJob({
|
|
510
520
|
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
|
511
521
|
});
|
|
512
522
|
console.log(response);
|
|
513
523
|
|
|
514
|
-
// Example: Ingest users in a job
|
|
524
|
+
// Example: Ingest users in a job (API v1 semantics)
|
|
515
525
|
const response = await courier.bulk.ingestUsers({
|
|
516
526
|
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
|
517
527
|
users: [
|
|
@@ -524,6 +534,19 @@ async function run() {
|
|
|
524
534
|
});
|
|
525
535
|
console.log(response);
|
|
526
536
|
|
|
537
|
+
// Example: Ingest users in a job (API v2 semantics)
|
|
538
|
+
const response = await courier.bulk.ingestUsers({
|
|
539
|
+
jobId: "1-61efe386-6ff57552409e311b7a1f371f",
|
|
540
|
+
users: [
|
|
541
|
+
{
|
|
542
|
+
to: {
|
|
543
|
+
email: "tejas@courier.com",
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
],
|
|
547
|
+
});
|
|
548
|
+
console.log(response);
|
|
549
|
+
|
|
527
550
|
// Example: Run a job
|
|
528
551
|
await courier.bulk.runJob({
|
|
529
552
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trycourier/courier",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
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
|
+
}
|