Settings
Telegram notifications, API credentials, alerting thresholds, and automation endpoints.
Telegram notifications
Bot credentials for alerts and the daily digest
Setup guide
- 1In Telegram, open a chat with @BotFather, send
/newbot, follow the prompts, and copy the bot token it gives you. - 2Open a chat with your new bot and send it any message (e.g.
/start) so it can see your chat. - 3Get your chat ID by visiting
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdatesand copying thechat.idvalue from the JSON response. - 4Paste the token and chat ID above and Save — or set
TELEGRAM_BOT_TOKENandTELEGRAM_CHAT_IDin your.env.
Environment variables always take precedence over values saved here — useful for keeping secrets out of the database on your VPS.
API credentials
Keys for live Amazon data — the app runs on demo data until they exist
Keepa
Not configured — demo modePowers live watchlist sync — get a key at keepa.com/#!api (data plans from €49/mo). Test connection checks the key against Keepa without saving it (costs 0 tokens).
Amazon SP-API
Not configured — demo modeFrom Seller Central → Apps & Services → Develop Apps (requires a Professional seller account). Syncs your own orders and fees; the app runs in demo mode until all three credentials exist. Test connection performs the LWA token exchange without saving anything.
Keys are stored in the local SQLite database and never leave this server. Environment variables always take precedence over values saved here.
Alerting
Restock thresholds and notification policy
Buffer of demand kept on hand when computing reorder points.
Days of stock a new purchase order should cover on arrival.
Critical alerts only
When on, Telegram notifications are sent only for critical alerts. Warnings and info stay on the dashboard.
Watch alerts
Thresholds for the competitor watchlist alert engine
Alert when a watched ASIN's price falls by at least this percent between snapshots.
Alert when a watched ASIN's review count jumps by at least this percent — a competitor surging.
New-seller alert
Alert when the seller (offer) count on a watched listing rises — someone new has joined the listing.
These thresholds feed the watchlist alert engine (POST /api/watchlist/alerts). Triggered alerts land on the dashboard and flow to Telegram through the existing /api/telegram/notify endpoint or its cron job.
Automation
Wire these endpoints into cron on your VPS
- POST
/api/telegram/testSends a test message to verify the bot token and chat ID.
- POST
/api/telegram/notifySends all unsent alerts to Telegram and marks them notified. Respects the critical-only setting.
- GET
/api/telegram/digestComposes and sends the daily digest — yesterday's revenue, units, top product, and open alerts.
- POST
/api/syncRefreshes every active watchlist ASIN — live Keepa snapshots when a key is configured, demo data otherwise. Logs a sync_runs row.
- POST
/api/watchlist/alertsScans the latest snapshots against the watch-alert thresholds (price drop, review spike, new seller) and queues alerts for the notify job.
- POST
/api/inventory/expiry-checkScans active lots and raises expiry alerts — warning at ≤60 days to expiry, critical at ≤30. Alerts flow to Telegram via the notify job.
Crontab example
# FBA Command — automation # Daily digest at 08:00 0 8 * * * curl -fsS http://localhost:3000/api/telegram/digest >/dev/null 2>&1 # Push unsent alerts every 30 minutes */30 * * * * curl -fsS -X POST http://localhost:3000/api/telegram/notify >/dev/null 2>&1 # Watchlist sync every 6 hours 0 */6 * * * curl -fsS -X POST http://localhost:3000/api/sync >/dev/null 2>&1 # Watchlist alert scan 15 minutes after each sync 15 */6 * * * curl -fsS -X POST http://localhost:3000/api/watchlist/alerts >/dev/null 2>&1 # Lot expiry scan daily at 07:30 30 7 * * * curl -fsS -X POST http://localhost:3000/api/inventory/expiry-check >/dev/null 2>&1
Both jobs run against localhost on the VPS itself, so nothing needs to be exposed publicly. Adjust the port if the app is served elsewhere.