From 621042806a5b781fa98d427e7c91e9da5c64ea75 Mon Sep 17 00:00:00 2001 From: bunker-admin Date: Fri, 27 Feb 2026 08:36:21 -0700 Subject: [PATCH] Updates to sms --- admin/src/pages/sms/SmsSetupPage.tsx | 138 ++++- .../services/sms-device-monitor.service.ts | 12 +- api/src/services/termux.client.ts | 6 +- campaign_connector | 1 + .../social/docs/admin/broadcast/sms.png | Bin 75860 -> 77276 bytes mkdocs/.cache/plugin/social/manifest.json | 2 +- mkdocs/docs/docs/admin/broadcast/sms.md | 522 ++++++++++++++++-- 7 files changed, 619 insertions(+), 62 deletions(-) create mode 160000 campaign_connector diff --git a/admin/src/pages/sms/SmsSetupPage.tsx b/admin/src/pages/sms/SmsSetupPage.tsx index 4d829521..a717267f 100644 --- a/admin/src/pages/sms/SmsSetupPage.tsx +++ b/admin/src/pages/sms/SmsSetupPage.tsx @@ -19,6 +19,23 @@ import type { const { Text, Paragraph } = Typography; +/** A single terminal command line with copy button */ +function CmdLine({ cmd, comment }: { cmd: string; comment?: string }) { + return ( +
+ {comment && # {comment}} + {comment &&
} + + {cmd} + +
+ ); +} + export default function SmsSetupPage() { const { setPageHeader } = useOutletContext(); const { message } = App.useApp(); @@ -283,29 +300,71 @@ export default function SmsSetupPage() { {/* Step 0: Phone Preparation */} {currentStep === 0 && ( + {/* Part 1: Install Apps */} } - message="Prepare Your Android Phone" + message="Step 1 — Install Apps on Android" description={
- Follow these steps on your Android phone: -
    -
  1. Install Termux from F-Droid (not Play Store)
  2. -
  3. Install Termux:API from F-Droid
  4. -
  5. In Termux, run: pkg install python && pip install flask
  6. -
  7. Grant SMS permissions when prompted
  8. -
  9. Install Tailscale from Play Store (optional, for stable IP)
  10. + + + Both Termux and Termux:API MUST be installed from F-Droid — not the Play Store. + +
    + + The Play Store version of Termux is abandoned and incompatible with the API plugin. + If you have Termux from the Play Store, uninstall it first and reinstall from F-Droid. + +
    +
      +
    1. + Termux — terminal emulator for Android +
      Install from F-Droid (f-droid.org). If already installed from Play Store, uninstall it first. +
    2. +
    3. + Termux:API — gives Termux access to SMS, contacts, battery, GPS +
      Also from F-Droid. Both apps must come from the same source or SMS commands won't work. +
    4. +
    5. + Tailscale — VPN mesh for stable IP addressing (recommended) +
      Install from Play Store. Creates a persistent 100.x.x.x IP so the server can always reach your phone. +
} /> - API Key + {/* Part 2: Termux Setup */} + } + message="Step 2 — Set Up Termux" + description={ +
+ Open Termux on the phone and run each command (tap the copy icon): +
+ + + + + +
+ + Tap Allow when Android asks for SMS and Contacts permissions. + If you miss the prompt, go to Android Settings → Apps → Termux:API → Permissions. + +
+ } + /> + + {/* Part 3: API Key */} + Step 3 — Generate & Set API Key - Generate an API key that both the server and phone will use for authentication. - You'll paste this key into the phone's Termux environment. + Generate a shared secret key. Both the server and phone use this to authenticate API requests. + Click the button below, then paste the key into Termux. @@ -352,15 +411,64 @@ export default function SmsSetupPage() { )} - - On the phone in Termux, set this as SMS_API_SECRET environment variable - before starting the SMS server. + + Now run these in Termux on the phone: +
+ + > ~/.bashrc`} /> +
+ + } + /> + )} + + {/* Part 4: Start the server */} + {generatedKey && ( + } + message="Step 4 — Start the SMS Server" + description={ +
+ With the API key set, start the Flask server: +
+ +
+ + You should see output like: Termux SMS API Server Starting with the device IP and port 5001. + + + To keep it running permanently: +
+ +
+ + For auto-start on phone reboot, install Termux:Boot from F-Droid. + Also disable battery optimization: Android Settings → Apps → Termux → Battery → Unrestricted.
} /> )} + {/* Access methods info */} + + You can run these commands on the phone via: +
    +
  • Directly on phone — open the Termux app and type commands
  • +
  • SSH — run sshd in Termux, then ssh -p 8022 phone-ip from your computer
  • +
  • scrcpy — mirror the phone screen to your computer via USB or WiFi
  • +
+ + } + /> +