-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature]: WhatsApp login via phone-pairing code (Baileys requestPairingCode) as alternative to QR #81889
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.staleMarked as stale due to inactivityMarked as stale due to inactivity
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Priority
None yet
Summary
Add a phone-pairing-code login flow for the WhatsApp channel (Baileys' 8-character
requestPairingCode) as an alternative to QR scanning.Problem to solve
The current WhatsApp login requires scanning a QR in WhatsApp → Linked Devices. That's the only path. It breaks for:
Baileys natively supports phone-pairing-code linking —
sock.requestPairingCode(phoneE164)returns an 8-character code that the user enters under WhatsApp → Linked Devices → Link with phone number instead. OpenClaw doesn't expose this.Proposed solution
extensions/whatsapp/src/login-pairing.tsmirroringlogin-qr.ts. State machine must wait forconnection.updatewithconnection === "connecting"(or a QR event) before callingsock.requestPairingCode(phoneE164NoPlus)— this was the timing bug behind the removedstartWebLoginWithCodein startWebLoginWithCode calls requestPairingCode before socket reaches connecting state #56797.openclaw channels login --channel whatsappwith--method pairing-codeand--phone <E.164>(no+).setup-finalize.ts): branch offering QR vs pairing code; prompt for the phone number if pairing is chosen.agent-tools-login.ts): variant tool that accepts a phone-number arg and returns the 8-char code.connection-controller.ts,status-issues.ts,login.ts): make the "scan QR again" copy method-aware.UX detail: WhatsApp displays the code as
XXXX-XXXX; print it that way. Code is 8 alphanumeric chars, not 6 digits.Alternatives considered
requestPairingCode, persisting multi-file auth state into~/.openclaw/credentials/web/...), but unsupported, brittle to internal path changes, doesn't survive re-links.--outputflag or HTTP endpoint #45652, closed): solves SSH/server QR display but still requires a working camera on the target phone.Impact
Concrete current case: trying to link WhatsApp from an older phone whose rear camera is broken (cannot scan), targeting an OpenClaw instance running on a remote server. No path forward in the product today.
Evidence / examples
startWebLoginWithCodeattempt; the closing comment confirms the symbols were removed entirely rather than fixed.--outputflag or HTTP endpoint #45652 (headless QR pain), Baileys RC9 Auth Breaking Changes — Device Pairing Patches #19907 (Baileys RC9 device pairing patches).Additional information
XXXX-XXXX. Not 6 digits.+.requestPairingCodemust be called only after the socket emitsconnection.updatewithconnection === "connecting"or a QR event — see startWebLoginWithCode calls requestPairingCode before socket reaches connecting state #56797 for the regression to avoid.7.0.0-rc.9had a known issue where the pairing code generated but the phone never got a notification ([BUG] Pairing code generated but not received as WhatsApp notification with version 7.0.0-rc.9 WhiskeySockets/Baileys#2306) — pin a known-good version.