Add WhatsApp pairing code login (--phone flag)#83482
Conversation
Adds --phone flag to `openclaw channels login` that uses Baileys' requestPairingCode() to generate an 8-digit code instead of a QR. Users enter the code in WhatsApp > Linked Devices > Link with phone number. This enables WhatsApp linking without a second device for QR scanning, which is critical for automated/headless deployment flows. Usage: openclaw channels login --channel whatsapp --phone +353830836798 Changes: - session.ts: Accept phoneNumber option, call requestPairingCode() when QR is generated and phone number is provided, fall back to QR on error - login.ts: Add phoneNumber parameter to loginWeb(), normalize phone format - channel.ts: Pass phoneNumber from auth login callback to loginWeb() - channels-cli.ts: Add --phone option to `channels login` command - channel-auth.ts: Add phoneNumber to ChannelAuthOptions, pass through - types.adapters.ts: Add phoneNumber to ChannelAuthAdapter login params Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Codex review: needs real behavior proof before merge. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
Summary Reproducibility: no. not for a bug reproduction; this is a new login capability. The PR has an unchecked test plan and no live WhatsApp evidence showing the after-fix behavior. PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Keep pairing-code login in a WhatsApp-owned or plugin-declared auth-options surface, redact transient pairing data from logs, cover QR and pairing paths with focused tests, and require redacted live WhatsApp proof before merge. Do we have a high-confidence way to reproduce the issue? No, not for a bug reproduction; this is a new login capability. The PR has an unchecked test plan and no live WhatsApp evidence showing the after-fix behavior. Is this the best way to solve the issue? No, not as written. Baileys supports pairing-code login, but this implementation logs sensitive material and adds a WhatsApp-only field to the generic channel auth surface instead of using a clean plugin-owned or plugin-declared option path. Label justifications:
Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 322f0bb7bc0a. |
Summary
--phoneflag toopenclaw channels loginfor WhatsApp pairing code authenticationrequestPairingCode()as an alternative to QR code scanningMotivation
QR code scanning requires a second device, which blocks automated/headless deployment flows and mobile-first onboarding (e.g., deploying OpenClaw from a WhatsApp conversation where the user can't scan a QR displayed on the same phone).
Pairing codes let users link WhatsApp by entering an 8-digit code in WhatsApp > Linked Devices > "Link with phone number instead" — no second device needed.
Usage
Output:
Changes
extensions/whatsapp/src/session.ts— AcceptphoneNumberoption, callrequestPairingCode()when QR is generated and phone number is providedextensions/whatsapp/src/login.ts— AddphoneNumberparameter tologinWeb()extensions/whatsapp/src/channel.ts— PassphoneNumberfrom auth login callbacksrc/cli/channels-cli.ts— Add--phoneoption tochannels logincommandsrc/cli/channel-auth.ts— ThreadphoneNumberthrough auth optionssrc/channels/plugins/types.adapters.ts— AddphoneNumbertoChannelAuthAdaptertypeTest plan
openclaw channels login --channel whatsappstill works with QR (no regression)openclaw channels login --channel whatsapp --phone +<number>generates pairing coderequestPairingCode()fails🤖 Generated with Claude Code