smartletter 1.1.0 → 1.3.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/README.md +48 -0
- package/dist/index.cjs +42 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2351 -996
- package/dist/index.d.mts +2351 -996
- package/dist/index.mjs +42 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -97,6 +97,54 @@ const event = smartletter.webhooks.verify({
|
|
|
97
97
|
});
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
## Changelog
|
|
101
|
+
|
|
102
|
+
### 1.3.0
|
|
103
|
+
|
|
104
|
+
New fields only, nothing renamed or removed.
|
|
105
|
+
|
|
106
|
+
- `newsletters.create` and `newsletters.update` take `kind` and `from`. `kind: "newsletter"` (the default) goes to the subscribers of the newsletter or of a topic. `kind: "broadcast"` goes to the contacts of the group, subscribed or not, takes no `topicId` and never shows in the archive. `from` is the sender address of this issue, on the newsletter's custom domain (`name@your-domain.com`, or just `name`). Every newsletter returned has `kind` and `from`.
|
|
107
|
+
- `newsletters.update` accepts `topicId: null` for a broadcast.
|
|
108
|
+
- `contacts.create`, `contacts.update` and `contacts.import` take `newsletterSubscribed`. `false` adds the contact to the group only: they get broadcasts, not newsletter issues. A new contact defaults to `true`. An existing contact changes only with an explicit `true` (`contacts.update` also takes `false`). Every contact returned has `newsletter_subscribed`.
|
|
109
|
+
- Sending needs a verified domain of your own. Without one, the API answers `403 domain_required_to_send`; a young domain still in review answers `403 domain_under_review`. `pause_reason` may be `domain_required`, and domains return `review_status`.
|
|
110
|
+
- `threads.reply` and `messages.send` always return `id`, also when the message is queued before its row exists.
|
|
111
|
+
|
|
112
|
+
### 1.2.0
|
|
113
|
+
|
|
114
|
+
**Breaking changes.** Two fields of the API's answers are renamed to snake_case, like every other field. There is no alias: the old name is gone.
|
|
115
|
+
|
|
116
|
+
- `body.blocks[].blockId` is now `block_id` in every newsletter returned with its body (`newsletters.get`, `newsletters.create`, `newsletters.update`, `newsletters.duplicate`…). Read `block.block_id`.
|
|
117
|
+
- `POST /agent-tasks/{id}/complete` answers `{ newsletter_id, scheduled_for, review }` instead of `{ newsletterId, scheduledFor, review }` (the MCP tool `agent_tasks.complete` too). This route is not in the SDK: update the scripts that call it.
|
|
118
|
+
|
|
119
|
+
Other API changes:
|
|
120
|
+
|
|
121
|
+
- `newsletters.list`: the `status` filter takes `cancelled` and `held`. `failed` is no longer in the type (no newsletter ever has it); the API still accepts it and returns an empty list.
|
|
122
|
+
- `pause_reason` may be `gmail_spam_rate` (paused after too many spam reports at Gmail). It was already sent; the type now lists it.
|
|
123
|
+
- `newsletters.test` returns `variants`: the number of emails sent (one per A/B variant, 1 without a test).
|
|
124
|
+
- `segments.domain.remove` returns `id` (the newsletter's id), like every deletion.
|
|
125
|
+
- `sequences.unenroll` returns the enrollment's real status: `exited` when the contact was taken out, `completed` or `exited` unchanged when the run was already over.
|
|
126
|
+
- `topics.list` returns `has_more: true` when the newsletter has more than 200 topics (it returns the newest 200).
|
|
127
|
+
- `threads.list` and `sequences.enrollments` take the standard pagination: `limit`, `after` and `before`. `threads.list` used to refuse `before`; `sequences.enrollments` ignored `after` and `before` (its `limit` still defaults to 100).
|
|
128
|
+
- `contacts.create` documents its `200` answer: an address already there returns the existing contact with `existed: true`, unchanged.
|
|
129
|
+
|
|
130
|
+
Response types now come from the API's response schemas, which are checked against what the API really answers. They no longer come from the documentation examples. The runtime is unchanged. Only the types are more exact:
|
|
131
|
+
|
|
132
|
+
- `object`, statuses and event names are literal types, for example `"list"`, `"sent"` or `"email.delivered"`, instead of `string`.
|
|
133
|
+
- Fields the examples left out are now typed, and so are the fields they showed as `null` or `[]` (until now `unknown`).
|
|
134
|
+
- 125 fields that can be `null` are now `T | null`. Under `strictNullChecks`, handle the `null` case.
|
|
135
|
+
- Fields that were in an example but never in a response are gone:
|
|
136
|
+
- `body` in the `newsletters.list` items;
|
|
137
|
+
- the spam fields on sent and draft inbox messages;
|
|
138
|
+
- `reasons.invalid` in `contacts.import`.
|
|
139
|
+
- Shapes that vary are unions. Narrow on `direction` (inbox messages), `body.format` (newsletters), the step and trigger `type` (sequences), or `deleted` (`sequences.remove`).
|
|
140
|
+
- Dictionaries whose keys you choose are `Record<string, …>`: `custom_fields`, `metadata`, `properties` and filter `rules`.
|
|
141
|
+
- Free-form objects are `Record<string, unknown>` too: the condition step's `rule` and the items of its `yes` and `no` branches (sequences), and the webhook `payload.data` (`webhooks.test`, `webhooks.deliveries`, `webhooks.retryDelivery`).
|
|
142
|
+
- `links.x` in `segments.archive.get` and `segments.archive.update` is optional: it is missing when no X link is set.
|
|
143
|
+
- Webhook `events` (`webhooks.list`, `webhooks.get`) is a union of event names, such as `"email.delivered"`, instead of `string[]`.
|
|
144
|
+
- `messages.send` returns the message sent (`status: "sent"`), or `{ object, email_id, status }` when the email was queued but its record could not be saved. `threads.reply` returns the same, or the saved draft (`status: "draft"`) with `draft: true`.
|
|
145
|
+
|
|
146
|
+
Answers may gain fields in a later version. The types stay open for reading: a field the API adds does not break your code. Lists of values (statuses, event names) may grow too, so keep a default branch when you switch on one.
|
|
147
|
+
|
|
100
148
|
## License
|
|
101
149
|
|
|
102
150
|
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -81,7 +81,7 @@ var Client = class {
|
|
|
81
81
|
}
|
|
82
82
|
this.key = resolved;
|
|
83
83
|
this.baseUrl = (options.baseUrl || env("SMARTLETTER_BASE_URL") || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
84
|
-
this.userAgent = options.userAgent ?? `smartletter-node/${"1.
|
|
84
|
+
this.userAgent = options.userAgent ?? `smartletter-node/${"1.3.0"}`;
|
|
85
85
|
}
|
|
86
86
|
async call(op, args, options = {}) {
|
|
87
87
|
const headers = new Headers(options.headers);
|
|
@@ -679,6 +679,12 @@ var OPERATIONS = {
|
|
|
679
679
|
wire: "winner_mode"
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
|
+
},
|
|
683
|
+
kind: {
|
|
684
|
+
wire: "kind"
|
|
685
|
+
},
|
|
686
|
+
from: {
|
|
687
|
+
wire: "from"
|
|
682
688
|
}
|
|
683
689
|
}
|
|
684
690
|
},
|
|
@@ -793,6 +799,12 @@ var OPERATIONS = {
|
|
|
793
799
|
wire: "winner_mode"
|
|
794
800
|
}
|
|
795
801
|
}
|
|
802
|
+
},
|
|
803
|
+
kind: {
|
|
804
|
+
wire: "kind"
|
|
805
|
+
},
|
|
806
|
+
from: {
|
|
807
|
+
wire: "from"
|
|
796
808
|
}
|
|
797
809
|
}
|
|
798
810
|
},
|
|
@@ -977,6 +989,9 @@ var OPERATIONS = {
|
|
|
977
989
|
},
|
|
978
990
|
tags: {
|
|
979
991
|
wire: "tags"
|
|
992
|
+
},
|
|
993
|
+
newsletterSubscribed: {
|
|
994
|
+
wire: "newsletter_subscribed"
|
|
980
995
|
}
|
|
981
996
|
}
|
|
982
997
|
},
|
|
@@ -1027,6 +1042,9 @@ var OPERATIONS = {
|
|
|
1027
1042
|
tags: {
|
|
1028
1043
|
wire: "tags"
|
|
1029
1044
|
},
|
|
1045
|
+
newsletterSubscribed: {
|
|
1046
|
+
wire: "newsletter_subscribed"
|
|
1047
|
+
},
|
|
1030
1048
|
status: {
|
|
1031
1049
|
wire: "status"
|
|
1032
1050
|
},
|
|
@@ -1117,6 +1135,9 @@ var OPERATIONS = {
|
|
|
1117
1135
|
},
|
|
1118
1136
|
removeTags: {
|
|
1119
1137
|
wire: "remove_tags"
|
|
1138
|
+
},
|
|
1139
|
+
newsletterSubscribed: {
|
|
1140
|
+
wire: "newsletter_subscribed"
|
|
1120
1141
|
}
|
|
1121
1142
|
}
|
|
1122
1143
|
},
|
|
@@ -2111,14 +2132,20 @@ var OPERATIONS = {
|
|
|
2111
2132
|
method: "GET",
|
|
2112
2133
|
path: "/sequences/{id}/enrollments",
|
|
2113
2134
|
pathParams: ["id"],
|
|
2114
|
-
paginated:
|
|
2135
|
+
paginated: true,
|
|
2115
2136
|
idempotent: false,
|
|
2116
2137
|
query: {
|
|
2117
|
-
status: {
|
|
2118
|
-
wire: "status"
|
|
2119
|
-
},
|
|
2120
2138
|
limit: {
|
|
2121
2139
|
wire: "limit"
|
|
2140
|
+
},
|
|
2141
|
+
after: {
|
|
2142
|
+
wire: "after"
|
|
2143
|
+
},
|
|
2144
|
+
before: {
|
|
2145
|
+
wire: "before"
|
|
2146
|
+
},
|
|
2147
|
+
status: {
|
|
2148
|
+
wire: "status"
|
|
2122
2149
|
}
|
|
2123
2150
|
}
|
|
2124
2151
|
},
|
|
@@ -2375,9 +2402,18 @@ var OPERATIONS = {
|
|
|
2375
2402
|
method: "GET",
|
|
2376
2403
|
path: "/threads",
|
|
2377
2404
|
pathParams: [],
|
|
2378
|
-
paginated:
|
|
2405
|
+
paginated: true,
|
|
2379
2406
|
idempotent: false,
|
|
2380
2407
|
query: {
|
|
2408
|
+
limit: {
|
|
2409
|
+
wire: "limit"
|
|
2410
|
+
},
|
|
2411
|
+
after: {
|
|
2412
|
+
wire: "after"
|
|
2413
|
+
},
|
|
2414
|
+
before: {
|
|
2415
|
+
wire: "before"
|
|
2416
|
+
},
|
|
2381
2417
|
inboxId: {
|
|
2382
2418
|
wire: "inbox_id"
|
|
2383
2419
|
},
|
|
@@ -2395,12 +2431,6 @@ var OPERATIONS = {
|
|
|
2395
2431
|
},
|
|
2396
2432
|
unread: {
|
|
2397
2433
|
wire: "unread"
|
|
2398
|
-
},
|
|
2399
|
-
limit: {
|
|
2400
|
-
wire: "limit"
|
|
2401
|
-
},
|
|
2402
|
-
after: {
|
|
2403
|
-
wire: "after"
|
|
2404
2434
|
}
|
|
2405
2435
|
}
|
|
2406
2436
|
},
|