WooCommerce order notifications delivered to Telegram through a Cloudflare Worker relay, for hosts that can't reach api.telegram.org directly.
One Worker serves every client site. A site knows only its own generated secret; the Worker maps that secret to the right Telegram chat. No chat IDs or bot tokens live in WordPress.
WordPress site ──POST {"text": …}──► Cloudflare Worker ──sendMessage──► Telegram group
X-Relay-Secret (KV: secret → chat_id)
| Path | What |
|---|---|
telegram-order-notify/ |
the WordPress plugin |
cloudflare-worker/ |
the relay: notifications, pairing, dashboard, update server |
build-plugin-zip.sh |
builds an installable plugin ZIP (recompiles .mo files first) |
bump-version.sh |
sets the version in all three places that carry it |
Worker setup, bot commands, and troubleshooting: cloudflare-worker/README.md.
Install the plugin, paste the relay URL, save. The plugin generates its own secret and shows a pairing code; the client sends /link CODE in their Telegram group and the bot captures the chat. Nothing to configure on the Cloudflare side.
CI does the publishing — GitHub is the source of truth, the Worker is the delivery path (client sites can't reliably reach GitHub).
./bump-version.sh 1.1.0
git commit -am "chore: release 1.1.0"
git tag v1.1.0
git push && git push --tagsThen publish the release on GitHub. release.yml builds the ZIP, refuses to continue if the tag and the plugin's version strings disagree, runs the Worker tests, pushes the ZIP to /update/publish, and attaches it to the release.
Sites pick it up within 6 hours, or immediately via "Check for updates" on their Plugins screen.
Required repository secrets:
| Secret | Value |
|---|---|
RELAY_URL |
https://<worker>.workers.dev |
RELAY_ADMIN_TOKEN |
the Worker's ADMIN_TOKEN |
workflow_dispatch runs the same job manually if a release is already published.
cd cloudflare-worker && npm testRuns the Worker against an in-memory KV and a stubbed Telegram API: registration, pairing, topic routing, update publish/check/download, dashboard rendering, auth on every gated route. ci.yml runs this plus PHP lint, translation compilation, and the version-consistency check on every push.
Persian by default across the plugin UI, notification text, bot replies, and dashboard (RTL, Persian digits). English available per site in Settings > Telegram Notify > Language; ?lang=en on the dashboard.