Skip to content

fixthestatusquo/lookup-lc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lookup

A small Node.js Fastify service to check if an email is already subscribed to your newsletter.

Features

  • Lookup if an email is already subscribed (/lookup)
  • Returns structured result, built with TypeScript

Installation

Clone the repo and install dependencies:

git clone <repo-url>
cd lookup
npm install

Create a .env file, BREVO_KEY is needed.

Development

Start the server in development mode:

npm run dev

Test Lookup

You 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:

{}

Build for Production

npm run build

This will compile TypeScript into dist/.

Run production server:

node dist/server.js

Deployment

TBD

Endpoints

  • POST /lookup?email=<email> – Returns subscription status for the given email.

Notes

  • It is implemented only for LC

Extending for other organizations

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors