A Cloudflare Worker that automatically extracts flight information from forwarded emails and posts formatted notifications to Slack.
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌─────────┐
│ Email │────▶│ Inbound │────▶│ GPT-5.2 │────▶│ Slack │
│ (forward) │ │ Webhook │ │ Extraction │ │ Post │
└─────────────┘ └──────────────┘ └─────────────┘ └─────────┘
- Forward a flight confirmation email to your inbound email address
- Webhook receives the email via inbound.new (or similar service)
- AI extracts flight details using OpenCode Zen's GPT-5.2
- Slack notification is posted with all flight information
- Extracts multiple flights from a single email (round trips, connections, etc.)
- AI-generated trip titles and descriptions
- Structured data extraction:
- Flight numbers
- Confirmation codes (PNR)
- Airlines
- Departure/arrival airports and times
- Passenger names and seat assignments
- Beautiful Slack notifications with Block Kit formatting
- "Track Flight" buttons linking to FlightRadar24
┌─────────────────────────────────────────────┐
│ Cancun Getaway │
├─────────────────────────────────────────────┤
│ Round trip from Jacksonville to Cancun, │
│ Jan 23-28, 2026 │
├─────────────────────────────────────────────┤
│ Flight 1: AA 1018 [Track Flight]│
│ American Airlines │
│ │
│ From: To: │
│ JAX MIA │
│ │
│ Departure: Arrival: │
│ Fri, Jan 23 Fri, Jan 23 │
│ 6:00 AM 7:25 AM │
│ │
│ Confirmation: IMOZHR │
│ Passengers: Ryan Vogel (Seat 22A) │
├─────────────────────────────────────────────┤
│ Flight 2: AA 2494 [Track Flight]│
│ ... │
└─────────────────────────────────────────────┘
- Node.js 18+
- Wrangler CLI
- OpenCode Zen API key
- Slack Incoming Webhook URL
- Email webhook service (e.g., inbound.new)
# Clone the repo
git clone https://github.com/YOUR_USERNAME/flighty-email.git
cd flighty-email
# Install dependencies
npm install
# Login to Cloudflare
npx wrangler loginSet the required secrets:
# Your OpenCode Zen API key
npx wrangler secret put OPENCODE_API_KEY
# Your Slack incoming webhook URL
npx wrangler secret put SLACK_WEBHOOK_URLnpm run deployYour worker will be available at: https://flighty-email.<your-subdomain>.workers.dev
Point your email webhook service to:
POST https://flighty-email.<your-subdomain>.workers.dev/api/inbound
The webhook expects a payload matching the inbound.new format.
# Create a .dev.vars file with your secrets
cat > .dev.vars << EOF
OPENCODE_API_KEY=your-opencode-api-key
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
EOF
# Start the dev server
npm run dev# Pretty-printed logs from deployed worker
npm run logs
# JSON format (for piping to jq)
npm run logs:jsonnpx tsc --noEmitReceives email webhook payloads and processes them.
Request Body: Email webhook payload (see src/types.ts for schema)
Response:
{
"success": true,
"message": "Webhook processed",
"emailId": "inbnd_abc123",
"flightData": {
"tripTitle": "Cancun Getaway",
"tripDescription": "Round trip from Jacksonville to Cancun, Jan 23-28, 2026",
"isFlightEmail": true,
"flights": [...]
},
"slackSent": true
}Health check endpoint.
Response:
{
"status": "ok",
"service": "flighty-inbound-worker"
}- Cloudflare Workers - Serverless runtime
- Hono - Web framework
- AI SDK - AI integration
- OpenCode Zen - GPT-5.2 model provider
- Zod - Schema validation
MIT