Automatically downloads the latest Cursor billing invoice and emails it via Mail.app.
Uses Playwright with a persistent browser session: first run requires manual Google OAuth login in a headed browser, subsequent runs work headless.
npm install
npx playwright install chromiumnpm run loginA Chromium window opens and navigates to the Cursor billing page. Complete Google OAuth login manually. Once authenticated, the session is saved to .browser-data/ and the latest invoice is downloaded and emailed.
npm startReuses the persisted session — no browser window needed. Downloads the latest invoice to invoices/ and sends it via Mail.app.
If the session has expired, the script exits with a message to re-run npm run login.
npm run scheduleInstalls a launchd job that runs on the 3rd of each month at 10:00 AM.
To remove the schedule:
npm run unschedule| Variable | Default | Description |
|---|---|---|
EMAIL_TO |
thomas.walter@theodo.com |
Recipient email address |
EMAIL_TO=someone@example.com npm start- Launches Chromium with a persistent context (cookies/session saved in
.browser-data/) - Navigates to
https://cursor.com/dashboard?tab=billing - Finds invoice links on the page and downloads the latest PDF
- Falls back to clicking download buttons on Stripe invoice pages, or printing the page as PDF
- Sends the PDF as an attachment via Mail.app using AppleScript
