Concepts
Marketing consent
Record where each contact's marketing opt-in came from, so every bulk send can show it went to people who agreed to it.
Bulk email from Clivly goes only to people with a record of agreeing to hear from you. Each contact has a consent history: every opt-in and opt-out, with the evidence behind it. A send's review shows how strong the evidence is across its audience.
How strong the evidence is
| Evidence | Where it comes from |
|---|---|
| Confirmed | The person clicked a double opt-in link Clivly emailed them |
| Captured | Your app called recordConsent() when they opted in, with the wording they saw |
| Synced | Your app's consent column says yes; Clivly saw the value, not the moment |
| Attested | A team member said so: an import, a manual entry |
| No record | Nothing recorded |
| Opted out | The latest record is an opt-out. Bulk email never goes here |
Contacts with no record are left out of a bulk send unless the sender ticks Also send to contacts with no consent record, which records a stronger attestation on the send. Large sends that go mostly to contacts with no record, or to a list imported just before, are held for review by Clivly before they go out.
Record an opt-in as it happens
Call recordConsent() from your sign-up form or preferences page, after your own write succeeds:
await clivly.recordConsent({
email: user.email,
granted: body.marketingOptIn,
label: "signup_form",
wording: "Send me product news and offers",
wordingVersion: "2026-11",
pageUrl: request.headers.get("referer") ?? undefined,
ip: request.headers.get("cf-connecting-ip") ?? undefined,
userAgent: request.headers.get("user-agent") ?? undefined,
idempotencyKey: `${user.id}:signup`,
});
granted: falserecords an opt-out and stops bulk email to that address at once.ipis cut to its network (/24for IPv4,/48for IPv6) before it's stored.wordingis stored with a SHA-256 hash, so you can show exactly what the person agreed to.- An opt-in never lifts an unsubscribe the person made through Clivly. Only a confirmed double opt-in does.
It never throws. Check ok:
const result = await clivly.recordConsent({ email, granted: true });
if (!result.ok) {
console.warn("Consent not recorded:", result.error);
}
On Cloudflare Workers and other serverless hosts, wrap the call in ctx.waitUntil(...).
Double opt-in
Pass doubleOptIn: true, or turn on Double opt-in in Settings → Email sending. Clivly then emails the person a link, and the opt-in only counts once they click it. The result is { status: "pending_confirmation" }.
Opening the link only asks; the person confirms with a button, so a mail scanner can't opt anyone in. Links expire after 7 days. Clivly sends at most one confirmation per address a day, and caps each workspace at 500 a day.
From a contact's page, Ask to confirm by email sends the same link to an existing contact. It isn't offered for contacts who opted out.
Sync your app's consent column
If your users table already has a consent flag, map it in Settings → Mapping to the contact's consent field, and optionally its timestamp to consent at. In clivly.config.ts, use the reserved field keys:
fields: {
email: "email",
name: "full_name",
"synced.marketing_consent": "marketing_opt_in",
"synced.marketing_consent_at": "marketing_opt_in_at",
},
Each sync records a change only when the value flips. true, yes, 1, subscribed and similar read as yes; false, no, 0, unsubscribed as no. An empty or unrecognised value records nothing.
A synced yes never overrides an opt-out made in Clivly (an unsubscribe link, a spam complaint, or recordConsent with granted: false), whatever your timestamp column says. The person asked Clivly to stop, so only a double opt-in they confirm brings them back: call recordConsent with doubleOptIn: true when they opt in again in your app. Until then the contact's page notes that your app still marks them as opted in, so you can fix the value on your side.
Proof for a contact
A contact's page shows its consent history. Download record saves it as a JSON document: every event, its evidence, who recorded it, and the current state. Consent records can't be edited once written, only added to.