https://email-companion-frontend.vercel.app/
Inbox Companion helps you triage an Outlook inbox by walking a user through Microsoft's device-login flow, scanning a chosen date range of emails with Together AI, and sending a single HTML summary of actionable tasks back to the signed-in mailbox.
- Frontend: Vite + React single-page app (
frontend/inbox-companion/src/App.jsx) deployed to Vercel. Handles the Microsoft sign-in UX, date selection, and polling. - Backend: Python AWS Lambda (
lambda_function.py) exposed via a Lambda Function URL or API Gateway. Orchestrates device flow auth, pulls messages from Microsoft Graph, classifies them with Together AI, and sends summary email via SMTP. - Support tooling:
test.pydrives the Lambda remotely (Function URL or direct invoke).together.pyis a quick smoke test against Together's REST API.package/contains the vendored build that matches the deployment ZIPs in this repo.
- Guided Microsoft device-code login that surfaces the verification URL and one-time code.
- Date-range input to limit Microsoft Graph queries to a specific window.
- Together AI classification that extracts actionable tasks from each email body.
- HTML summary email (via SMTP) listing subjects, senders, and task summaries.
- Deployed frontend: https://email-companion-frontend.vercel.app/
- Node.js 18+ and npm for the frontend.
- Python 3.9+ (matches the Lambda runtime) for packaging/testing the backend.
- AWS account with permissions to deploy and manage Lambda + Function URL or API Gateway.
- Microsoft Entra app registration with delegated
Mail.ReadandUser.Readscopes. - Together AI API key with access to your chosen model.
- SMTP service (e.g., Gmail with App Password) to send the summary email.
| Backend (Lambda) | Description |
|---|---|
CLIENT_ID |
Azure app's client ID. |
AUTHORITY |
Microsoft login authority, e.g. https://login.microsoftonline.com/common or your tenant. |
SCOPES |
Comma-separated Microsoft Graph scopes (default Mail.Read,User.Read). |
TOGETHER_API_KEY |
Together AI API key (never commit real keys). |
TOGETHER_MODEL |
Optional Together model override (default openai/gpt-oss-20b). |
TEMPERATURE |
Optional Together sampling temperature (default 0.0). |
MAX_TOKENS |
Optional Together max completion tokens (default 128). |
SMTP_HOST |
SMTP server host (e.g., smtp.gmail.com). |
SMTP_PORT |
SMTP port (default 587). |
SMTP_USER |
SMTP username/login. |
SMTP_PASS |
SMTP password or app password. |
FROM_EMAIL |
From address used when sending the summary. |
SMTP_STARTTLS |
Set to false to skip STARTTLS (default true). |
SEND_ONLY_IF_TASKS |
true to suppress summary email when no tasks found. |
| Frontend | Description |
|---|---|
VITE_FUNCTION_URL |
Base URL for the deployed Lambda (must include trailing slash or the app will add one). |
Store backend secrets in Lambda environment configuration or a secure config service. For local scripts (together.py, test.py), you can use a .env file but avoid committing real credentials.
- Create and activate a virtual environment.
- Install dependencies:
pip install -r requirements.txt. - Set the environment variables above (via shell,
.env, or AWS credentials configuration). - Exercise the Lambda remotely with
python test.py(defaults to the Function URL in.env; override via env vars as needed). - Optionally run
python together.pyto validate the Together API key before deploying.
For local emulation with AWS SAM, point template.yaml at your source, adjust environment variables, and run sam local start-api.
cd frontend/inbox-companion- Install packages:
npm install - Create
.envwithVITE_FUNCTION_URL=<your lambda url> - Start dev server:
npm run dev - Build for production:
npm run build
Ensure CORS is enabled on the Lambda Function URL (or API Gateway) for the frontend origin.
- Lambda: Package
lambda_function.pywith dependencies (seedeployment-package.zipfor reference) and deploy to AWS Lambda running Python 3.9+. Configure environment variables and enable a Function URL (or API Gateway) with CORS for your frontend domain. - Frontend: Deploy the Vite build output (
frontend/inbox-companion/dist) to your hosting provider (Vercel in production). Set theVITE_FUNCTION_URLenvironment variable in the hosting platform. - Rotate any sample keys found in this repository; treat them as compromised.
- Device flow stuck on "pending": verify the user completed the Microsoft login and that
Mail.Readconsent is granted. 401orexpirederrors: the device code expired before completion; restart step 1.- Empty task list: Together may have classified messages as non-actionable; inspect logs and adjust prompts/model if needed.
- Email not delivered: confirm SMTP credentials and that less-secure app access or app password is allowed for the account.
.
|-- lambda_function.py # Primary Lambda handler (stdlib-only build)
|-- package/ # Vendored Lambda build with requests + msal
|-- frontend/inbox-companion # React/Vite frontend
|-- test.py # Remote driver for the Lambda workflow
|-- together.py # Standalone Together API sanity check
|-- template.yaml # SAM template with sample configuration
\-- requirements.txt # Python dependencies for Lambda packaging
No license specified. Add one before distributing the project.