Postduif: a small agent that links a WhatsApp number and relays messages to Karta
  • Rust 94.2%
  • Shell 2%
  • JavaScript 1.8%
  • CSS 1%
  • HTML 0.8%
  • Other 0.2%
Find a file
2026-11-14 19:28:49 +00:00
.cargo Add Windows build config, console detach, Wine smoke test 2026-11-13 00:53:26 -04:00
crates README for a stranger (status, honest notices), SECURITY.md, first-run errors shown in a message box, short acceptance guide for the live Karta, no update nag without a manifest 2026-11-13 13:05:06 -04:00
docs Docs: say that a pre-release exists, record the one reported real run as unproven, list the documents 2026-11-14 14:50:15 -04:00
tools Wine smoke test runs with a non-ASCII data folder 2026-11-13 13:10:33 -04:00
.gitignore Add workspace skeleton and protocol v1 types with fixture conformance tests 2026-11-13 00:14:18 -04:00
.woodpecker.yml Follow Karta's change 1 (fingerprint, bye then close), add proposed change 2, CI and Makefile 2026-11-13 00:56:25 -04:00
Cargo.lock Make the missing-acks test speak: journal contents, ack cursor, timestamped frames and the agent log on failure 2026-11-13 02:06:07 -04:00
Cargo.toml Add the WhatsApp channel (whatsapp-rust pinned to 1bd1fa5) with offline tests; wire it into the binary 2026-11-13 01:17:30 -04:00
CHANGELOG.md Docs: say that a pre-release exists, record the one reported real run as unproven, list the documents 2026-11-14 14:50:15 -04:00
LICENSE Add workspace skeleton and protocol v1 types with fixture conformance tests 2026-11-13 00:14:18 -04:00
Makefile Follow Karta's change 1 (fingerprint, bye then close), add proposed change 2, CI and Makefile 2026-11-13 00:56:25 -04:00
README.md Docs: say that a pre-release exists, record the one reported real run as unproven, list the documents 2026-11-14 14:50:15 -04:00
SECURITY.md README for a stranger (status, honest notices), SECURITY.md, first-run errors shown in a message box, short acceptance guide for the live Karta, no update nag without a manifest 2026-11-13 13:05:06 -04:00

Postduif

Postduif ("carrier pigeon") is a small program that runs on a shop's computer (Windows or Linux, x86_64). It links the shop's own WhatsApp number and relays messages to Karta, the open-source mail-and-messaging platform, over one outgoing WebSocket. Karta decides what to send and when; Postduif performs it and reports what happened. It has no stand-alone mode: without a Karta it does nothing.

Unofficial. WhatsApp has no public API for this. The WhatsApp channel (milestone 2) uses the unofficial open-source library whatsapp-rust. Meta's terms say that such clients can lead to a number being suspended. Postduif is meant for a shop's own conversations and order updates to customers who have a chat; it has no bulk or cold-message features, and Karta enforces rate limits. Use it at your own risk, only with numbers you own.

Status

Early software, version 0.1.0, not released for shops. One pre-release, v0.1.0-dev.1 (13 November 2026), is on the releases page with a Windows and a Linux binary and their checksums. It exists for the first real-device test only. It was built on a workstation, not by CI.

  • Built and tested: the protocol client, durable journal, local page, the Windows and Linux builds, and the WhatsApp channel. CI (Woodpecker) runs format, clippy with warnings as errors, about 135 tests (including process tests that kill the program with SIGKILL), and both builds on every push. Tests use a stub Karta and a fake channel; the WhatsApp channel is tested against the library's types without WhatsApp's servers.
  • Not proven: no real WhatsApp account has ever been linked, so linking, receiving, sending, receipts and offline replay are untested against WhatsApp. It has never been run on a real Windows PC (only cross-built and smoke-tested under Wine; the tray icon was never seen). The Windows executable is unsigned (SmartScreen will warn). Self-update checks release manifests against a development key that will be replaced before any release.
  • One reported run, not a proof: on the evening of 13 November 2026 the pre-release was reported, by word, to have run on a real Windows PC, enrolled with a Karta, linked a WhatsApp account by QR code, and delivered messages that appeared in Karta's console. No logs were received, the person who ran it was not sure every message arrived, and sending, receipts, offline replay, the tray icon and the update swap were not reported on. The points above stay "not proven" until the acceptance checklist is followed and its result and logs are recorded.
  • Wine smoke step in CI: fails (non-blocking): Wine in the Debian build image does not run the exe yet (cause not found); the same script passes under Wine 9 on a developer machine.
  • Needs a Karta server with its messaging module switched on; it does nothing without one. The wire protocol (docs/postduif-protocol.md) is a draft that the two sides still change together.

