OpenWA Portable (Windows) — runbook
====================================

WHAT YOU GET
  OpenWA.exe     — double-click to start (console stays open)
  node\          — portable Node 22 (no system install)
  app\           — prebuilt OpenWA (no npm on this PC)
  app\.env       — edit once per server

FIRST TIME ON A SERVER
  1. Extract the zip to e.g. C:\OpenWA-Portable
  2. Edit app\.env
       ULTRAMSG_MEDIA_BASE_URL=http://THIS_SERVER_IP:2785
       ULTRAMSG_WEBHOOK_URL=...  (list webhook; localhost OK if list is on same PC)
  3. Double-click OpenWA.exe
  4. First start may download Chromium into app\data\puppeteer (needs internet)
  5. Open http://localhost:2785 → create session → scan QR
  6. API key is printed in the console and saved to app\data\.api-key

LIST PROJECT (send URL)
  http://THIS_SERVER_IP:2785/api/ultramsg/SESSION_ID/messages/chat
  token = contents of app\data\.api-key

STOP
  Focus the OpenWA console → Ctrl+C
  Or end the node process. Do not start a second OpenWA.exe while one is running
  (launcher blocks via app\data\openwa.pid).

OPTIONAL: ADMIN-ONLY WRITE (soft lock)
  On the server, as Administrator, lock the package so casual users cannot edit it
  (you still need write access under app\data for sessions / API key / Chromium):

    icacls "C:\OpenWA-Portable" /inheritance:r
    icacls "C:\OpenWA-Portable" /grant:r "%USERNAME%:(OI)(CI)F"
    icacls "C:\OpenWA-Portable\app\data" /grant:r "%USERNAME%:(OI)(CI)F"

  Or grant only your admin group Full control on the folder, and Users Read+Execute
  except app\data which must stay writable for the service account that runs OpenWA.exe.

SOFT LOCK LIMITS
  This package ships compiled JS only (no TypeScript src). That stops casual edits.
  Anyone with admin on the machine can still open files — this is not DRM.

REBUILD (on the build PC, in the OpenWA repo)
  npm run portable:windows
  Output zip: see pack.ps1 banner (default under c:\xampp\htdocs\ or repo parent).

REQUIREMENTS ON TARGET
  Windows x64, outbound network for WhatsApp + first Chromium download.
  Port 2785 free (or change PORT in app\.env).
