DEV Community

Varsha for CodeLit

Posted on Originally published at sendlit.app

Not every user is a subscriber

We run CourseLit, an open-source platform for selling courses. Every learner who signs in becomes a contact in our email tool. Their profile lives there, in custom fields.

But signing in to a course isn't the same as opting into marketing email. Neither is a teammate getting invited to a school.

The problem

SendLit, the email platform we build and run CourseLit on, treated every new contact as a subscriber. For a newsletter that's the right default. For a platform it isn't.

Once we added per-contact consent history, the gap got sharper. A contact created through the API would start its history with an opt-in, when the person had only signed in.

So we split the two.

If you build a platform, you probably have the same shape of problem. You want every user in your email system - for receipts, onboarding, account mail - but only some of them want your newsletter.

What we changed

Creating a contact now takes an optional subscribed flag. It works the same in the REST API, the SDK and the MCP tool.

import { SendLit } from "sendlit";

const sendlit = new SendLit({ apiKey: process.env.SENDLIT_API_KEY });

await sendlit.contacts.create({
  email: learner.email,
  subscribed: false,
});
Enter fullscreen mode Exit fullscreen mode

With subscribed: false:

  • The contact starts unsubscribed.
  • No consent event is written.
  • It doesn't count as a subscribed contact.
  • Sequences don't enroll it, so a "subscriber added" welcome flow never fires.

Leave the flag out and you get the old behaviour - a subscribed contact. So nothing breaks for existing callers.

When they do opt in

Later, if the learner ticks "send me updates", you update the contact with subscribed: true and the consent details. That becomes their first consent record. A real one. The contacts docs cover the details.

So the history reads the way it happened: added as a user, opted in on a date, from a form.

Why this matters more than it looks

Most email tools assume a contact is a subscriber. That's fine for a newsletter. It's wrong for a platform, where your user list and your marketing list are different things.

Treating them as one list leaves you two bad options: keep users out of your email tool, or treat every user as a subscriber.

We wanted neither for CourseLit, so we changed the tool we build.

It ships in the SendLit SDK 0.9.0. SendLit is open source and you can self-host it, or use the hosted version with your own email provider.

Top comments (0)