Pairing Workflows (AUTH-01 - AUTH-04)
gmessages-rag pairs with Google Messages by importing Google session cookies. The Google Messages app no longer offers camera-based linking. Cookie import works like the Matrix token login: copy a signed-in request from your browser, then paste it into the daemon.
Required Cookies (AUTH-02)
The importer requires these Google session cookies:
SIDHSIDOSIDSSIDAPISIDSAPISID
The importer preserves extra cookies. It validates the required set and never prints cookie values in errors.
Accepted Input Formats (AUTH-02)
Paste any of these formats:
- A cURL command copied from browser DevTools.
- A raw
Cookie: ...header line. - A flat JSON object such as
{"SID":"...","HSID":"..."}. - A wrapped JSON object such as
{"cookies":{"SID":"..."}}. - A JSON array from a cookie export tool such as
[{"name":"SID","value":"..."}]. - Semicolon-separated pairs such as
SID=...; HSID=....
Workflow A: Import Cookies via CLI (AUTH-02)
- Sign in to https://messages.google.com/web in your browser.
- Open DevTools (
F12) and select the Network tab. - Select a request to
messages.google.com, for exampleconfig. - Right-click the request, select Copy, then select Copy as cURL.
- Run the pairing command and paste the command when prompted:
docker exec -it gmessages-rag gmessages-rag pairYou can also read cookies from a file or stdin:
gmessages-rag pair --cookies /tmp/google-cookies.txt
cat /tmp/google-cookies.txt | gmessages-rag pair --cookies -The daemon validates the cookies, saves the session to /data/auth/session.json with POSIX 0600 permissions, and starts the Gaia emoji challenge.
Workflow B: Import Cookies via Web Dashboard (AUTH-02)
Open the dashboard pairing page:
http://localhost:8090/pair- Follow the on-screen instructions to copy a cURL command from DevTools.
- Paste the command into the text area.
- Select Pair with cookies.
- The page polls for status and shows the Gaia emoji challenge when Google accepts the cookies.
Workflow C: Gaia Emoji Challenge (AUTH-04)
After cookie validation, Google requires a single-device device-link challenge. This step works on one phone without a second camera screen:
- Open
/pairor run the CLI command. - The daemon validates the imported cookies and requests a pairing challenge from Google.
- The expected emoji (e.g.
🚀or🐶) appears in the web interface or arrives through Apprise/ntfy. - Open Google Messages on the same phone and tap the matching emoji. No camera scan is required.
Gated Live Smoke Test (HARN-04)
Before you rely on a real account in production, run the opt-in end-to-end smoke test. It proves the real provider handoff: cookie authentication, session persistence, connection, and one inbound message.
It never runs in CI. It requires the live build tag plus explicit environment variables:
GM_ALLOW_NETWORK=1 \
LIVE_GM_TEST=1 \
COOKIES_PATH=/tmp/google-cookies.txt \
SESSION_PATH=/tmp/live-smoke-session.json \
DATABASE_URL='postgres://user:pass@host:5432/gmessages' \
go test -tags live -race -v -timeout 5m -run TestLiveSmoke_EndToEnd ./internal/gm/Set COOKIES inline instead of COOKIES_PATH when you cannot write a file. A pre-paired SESSION_PATH skips the cookie import.
During the run:
- The test prints the Gaia emoji challenge to the test log when the session is not paired.
- Approve the matching emoji in Google Messages on your phone.
- Send one test message from the paired phone within the 2-minute window.
- The test asserts the session file is
0600,Connectsucceeds, and the inbound message reaches the ingestion callback.
Use a dedicated SESSION_PATH so the smoke test never clobbers the daemon's session. Do not commit the session file or any message content.