Getting started¶
This guide links WaWarden to a real WhatsApp account. It takes you from an empty host to a paired service with a verified backup and a first client registered in Claude Code. To try WaWarden without an account first, use the fake engine demo in the README.
Read the residual risks and the ban-risk notes before linking an account. WhatsApp can restrict, log out or ban an account that links an unofficial client.
The commands use wawarden, installed as Install describes, and
the default addresses on 127.0.0.1. To run in a container instead, read
Running in a container alongside each step.
Contents¶
- Prerequisites
- Install
- 1. Prepare the secrets
- 2. Configure and start
- 3. Put it behind HTTPS
- 4. Pair
- 5. Watch the status
- 6. The first history sync
- 7. The first backup
- 8. The first client
- Running in a container
- You now have
- What next
Prerequisites¶
- WaWarden, installed as Install describes: a release binary, the image, or a build from source.
- A user other than root to run the service.
serverefuses to start as root. - The age tools on a second machine, to hold the key that decrypts backups.
- openssl, if you want the webhook, to create its signing secret.
- A supervisor that keeps the service's standard output and gives it more than 10 seconds to stop, such as systemd (see the hardening guide's unit) or a container runtime.
- The owner's phone, with WhatsApp signed in to the account you link.
- A way to reach the service over HTTPS from the agent's host: a mesh VPN such as Tailscale, a private subnet with TLS, or a reverse proxy with TLS (see network patterns).
- Claude Code, or another MCP client, on the agent's host.
Install¶
Supported platforms¶
| Platform | Release artifacts | From source |
|---|---|---|
Linux on amd64 (x86_64) and arm64 (aarch64) |
Binaries, directly or through Homebrew, and the container image | Supported |
| macOS 13 Ventura or later, Apple silicon and Intel | Binaries, directly or through Homebrew, from v1.1.0 on |
Supported; CI runs the tests and the release build on Apple silicon and Intel |
| Linux on other architectures | None | May build; not tested |
| Windows, FreeBSD, OpenBSD and other systems | None | Does not build |
Deploy the service on Linux, under systemd or as a container. On Windows, use a Linux virtual machine; WSL2 and Docker Desktop have not been tested.
On macOS, WaWarden is supported for the commands you run away from the
service, such as backup verify and audit verify on the machine that holds
the backup identity, and admin init, and for trying it. serve runs on macOS
and CI runs its tests there, but this documentation deploys the service on
Linux only: the systemd unit and the container image are for Linux, and no
launchd unit is provided.
Release binary¶
Each release ships a static Linux binary per architecture,
wawarden_<version>_linux_<arch>, with SHA256SUMS and a Sigstore bundle of
their build provenance, wawarden_<version>_provenance.sigstore.json. These
commands download the latest release's binary for this host into a new empty
directory, check its checksum and provenance, and install it as
/usr/local/bin/wawarden. They stop at the first step that fails, so nothing
is installed unless both checks pass. They need gh
but no GitHub account:
cd "$(mktemp -d)"
version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' https://github.com/dortort/wawarden/releases/latest)
version=${version##*/}
case $(uname -m) in x86_64) arch=amd64 ;; aarch64) arch=arm64 ;; esac
binary=wawarden_${version}_linux_$arch
bundle=wawarden_${version}_provenance.sigstore.json
gh release download "$version" --repo dortort/wawarden --pattern "$binary" &&
gh release download "$version" --repo dortort/wawarden --pattern SHA256SUMS --pattern "$bundle" &&
sha256sum --ignore-missing -c SHA256SUMS &&
gh attestation verify "$binary" --repo dortort/wawarden --bundle "$bundle" \
--cert-identity https://github.com/dortort/wawarden/.github/workflows/release.yml@refs/heads/main &&
sudo install -m 0755 "$binary" /usr/local/bin/wawarden &&
wawarden version
To install another release, set version to its tag. The binary is
downloaded on its own, so on a machine whose architecture has no binary gh
stops with no assets match the file pattern. --ignore-missing checks only
the files you downloaded; without it, the check fails on the other files
SHA256SUMS lists. gh attestation verify checks the binary against the
release's own bundle: that the release workflow on main of this repository
built it. Verifying a release
describes these checks and the others.
Without gh, download the same files with curl, in place of the two
gh release download commands. The provenance check still needs gh:
base=https://github.com/dortort/wawarden/releases/download/$version
curl -fL --remote-name-all "$base/$binary" "$base/SHA256SUMS" "$base/$bundle"
The binaries' names carry the version. Only SHA256SUMS has a URL that
always names the latest release:
https://github.com/dortort/wawarden/releases/latest/download/SHA256SUMS.
Homebrew¶
On macOS, and on a Linux machine that does not run the service, install with Homebrew:
The formula, in the dortort/homebrew-tap
tap, installs this system's prebuilt binary from the newest release the tap has
published, as wawarden in $(brew --prefix)/bin. The formula records each
binary's checksum from the release's SHA256SUMS, and Homebrew checks the
download against it. The tap publishes the formula for a release only after
checking the release's provenance. Homebrew does not quarantine the files a
formula downloads, so on macOS the binary runs without the xattr step that
macOS describes for a browser download. brew upgrade wawarden
installs a newer release once the tap has published it.
If you installed wawarden by hand before, remove that copy with
sudo rm /usr/local/bin/wawarden, so that wawarden runs the one Homebrew
manages. On an Intel Mac, remove it before brew install: Homebrew links into
/usr/local/bin there and cannot link over a file that already exists.
Homebrew installs the release's binary unchanged, so you can check the
installed file's provenance yourself against the release's Sigstore bundle.
These commands download the bundle of the installed version into a new empty
directory and check the file that wawarden runs. They need
gh but no GitHub account:
cd "$(mktemp -d)"
version=$(wawarden version | sed -n 's/^wawarden //p')
bundle=wawarden_${version}_provenance.sigstore.json
gh release download "$version" --repo dortort/wawarden --pattern "$bundle" &&
gh attestation verify "$(command -v wawarden)" --repo dortort/wawarden --bundle "$bundle" \
--cert-identity https://github.com/dortort/wawarden/.github/workflows/release.yml@refs/heads/main
On macOS, serve needs WAWARDEN_DATA_DIR, as macOS describes. On
Linux, install the service's own binary as Release binary
describes instead: the systemd unit runs
/usr/local/bin/wawarden, and Homebrew's prefix belongs to the user who
installed Homebrew, who could replace the binary the service runs.
macOS¶
On a Mac, Homebrew is the shortest route. This section installs without it.
From v1.1.0 on, releases also ship wawarden_<version>_darwin_arm64, for
Apple silicon, and wawarden_<version>_darwin_amd64, for Intel Macs. They run
on macOS 13 Ventura or later and link only the system's own libraries.
v1.0.0 and earlier have none, and the commands below stop at their first
step for such a release: gh reports no assets match the file pattern. For
those, use go install or
build from source.
cd "$(mktemp -d)"
version=$(curl -fsSLI -o /dev/null -w '%{url_effective}' https://github.com/dortort/wawarden/releases/latest)
version=${version##*/}
case $(uname -m) in x86_64) arch=amd64 ;; arm64) arch=arm64 ;; esac
binary=wawarden_${version}_darwin_$arch
bundle=wawarden_${version}_provenance.sigstore.json
gh release download "$version" --repo dortort/wawarden --pattern "$binary" &&
gh release download "$version" --repo dortort/wawarden --pattern SHA256SUMS --pattern "$bundle" &&
shasum -a 256 --ignore-missing -c SHA256SUMS &&
gh attestation verify "$binary" --repo dortort/wawarden --bundle "$bundle" \
--cert-identity https://github.com/dortort/wawarden/.github/workflows/release.yml@refs/heads/main &&
sudo mkdir -p /usr/local/bin &&
sudo install -m 0755 "$binary" /usr/local/bin/wawarden &&
wawarden version
The macOS binaries are not notarized by Apple. Files that gh and curl
download carry no quarantine attribute, so they run. A browser marks its
downloads as quarantined, and macOS then refuses to run the file because it
cannot check it for malware. For a browser download, run the checks above,
then remove the attribute before sudo install, which copies it to the
installed file: xattr -d com.apple.quarantine wawarden_<version>_darwin_<arch>.
If you installed it already, remove it there too:
sudo xattr -d com.apple.quarantine /usr/local/bin/wawarden. The Apple
silicon binary carries the ad-hoc signature that Go's linker writes, which
Apple silicon requires before it runs any code; it names no developer. The
Intel binary is unsigned.
serve needs WAWARDEN_DATA_DIR: its default, /data, does not exist on
macOS and cannot be created there. The other commands read no data directory;
keys rotate takes it as --data-dir.
With go install¶
This builds the latest release from the Go module proxy and installs it as
wawarden in $(go env GOPATH)/bin, or in GOBIN when that is set; that
directory must be on your PATH, or copy the binary to /usr/local/bin with
sudo install -m 0755. A new Apple silicon Mac has no /usr/local/bin; create
it first with sudo mkdir -p /usr/local/bin. It needs Go 1.26.0 or later; with
GOTOOLCHAIN=auto, an older Go downloads a newer one. It builds with that Go
rather than the toolchain the releases use, so the binary is not byte-identical
to a release binary and has no provenance attestation.
go version -m "$(command -v wawarden)" shows the release it was built from.
wawarden version shows it too, except for v1.0.0 and earlier, which print
dev.
Container image¶
Each release publishes a multi-arch image for linux/amd64 and linux/arm64.
Pull it by the digest in the release's notes,
ghcr.io/dortort/wawarden@sha256:<digest>. Each image is also tagged with its
version, ghcr.io/dortort/wawarden:<version>. No latest tag exists, by
design: a deployment names the release it runs, and the signature and
attestations cover the digest. Pulling needs no registry login. Check the
image's signature and provenance as
Verifying a release describes:
cosign verify needs no GitHub account, and the provenance check needs
gh auth login.
Running in a container gives the commands that
replace the steps below.
Build from source¶
You need git and Go. Build a release tag, not main:
git clone https://github.com/dortort/wawarden
cd wawarden
git checkout "$(git tag --list 'v*' --sort=-v:refname | head -n 1)"
CGO_ENABLED=0 go build -trimpath -o wawarden ./cmd/wawarden
sudo mkdir -p /usr/local/bin
sudo install -m 0755 wawarden /usr/local/bin/wawarden
CGO_ENABLED=0 builds without cgo, like the release; on Linux that makes a
static binary. The go command, 1.21 or later, downloads the Go version on the
toolchain line of go.mod when the installed one is older. Some
distributions' Go packages, such as Fedora's and Alpine's, set
GOTOOLCHAIN=local in their go.env, which turns that off. The build then
needs Go 1.26.0 or later, the go line of go.mod, and uses the installed Go.
go env GOTOOLCHAIN shows the setting, and GOTOOLCHAIN=auto in front of the
build command turns the download back on.
wawarden version of a clean checkout of a release tag prints that release,
except for v1.0.0 and earlier, which print dev; any other source build
prints dev. go version -m wawarden shows the module version. The
binary is not byte-identical to the release's;
Reproducing a release gives the
procedure that is.
The service user¶
The systemd unit runs /usr/local/bin/wawarden as the
system user and group wawarden, and creates the data directory,
/var/lib/wawarden. Create the user without a login shell; its home is that
directory:
sudo useradd --system --user-group --home-dir /var/lib/wawarden --no-create-home --shell /usr/sbin/nologin wawarden
The rest of this guide runs wawarden as your own user, in the foreground.
The unit takes over for a lasting deployment.
1. Prepare the secrets¶
In a directory that only you can read, generate the admin token. Keep the
token and its hash in separate files. The service is given the hash only. Keep
a copy of the token in a secret manager, from which --token-command can
also read it:
umask 077
wawarden admin init > admin.txt
sed -n 's/^sha256: //p' admin.txt > admin.sha256
sed -n 's/^token: //p' admin.txt > admin.token
rm admin.txt
On the second machine, create the key pair that backups are encrypted to.
Keep backup-identity.txt there. The service needs only the public key,
age1..., that age-keygen prints:
For a webhook, also create its signing secret, readable only by the service's user:
2. Configure and start¶
Set the owner's number in E.164 form, the hash file, the backup recipient and a data directory whose parent exists. Then start the service:
export WAWARDEN_DATA_DIR="$HOME/wawarden-data"
export WAWARDEN_OWNER_PHONE=+15550100001
export WAWARDEN_ADMIN_TOKEN_SHA256_FILE="$PWD/admin.sha256"
export WAWARDEN_BACKUP_AGE_RECIPIENT='age1...'
wawarden serve
serve runs in the foreground, so run the admin commands of the next steps
in a second terminal. For a lasting deployment, run it under a supervisor
instead; the systemd unit sets the same variables.
Optional variables:
WAWARDEN_NOTIFY_URLandWAWARDEN_NOTIFY_SECRET_FILEsend every event to a signed webhook.WAWARDEN_METRICS_EMF=1writes metrics on standard output in embedded metric format (EMF).
Environment variables lists every
variable. Any other WAWARDEN_ variable stops the start (see
startup refusals).
The start writes JSON lines such as keys_loaded, archive_opened,
session_opened with "paired":false, one listening per listener and
ready. With no device stored, the engine reports unpaired and makes no
connection to WhatsApp. Without a backup recipient, every start warns
backup_disabled.
The first start creates the master key, keys/master, in the data directory.
No backup holds it, so keep a copy of it off the host. Without it, a restored
archive gets a new key: pseudonyms, cursors and message references change, and
audit verify reports the older audit rows as unknown_key (see
Restoring a backup).
3. Put it behind HTTPS¶
The listeners speak plain HTTP on loopback. The agent's host reaches the client listener through something that encrypts the path and decides who may connect. Never expose WaWarden to the public internet.
Choose one of the network patterns:
- Mesh or VPN forwarding to loopback,
such as Tailscale Serve. It keeps the service on its defaults. For example,
tailscale serve --bg 8080serves the client listener athttps://<machine>.<tailnet>.ts.net/. Never usetailscale funnel, which exposes a port to the whole internet. - Private subnet, with TLS on top unless you control the segment.
- Reverse proxy with TLS, optionally with client certificates. Read its list of constraints on bodies, timeouts and headers.
Expose the client listener, port 8080, only. Keep the admin listener on the
service's host, or gate it separately (see
the hardening guide).
Check from the agent's host. Without a token, the service answers 401:
4. Pair¶
It prints pairing code: <code>, and on standard error where to enter it. On
the owner's phone, in WhatsApp, open Linked devices, choose Link a device,
then Link with phone number instead, and enter the code. The phone's
notification names a Chrome (Linux) device; Linked devices then lists it as
WaWarden (Linux). The code goes to you only; it is never logged or kept.
| Refusal | Exit code | What to do |
|---|---|---|
owner_phone_missing |
5 |
Set WAWARDEN_OWNER_PHONE and restart. |
already_paired |
5 |
A device is stored already; see admin status. |
rate_limited |
5 |
Three attempts were made in the last hour; wait. |
pair_failed |
1 |
The connection failed or no code came within 25 seconds. Check outbound access to web.whatsapp.com and try again. |
Only the account whose number is WAWARDEN_OWNER_PHONE can be linked. A code
entered on another account's phone is refused before anything is stored. If
such a pairing completes, the new device is logged out again. Either way the
service reports pair_rejected.
5. Watch the status¶
state: connected
reason: none
paired: true
chats: 12
messages: 3456
history blobs pending: 0
history blobs quarantined: 0
inbox backlog: 0
inbox quarantined: 0
backfills today: 0
clients active: 0
clients expired: 0
clients revoked: 0
all-chats clients active: 0
last ingest: 2026-10-05T08:00:00Z
version: <version>
state is unpaired, connecting, connected or disconnected, the last
with a reason. Right after pairing, WhatsApp asks the new device to log in
again. The engine handles that as a dropped connection, so expect a short
connecting before connected.
Each change is logged as engine_state, and the gauges wawarden_paired and
wawarden_connected follow it. Every stop that waits for you is reported as a
disconnected event, on standard output and to the webhook.
Disconnect reasons says what to do for each
reason.
6. The first history sync¶
Once paired, the owner's phone sends the chat history in blobs:
history blobs pendingrises as they are announced. It returns to0as each is downloaded intohistory/, applied to the archive and deleted.chats,messagesandlast ingestgrow with it, and so doeswawarden_messages_ingested_total.- Blobs are downloaded only while connected. A restart takes up those still waiting.
- A blob larger than
WAWARDEN_HISTORY_MAX_BYTES(32 MiB by default), or one that fails three times, is quarantined. Thequarantineevent reports it withqueuehistory, andhistory blobs quarantinedcounts it.
History sync gives the details.
7. The first backup¶
With a backup recipient, the service takes a first backup once both hold:
- no history blob is waiting;
- 10 minutes have passed since the later of the pairing and the latest blob's arrival.
It writes backups/<UTC time>.age, such as backups/20261005T120000Z.age,
and reports backup_done, or backup_failed with a reason. A failed backup
is tried again after 15 minutes, then after waits that double up to 4 hours.
From then on it takes one backup each night at WAWARDEN_BACKUP_TIME,
03:00 UTC by default, and keeps the newest WAWARDEN_BACKUP_KEEP, 14 by
default (see backups).
Copy the backup off the host, then check it on the machine that holds the age identity:
set -o pipefail
mkdir -m 700 verify
age --decrypt -i backup-identity.txt 20261005T120000Z.age |
wawarden backup verify --work-dir verify -
It prints counts only and ends with verified: yes.
Restoring a backup gives the restore
procedure.
8. The first client¶
List the chats the agent may read, then create a client for them:
wawarden admin chats list --match <part of a name> --token-file admin.token
wawarden admin clients create --token-file admin.token \
--name claude-code --read <id, +E.164 number or ref> --expires-days 90
--readtakes a chat'sid, a+E.164number or therefthatadmin chats listprints. It can be repeated.- The client expires after 90 days unless
--expires-dayssays otherwise, 365 at most. - The command prints the client's lines, then
token: ww_..., once.
Keep the token in a secret manager, or in the agent host's environment as
WAWARDEN_TOKEN. Never put it in a repository or in the service's
environment (see
Registering with Claude Code).
admin status now counts the client under clients active. Each request it
makes is written on standard output with its chain head (see
the audit chain).
A client that sends¶
A client that sends needs --write for each chat it may send to. Each write
chat must also be one of its --read chats, and an all-chats client cannot
write:
wawarden admin clients create --token-file admin.token \
--name claude-code-reply --read <chat> --write <chat>
Sending to a direct chat that has never written to the account is refused
unless the client was created with --allow-first-contact. Leave it off
unless the agent must start conversations (see
the ban-risk notes).
Register with Claude Code¶
On the agent's host, register the endpoint at the HTTPS address from step 3:
claude mcp add --transport http whatsapp https://<your-host>/mcp --header "Authorization: Bearer $WAWARDEN_TOKEN"
claude mcp get whatsapp shows it as connected. /mcp in a Claude Code
session lists five tools: get_changes, get_chat, get_messages,
list_chats and search_messages. A client with write chats also gets
send_message, and a client created with --allow-media gets get_attachment
while WAWARDEN_MEDIA_MAX_BYTES is above 0.
This form stores the token itself in ~/.claude.json.
Registering with Claude Code says what
each --scope writes, and how to keep the token out of files with .mcp.json
or a headersHelper.
Before the agent reads anything, read the guide for agents: every name and text it returns is third-party text.
Running in a container¶
The image runs as 65532:65532, keeps its data in the /data volume and has
no shell. Leave WAWARDEN_DATA_DIR unset, pass the hash itself as
WAWARDEN_ADMIN_TOKEN_SHA256, and pass the other variables with -e. The
full contract is in the container image,
and the Docker Compose example
shows the same settings as a Compose file.
Prepare the secrets with the image, as in step 1:
image=ghcr.io/dortort/wawarden@sha256:<digest>
umask 077
docker run --rm "$image" admin init > admin.txt
sed -n 's/^sha256: //p' admin.txt > admin.sha256
sed -n 's/^token: //p' admin.txt > admin.token
rm admin.txt
Start the service. The client listener binds 0.0.0.0 inside the container
and is published on the host's loopback only, for the HTTPS front of
step 3. The service logs listener_not_loopback for
it at every start. The admin listener stays on the container's loopback:
docker volume create wawarden-data
docker run -d --name wawarden --read-only --stop-timeout 15 \
--mount type=volume,src=wawarden-data,dst=/data \
-e WAWARDEN_ADMIN_TOKEN_SHA256="$(cat admin.sha256)" \
-e WAWARDEN_OWNER_PHONE=+15550100001 \
-e WAWARDEN_BACKUP_AGE_RECIPIENT='age1...' \
-e WAWARDEN_LISTEN=0.0.0.0:8080 \
-p 127.0.0.1:8080:8080 \
"$image"
docker logs wawarden
docker exec wawarden /wawarden healthcheck && echo healthy
Run the admin commands inside the container, with the token on standard input:
docker exec -i wawarden /wawarden admin pair --token-stdin < admin.token
docker exec -i wawarden /wawarden admin status --token-stdin < admin.token
docker exec -i wawarden /wawarden admin chats list --token-stdin < admin.token
docker exec -i wawarden /wawarden admin clients create --token-stdin \
--name claude-code --read <id, +E.164 number or ref> < admin.token
Copy a backup out of the volume to check it, as in step 7:
For a webhook, mount its secret file read-only and point
WAWARDEN_NOTIFY_SECRET_FILE at it inside the container. It must be readable
by 65532:65532, and grant no write permission to its group and no
permission to others:
sudo chown 65532:65532 notify.secret
sudo chmod 0400 notify.secret
# add to the docker run command:
# --mount type=bind,src="$PWD/notify.secret",dst=/run/secrets/notify.secret,readonly
# -e WAWARDEN_NOTIFY_URL=https://<webhook>
# -e WAWARDEN_NOTIFY_SECRET_FILE=/run/secrets/notify.secret
The image declares no health check. Use ["/wawarden","healthcheck"] in exec
form in Compose or Kubernetes; docker run --health-cmd needs a shell the
image does not have. Container hardening
covers a sidecar for Tailscale and the other settings.
You now have¶
Each item has a command that confirms it. In a container, run the
wawarden commands with docker exec -i wawarden /wawarden ... --token-stdin < admin.token.
- A healthy service under a supervisor.
wawarden healthcheck && echo healthyprintshealthy. - A paired, connected account.
wawarden admin status --token-file admin.token | grep -E '^(state|paired):'printsstate: connectedandpaired: true. - A settled history sync. The same status shows
history blobs pending: 0. - A verified backup off the host.
ls "$WAWARDEN_DATA_DIR/backups"lists a.agefile, andbackup verifyprintedverified: yeson the second machine. - A copy of the master key off the host.
sha256sum "$WAWARDEN_DATA_DIR/keys/master"matches the copy's checksum. - The client listener behind HTTPS only.
curl -i https://<your-host>/v1/mefrom the agent's host answers401 Unauthorized. - A scoped client.
wawarden admin clients list --token-file admin.tokenshows it asstate: active, with itsexpiresdate. - The MCP endpoint registered.
claude mcp get whatsappshows it as connected.
What next¶
- Disconnect reasons: what each
reasonof adisconnectedengine means and what to do. - Unpairing and pairing again.
- Rotating a client token before it expires.
- Retiring other linked devices that the agent used before.
- The hardening guide's checklist and its alarms.
- The runbook for upgrades, restores and incidents.