Documents

Document What it is
docs/acceptance-windows.md the short checklist for the first real-device test on Windows
docs/acceptance-windows-full.md the longer checklist (sending, receipts, restart, offline, update)
docs/postduif-protocol.md the wire protocol with Karta, a draft
docs/whatsapp-library.md notes on the WhatsApp library and what was seen from it
CHANGELOG.md history
SECURITY.md how to report a security problem

Karta's side (making a connector, the console, routing, limits) is in Karta's guides under "Messaging".

What it does

  • Enrols once with a one-time code from Karta's console and its own Ed25519 key pair (the private key never leaves the machine, stored with Windows DPAPI or mode 0600), then connects out to Karta and proves possession of the key on every connection.
  • Keeps a durable journal (SQLite, WAL, fsync on commit): events that Karta has not confirmed yet, and commands that have not been performed. A crash, kill -9, a week offline or a restart of Karta loses nothing and doubles nothing: events carry gap-free sequence numbers and are deleted only when Karta acknowledges them; commands are executed once, by command_id.
  • Serves a local page on 127.0.0.1 (no GUI toolkit) for the Karta address and code, the QR code and link state, unlink, recent events, version and updates, in Dutch, English, Papiamentu and Spanish. Other programs and web pages cannot drive it (Host check, per-run key and cookie, CSRF token, Origin check, no CORS).
  • Runs quietly: tray icon on Windows (green/amber/red; Open, Quit), a systemd user service on Linux. Starts by itself for the user.
  • Updates itself from a signed release manifest (Ed25519, key built in).
  • Logs ids, counts and error classes, never message text; numbers only as their last three digits. Rotating files (5 x 2 MB).

The wire protocol is in docs/postduif-protocol.md (contract with Karta; fixtures in it are tested here).

Build

Needs Rust 1.95 or newer (rustup). From the repository root:

# tests (fmt, clippy, unit and process tests; about a minute once built)
make check test

# Linux x86_64
make linux            # target/release/postduif

# Windows x86_64 (cross-compiled from Linux, GNU target)
rustup target add x86_64-pc-windows-gnu
sudo apt install gcc-mingw-w64-x86-64     # provides x86_64-w64-mingw32-gcc
make windows          # target/x86_64-pc-windows-gnu/release/postduif.exe

# smoke test of the Windows build under Wine against the stub Karta
make smoke
# (live, needs network, links nothing) real WhatsApp channel in the Windows build under Wine shows a QR:
tools/smoke-wine-live.sh

Use CARGO_TARGET_DIR=/somewhere/with/space if the checkout is on a small disk. The Windows build is the GNU target with mingw-w64 (ring and the bundled SQLite compile with gcc; no OpenSSL or system library is involved).

Run and enrol

On Linux:

postduif enrol --karta https://karta.example.com --token pdt_... --name "Shop Kralendijk"
postduif run                 # opens the page in the browser the first time
postduif install             # systemd user service; once: loginctl enable-linger $USER
postduif open                # ask the running program to open its page
postduif status
postduif uninstall           # remove the automatic start

--data-dir DIR works with every command and puts Postduif's files somewhere other than the user's data directory.

On Windows: double-click postduif.exe. It copies itself to %LOCALAPPDATA%\Postduif\bin\, registers per-user auto-start (HKCU\...\Run), starts and opens the page once. Enter Karta's address and the one-time code there, compare the key fingerprint with the one in Karta's console, then start linking from Karta's console (or press "Link WhatsApp" on the page) and scan the QR code with the phone (WhatsApp, Linked devices). To remove the automatic start, run postduif.exe uninstall in a Command Prompt in that folder.

Files live in %LOCALAPPDATA%\Postduif\ (Windows) or ~/.local/share/postduif/ (Linux): identity, config.json, journal.db, spool/, wa/, logs/.

Tests

  • crates/pd-protocol/tests: every JSON fixture in the protocol file parses and re-serialises equal.
  • crates/pd-agent/tests/flow.rs: the agent against stub-karta with the fake channel (enrol, events with cursors, reconnects, commands in order, expiry, idempotency, media, journal loss, updates).
  • crates/pd-local/tests: the page's protections and API.
  • crates/postduif/tests/binary.rs: the real program as a process, including kill -9, and "no message text in the logs".
  • tools/smoke-wine.sh: the Windows build under Wine.

tools/stub-karta is a stand-in for Karta that speaks its side of the protocol; run it by hand with stub-karta --listen 127.0.0.1:4010 --tokens 1.

Licence

MIT, copyright Shiloh B.V. See LICENSE.