My background scrapers run on PythonAnywhere. My phone runs Termux. I wanted the scrapers to ping my phone when something interesting happened — without Firebase, without Ngrok, without paying for anything.
So I built Intent Bus.
The Problem
Most cross-device automation forces you to choose between:
- Too simple: hardcoded cron jobs with no coordination
- Too complex: Redis, RabbitMQ, Firebase — full infrastructure for a simple notification
I just wanted my cloud script to say "hey, buzz my phone." That's it.
How It Works
Intent Bus is a tiny Flask app backed by SQLite. It has one job: let scripts post work, and let workers claim and execute that work.
Step 1 — Cloud script posts an intent:
curl -X POST https://your-bus.pythonanywhere.com/intent \
-H "Content-Type: application/json" \
-H "X-API-Key: your_key_here" \
-d '{"goal":"send_notification","payload":{"message":"Scrape complete"}}'
Step 2 — Termux worker claims it:
A bash script running on my phone polls the bus every 10 seconds. When it sees a job, it claims it with an atomic lock, executes it, and marks it fulfilled.
Step 3 — Phone buzzes:
termux-notification --title "System Update" --content "$MESSAGE"
That's the entire flow.
What Makes It Reliable
Three things I had to get right:
Atomic locking — SQLite's UPDATE with rowcount check ensures only one worker ever claims a job, even with multiple workers running simultaneously.
Visibility timeout — if a worker crashes mid-job, the lock expires after 60 seconds and the job goes back into the queue automatically.
Topic routing — workers only claim jobs matching their goal via ?goal=. A notification worker never accidentally picks up a logging job.
The Architecture
Cloud Scraper (PythonAnywhere)
|
| POST /intent
↓
Intent Bus (Flask + SQLite)
|
| claim + fulfill
↓
Termux Worker (Android Phone)
|
| termux-notification
↓
📱 Phone Notification
What It Can Do
Because the bus is just HTTP, any script anywhere can post or claim jobs:
- Scraper finishes → notify phone
- Website goes down → alert Discord
- GitHub push → trigger deploy on home Raspberry Pi behind a firewall
- Old Android phone → free Twilio replacement via
termux-sms-send
Security
After posting this publicly, people immediately stress-tested the open endpoint. Fair. I added API key auth — key stored in PythonAnywhere's WSGI environment, never in the repo. Workers read from a local .apikey file.
Try It
The full code, spec, and examples are on GitHub:
https://github.com/dsecurity49/Intent-Bus
It runs free on PythonAnywhere + any Android phone with Termux. No Docker, no dependencies beyond Flask.
If you build a worker script for it, PRs are welcome.
Top comments (0)