#13764: feat(whatsapp): add --qr-png option to save QR code as PNG file
channel: whatsapp-web
cli
stale
Cluster:
WhatsApp Enhancements and Fixes
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
#9237: Fix: WhatsApp QR code not rendering in chat
by vishaltandale00 · 2026-02-05
77.0%
#9606: fix: pass fileName to WhatsApp document messages
by AytuncYildizli · 2026-02-05
75.8%
#9515: fix(web): retry WhatsApp 515 restart up to 3 times with delay
by Sebachowa · 2026-02-05
74.6%
#13696: feat(cli): add --code option for WhatsApp pairing code login
by asklee-klawd · 2026-02-10
73.9%
#11484: feat: add WhatsApp pairing code login as alternative to QR scanning
by BlackScript · 2026-02-07
73.1%
#3071: fix: WhatsApp 515 error retry not triggering
by rabsef-bicrym · 2026-01-28
73.0%
#21881: fix(whatsapp): pass user-provided fileName through document send pipe…
by saakshigupta2002 · 2026-02-20
72.7%
#16785: fix(whatsapp): preserve document filenames in outbound Baileys mode
by SahilSahu731 · 2026-02-15
72.7%
#6566: fix: thread fileName through WhatsApp document send path
by giannisanni · 2026-02-01
72.5%
#9727: fix(whatsapp): retry reconnect loop on initial connection failure
by luizlf · 2026-02-05
72.4%