sendlit 0.7.0 → 0.8.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 +37 -1
- package/dist/index.d.mts +434 -59
- package/dist/index.d.ts +434 -59
- package/dist/index.js +192 -11
- package/dist/index.mjs +192 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ new SendLit({
|
|
|
60
60
|
|
|
61
61
|
| Resource | Methods |
|
|
62
62
|
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
-
| `sendlit.contacts` | `create`, `list`, `listAll`, `get`, `update`, `remove`, `addTag`, `removeTag`, `deliveries`, `events`
|
|
63
|
+
| `sendlit.contacts` | `create`, `list`, `listAll`, `get`, `update`, `remove`, `addTag`, `removeTag`, `deliveries`, `events`, `consent`, `import` |
|
|
64
64
|
| `sendlit.segments` | `create`, `list`, `get`, `update`, `remove` |
|
|
65
65
|
| `sendlit.templates` | `list`, `listSystem`, `get`, `create`, `update`, `duplicate`, `remove` |
|
|
66
66
|
| `sendlit.sequences` | Broadcasts and sequences: `create`, `list`, `listAll`, `get`, `update`, `remove`, `addEmail`, `updateEmail`, `publishChanges`, `discardChanges`, `emailVersions`, `restoreEmailVersion`, `removeEmail`, `start`, `pause`, `stats`, `deliveries`, `listAllDeliveries`, `subscribers`, `sendEmailTest` |
|
|
@@ -90,6 +90,42 @@ Request and response types are exported too, for example `Contact`,
|
|
|
90
90
|
the onboarding trigger, or call `addTag` after creating the contact if you
|
|
91
91
|
want a tag trigger.
|
|
92
92
|
|
|
93
|
+
### Consent records
|
|
94
|
+
|
|
95
|
+
Every change to a contact's subscription is kept in its consent history, as
|
|
96
|
+
proof of consent (GDPR Art. 7). Pass what the person agreed to with `create`
|
|
97
|
+
or `update`, and read the history with `contacts.consent`:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const contact = await sendlit.contacts.create({
|
|
101
|
+
email: user.email,
|
|
102
|
+
consent: {
|
|
103
|
+
source: "checkout", // your own name for where consent was collected
|
|
104
|
+
wording: "Email me about new courses", // the exact checkbox text
|
|
105
|
+
actor: "contact", // the person ticked the box themself
|
|
106
|
+
ipAddress: request.ip,
|
|
107
|
+
userAgent: request.headers["user-agent"],
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Opting in again (or out) later:
|
|
112
|
+
await sendlit.contacts.update(contact.contactId, {
|
|
113
|
+
subscribed: true,
|
|
114
|
+
consent: { source: "account_settings", wording: "Send me news", actor: "contact" },
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const history = await sendlit.contacts.consent(contact.contactId);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- `create` records consent only when it creates the contact. For an existing
|
|
121
|
+
contact, call `update` with `subscribed`.
|
|
122
|
+
- `update` records an event when `subscribed` changes, or when you pass
|
|
123
|
+
`consent` with `subscribed` to record an unchanged choice again.
|
|
124
|
+
- `consentedAt` back-dates the event to when the person agreed, as a claimed
|
|
125
|
+
time next to the time SendLit recorded it.
|
|
126
|
+
- `contacts.import` needs `consentConfirmed: true` when any row is imported
|
|
127
|
+
subscribed.
|
|
128
|
+
|
|
93
129
|
### Custom events
|
|
94
130
|
|
|
95
131
|
`events.track` records something a contact did in your product and starts
|