]> git.giacomolli.uk - onechat/commit
Link WhatsApp with a pairing code
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Sun, 8 Nov 2026 14:44:00 +0000 (11:44 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Sun, 8 Nov 2026 14:44:00 +0000 (11:44 -0300)
commit0018014ab36f3de61a4b8a5515009dab803d6c38
treeb5e34cb0850f18612a6829022332c0fe1bc19012
parentec230eee6b06580031637bc97c99ec6db7b41926
Link WhatsApp with a pairing code

The line /whatsapp pair PHONE in the terminal client or in Telegram
links the WhatsApp account of PHONE as a linked device. The daemon
answers with the steps and then with the pairing code in its own
message, so that it is easy to copy, and later with the linked number,
an expired code, or the failure. A new pairing ends the one before.
/whatsapp unlink logs the device out and deletes the session, and tells
the user to remove the device in the phone when the logout cannot reach
WhatsApp.

The phone number and the code go only to the client that asked. The log
of the agent gets only the notes that WhatsApp is linked or unlinked,
and the errors in the daemon log show the own number and the own LID as
OWN.

When the user removes the device in the phone, the daemon deletes the
session, notes it, and tells all clients one time. A disconnection that
lasts 10 minutes gives all clients one notice, not one for each retry of
the library, and one more when the connection comes back. A
disconnection that the library does not retry gives a notice at once.

The pair and unlink commands run one at a time in the WhatsApp goroutine
of the daemon, which ends a running pairing at the stop of the daemon.

Issue: 6f69ca1
README.rst
daemon.go
daemon_start_helper_test.go
whatsapp.go
whatsapp_fake_helper_test.go
whatsapp_test.go