Email yourself reminders for Southwest A-List free upgrades
README.md

southwest-upgrade #

A Cloudflare Worker that watches for Southwest Airlines itinerary emails and replies with A List upgrade reminders — 48 hours before each flight, which is when Southwest opens seat upgrade bidding.

How it works #

  1. An email arrives at upgrade@praxx.is via Cloudflare Email Routing.
  2. Workers AI (@cf/meta/llama-3.3-70b-instruct-fp8-fast) classifies the email and extracts each flight segment.
  3. If it's a Southwest itinerary, the Worker replies via Postmark with a list of reminder times (departure − 48h) and the corresponding check-in moment (departure − 24h).
  4. Non-Southwest emails are silently dropped.

Project layout #

src/
  index.ts      email() handler + fetch() health check
  parse.ts      MIME parsing via postal-mime
  ai.ts         Workers AI call + Zod validation
  upgrade.ts    48h date math + formatting
  reply.ts      Postmark API call
  env.d.ts      Env type extension for POSTMARK_API_TOKEN
test/
  handler.test.ts          unit + integration tests
  ai.integration.test.ts   live AI extraction test
  fixtures/
    sw-itinerary.eml       redacted Chase Travel fixture
    not-sw.eml             non-Southwest fixture

Setup #

Prerequisites #

  • Domain on Cloudflare DNS with Email Routing enabled (npx wrangler email routing enable <domain>)
  • Postmark account with upgrade@praxx.is as a verified sender signature (or praxx.is as a verified sending domain)
  • Cloudflare Email Routing rule: upgrade@praxx.is → Worker southwest-upgrade

Secrets #

npx wrangler secret put POSTMARK_API_TOKEN

Deploy #

pnpm install
npx wrangler types   # regenerate worker-configuration.d.ts if wrangler.jsonc changes
npx wrangler deploy

Development #

pnpm test            # unit tests (vitest, no Workers runtime needed)
pnpm test:ai         # live AI extraction test (requires .env with Cloudflare credentials)
pnpm lint            # oxlint
pnpm fmt             # oxfmt
pnpm fmt:check       # oxfmt --check

For the live AI test, copy .env.example to .env and fill in your credentials:

CLOUDFLARE_ACCOUNT_ID=...
CLOUDFLARE_API_TOKEN=...   # needs Workers AI Run permission

Bindings #

Binding Type Purpose
env.AI Workers AI Classify + extract flight data
env.POSTMARK_API_TOKEN Secret Postmark server API token