sendlit 0.6.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 CHANGED
@@ -60,11 +60,12 @@ 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` |
67
67
  | `sendlit.emails` | Transactional email: `send`, `get`, `list`, `listAll` |
68
+ | `sendlit.forms` | Signup forms: `list`, `get`, `create`, `update`, `remove`, and `submit` to sign someone up from your server (double opt-in forms email a confirmation link) |
68
69
  | `sendlit.events` | Custom events: `track`, and `definitions.list`, `definitions.get`, `definitions.create`, `definitions.update`, `definitions.delete` |
69
70
  | `sendlit.provisioning` | Organization key only: `provisionTeam`, `getTeam`, `updateTeam`, `createTeamKey`, `suspendTeam`, `resumeTeam`, `archiveTeam`, `getTeamUsage` |
70
71
  | `sendlit.suppressions` | `list`, `listAll`, `get`, `release` |
@@ -89,6 +90,42 @@ Request and response types are exported too, for example `Contact`,
89
90
  the onboarding trigger, or call `addTag` after creating the contact if you
90
91
  want a tag trigger.
91
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
+
92
129
  ### Custom events
93
130
 
94
131
  `events.track` records something a contact did in your product and starts