← back to Shopify Order Bell
README.md
51 lines
# Shopify Order Bell 🔔
Desktop alarm that rings a bell (+ system notification + dock bounce) whenever a **new Shopify order** lands on `designer-laboratory-sandbox.myshopify.com`.
Two ways to run:
### 1) Desktop app (Electron)
```sh
cd ~/Projects/shopify-order-bell
npm install # installs electron (once, ~1 min)
npm start # opens the bell window
```
* Shows last orders, live status, **🔔 Test Bell** button, polls every `POLL_SECONDS` (default 15s).
* First run **seeds silently** from the latest order — no retro bell. Only *new* orders after that ring.
* Tray icon → Show / Test Bell / Poll now / Quit. System Notification + dock bounce on each new order.
* Bell is synthesized with Web Audio (no file needed) — volume + repeats sliders in the UI.
### 2) Headless poller (server/overnight)
```sh
node poller.js
# or: POLL_SECONDS=10 node poller.js
```
Loops forever, `afplay`s Glass/Ping + `osascript` notification on new orders. State in `.last-order.json`.
### Config
Env is loaded from `./.env` (if present) then `~/Projects/secrets-manager/.env`:
```
SHOPIFY_STORE=designer-laboratory-sandbox.myshopify.com
SHOPIFY_ORDERS_TOKEN=shpat_... # must have read_orders scope (this one works; SHOPIFY_ADMIN_TOKEN does not)
POLL_SECONDS=15
```
`SHOPIFY_ORDERS_TOKEN` already in secrets-manager and has `read_orders` — verified `GET /admin/api/2024-04/orders.json` returns orders (latest id 6130103812147). `SHOPIFY_FULL_ACCESS_TOKEN` also works.
### Reset
* In-app: **Reset seed** button forgets `lastOrderId` and re-seeds without ringing.
* CLI: `rm .last-order.json` or `rm ~/Library/Application\ Support/shopify-order-bell/last-order.json` (Electron).
### Dev
```sh
npm run dev # with DevTools
```