← Back to PRs

#13764: feat(whatsapp): add --qr-png option to save QR code as PNG file

by aorfevre open 2026-02-11 01:03 View on GitHub →
channel: whatsapp-web cli stale
Adds support for saving the WhatsApp login QR code as a PNG file instead of displaying ASCII art in the terminal. ### Usage ⁠ bash # Save QR to specific file openclaw channels login --qr-png ./whatsapp-qr.png # Save QR to directory (uses default filename) openclaw channels login --qr-png /tmp/ # → Saves to /tmp/whatsapp-qr.png  ⁠ ### Use Cases •⁠ ⁠*Headless servers* — view QR remotely via file share/SCP •⁠ ⁠*Remote access* — scan from another device when terminal isn't visible •⁠ ⁠*Docker/containers* — no TTY available for ASCII output •⁠ ⁠*Automation* — deliver QR image via notifications ### Changes *⁠ src/web/session.ts ⁠:* •⁠ ⁠Extended ⁠ createWaSocket ⁠ opts with ⁠ qrPngPath?: string ⁠ •⁠ ⁠Added path resolution logic (appends ⁠ whatsapp-qr.png ⁠ if directory given) •⁠ ⁠Creates parent directories if needed •⁠ ⁠Renders QR via ⁠ renderQrPngBase64() ⁠ with scale 8, margin 4 •⁠ ⁠Writes PNG file and logs path •⁠ ⁠Skips terminal ASCII output when ⁠ --qr-png ⁠ is set ### Output QR code saved to: ./whatsapp-qr.png Scan this QR in WhatsApp → Linked Devices --- Want me to check if there are any missing pieces (like CLI option registration or tests)? <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a `--qr-png [path]` option to `openclaw channels login` and threads the resulting `qrPngPath` through the channel auth adapter into the WhatsApp web login flow. On the WhatsApp side, `createWaSocket` now supports `opts.qrPngPath` and, when present, renders the QR to a PNG (via `renderQrPngBase64`) and writes it to disk (creating parent directories). When `qrPngPath` is set, the terminal ASCII QR output is skipped. <h3>Confidence Score: 3/5</h3> - Reasonably safe, but has a couple user-facing failure modes in the new QR-to-PNG path handling. - Core wiring of the new flag through CLI → auth adapter → WhatsApp login looks consistent, and PNG generation uses existing QR rendering code. Main concerns are that write failures are swallowed while ASCII output is disabled (can leave users with no QR at all), and the file-vs-directory heuristic can mis-handle directories named '*.png'. - src/web/session.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs