A small Node.js Fastify service to check if an email is already subscribed to your newsletter.
- Lookup if an email is already subscribed (
/lookup) - Returns structured result, built with TypeScript
Clone the repo and install dependencies:
git clone <repo-url>
cd lookup
npm installCreate a .env file, BREVO_KEY is needed.
Start the server in development mode:
npm run devYou can test the lookup endpoint:
curl -X POST "http://localhost:5001/[email protected]"or
node src/test.ts [email protected]Example response if subscribed:
{
"customer": { "emailStatus": "already_subscribed" },
"action": {
"customFields": { "isSubscribed": true },
"privacy": { "optIn": true }
}
}If not subscribed:
{}npm run buildThis will compile TypeScript into dist/.
Run production server:
node dist/server.jsTBD
POST /lookup?email=<email>– Returns subscription status for the given email.
- It is implemented only for LC
Looks like that elixir when using lookup can pass data other than just email - supporter_id, org_id, action_page_id, and custom_fields (needs to be confirmed). This allows implementing org-specific logic in the future without changing the core. For example, we could branch behavior based on org_id or apply custom rules per organization while still using the same endpoint for the basic email subscription check.