Back to projects
ESP Integration API logo

ESP Integration API

Mail Integration API using MailChimp and GetResponse for marketing leads and conversion campaign emails.

Accomplishments

  • Built a Node.js + TypeScript REST API that integrates internal applications with external Email Service Providers (Mailchimp and GetResponse) through a single unified interface.
  • Implemented a POST /api/integrations/esp endpoint that validates ESP API keys in real time against the provider before persisting them, rejecting invalid providers and bad keys.
  • Implemented a GET /api/integrations/esp/lists endpoint that fetches mailing lists (Mailchimp audiences / GetResponse campaigns) for a given userId and provider via query params.
  • Normalized disparate ESP response formats into a consistent schema (id, name, created_at, subscriber_count/contact_count) so clients get a uniform structure regardless of provider.
  • Integrated Mailchimp via HTTP Basic Auth, dynamically deriving the datacenter from the API key (the "-dc" suffix) to build the correct regional API URL.
  • Integrated GetResponse via the X-Auth-Token header, verifying credentials against the /v3/accounts endpoint and fetching campaigns from /v3/campaigns.
  • Added resilient error handling that maps external ESP failures to proper HTTP status codes: 401 for invalid keys, 429 for rate-limit exceeded, and 500 for network/server errors.
  • Used safe fallbacks (e.g. subscriber_count defaulting to 0) to prevent crashes when optional fields are missing from ESP responses.
  • Persisted integration credentials in MongoDB via a Mongoose Integration model with an enum-constrained provider field and automatic timestamps.
  • Structured the codebase into a clean layered architecture (config, routes, controllers, services, models) with separate server bootstrap (server.ts) and app setup (app.ts).
  • Configured a TypeScript dev/build/start workflow using nodemon + ts-node for development and tsc for production builds, with CORS and dotenv-based environment config.
  • Developed the project through a PR-based workflow (dev → main), iterating on features like MongoDB integration, rate-limit checks, and the created_at field before documenting it all in the README.

Links

Skills used

TypeScriptNode.jsExpressMongoDBMongooseAxios

Status

Completed
Not Live