This repository contains the Azure Function App that powers the backend for Baldwin — an AI-driven email assistant that summarizes, categorizes, and routes iCloud email content for Robert and Lisa.
The following HTTP-triggered Azure Functions are implemented in function_app.py using the Python V2 decorator model:
| Endpoint | Method | Description |
|---|---|---|
/api/scan-mail |
GET | Fetch recent iCloud emails (mock or IMAP) |
/api/summarize-email |
POST | Summarize the body of an email |
/api/build-digest |
POST | Combine multiple summaries into a digest |
/api/send-digest |
POST | Send a digest email to Robert or Lisa |
baldwin-function/
├── function_app.py # Core function definitions using @app decorators
├── requirements.txt # Python dependencies
├── host.json # Azure Functions host config
├── local.settings.json # Local dev settings (excluded from deployment)
└── build.sh # Optional script to zip for deployment
This function app is designed to be deployed via Terraform using zip_deploy_file. Run build.sh to generate a zip package:
chmod +x build.sh
./build.shThe resulting build.zip can be deployed using:
zip_deploy_file = "${path.module}/../baldwin-function/build.zip"These must be set via app_settings in Terraform or local.settings.json for local development:
OPENAI_API_KEYSMTP_SERVERSMTP_PORTSMTP_USERNAMESMTP_PASSWORD
Use Azure Functions Core Tools to test locally:
func start- IMAP integration to pull real iCloud emails
- Tagging logic (
/tag-email) - Event extraction (
/extract-events) - Smart digest scheduling
© 2025 Robert Barrimond — All rights reserved.