Pause or cancel a print from WhatsApp
Three buttons on your phone: Pause, Cancel and Snapshot. A tap reaches a small listener on your home network, which calls your printer's own API (Moonraker for Klipper, or OctoPrint) and sends the answer back to the chat. The printer needs no public address, no port forwarding and no tunnel. Text join to get a key first.
What you get
Write menu to the pingwa number and the three
actions come back as buttons. Cancel asks “Run Cancel?” first,
because a cancelled print cannot be resumed. After the tap, the line the command
printed is the answer:
Setup with the listener (no public address)
A printer sits behind a home router. So a small program on a machine in the same network asks pingwa for taps (a long poll out), instead of pingwa calling in. It can run on the Raspberry Pi that hosts OctoPrint or Klipper, or on any always-on machine that reaches the printer. Five steps:
- Text join to pingwa on WhatsApp (the button below): your key comes straight back. It is a full-access key: use it for steps 2 and 3 and keep it off the printer's machine.
- Make a key that can do nothing but run actions, for the listener. Its scope is
actions:listen; the answer holds the key once:
curl -X POST https://pingwa.dev/v1/keys \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "printer-listen", "scopes": ["actions:listen"]}'
- Create the three actions. They have no
target_url, so a tap is delivered to the listener, not to an address.confirmmakes pingwa ask Yes / Cancel first, andreply_okis the text a tap answers with when the command went well (a command that fails answers “Could not run <button>” instead). Put your webcam's snapshot link in Snapshot's:
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Pause", "reply_ok": "Paused"}'
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Cancel", "confirm": true, "reply_ok": "Print cancelled"}'
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Snapshot", "reply_ok": "http://printer.local/webcam/?action=snapshot"}'
- Write the listener's config for your printer software: Moonraker or OctoPrint, below. The listener runs each command without a shell and kills it after
timeoutseconds; a command that exits with an error answers “Could not run <button>” with the first line it printed.
Moonraker (Klipper, Mainsail, Fluidd). Moonraker's
POST /printer/print/pause and /printer/print/cancel take no
body, and by default it accepts requests from your local network, so plain
curl is enough. Replace printer.local with your printer's host;
the snapshot path is the one your webcam entry in Mainsail or Fluidd shows. The commands print nothing when they work (Snapshot only checks that the webcam answers), so the text you get back is the action's reply_ok.
[listen] timeout = 10 # seconds a command may run; must stay below 15 [actions] "Pause" = "curl -fsS -o /dev/null -X POST http://printer.local/printer/print/pause" "Cancel" = "curl -fsS -o /dev/null -X POST http://printer.local/printer/print/cancel" "Snapshot" = "curl -fsS -m 5 -o /dev/null http://printer.local/webcam/?action=snapshot"
If Moonraker refuses (nothing is printing), curl exits with 22 and the answer reads “Could not run Pause: exit 22”. If you turned on Moonraker's authorization, add its key as a header to the commands.
OctoPrint. The calls are POST /api/job with
a command, authenticated with an API key in the X-Api-Key header.
Create the key in OctoPrint (your user settings → API key), and keep it out of the config:
the script below reads it from the environment. Save it as octoprint.sh,
executable. Needs curl (7.76 or newer) and jq.
#!/usr/bin/env bash
# Called by `pingwa listen`: octoprint.sh pause | cancel | snapshot
# OCTOPRINT_KEY (an OctoPrint API key) comes from the environment.
set -euo pipefail
host="${OCTOPRINT_URL:-http://octopi.local}"
job() {
curl --fail-with-body -sS -m 8 -X POST "$host/api/job" \
-H "X-Api-Key: $OCTOPRINT_KEY" -H 'Content-Type: application/json' -d "$1" |
jq -r '.error // empty'
}
case "${1:-}" in
pause) job '{"command": "pause", "action": "pause"}' ;;
cancel) job '{"command": "cancel"}' ;;
snapshot) curl -fsS -m 5 -o /dev/null "$host/webcam/?action=snapshot" ;;
*) echo "usage: octoprint.sh pause|cancel|snapshot" >&2; exit 2 ;;
esac
[listen] timeout = 10 # seconds a command may run; must stay below 15 [actions] "Pause" = "/home/pi/pingwa/octoprint.sh pause" "Cancel" = "/home/pi/pingwa/octoprint.sh cancel" "Snapshot" = "/home/pi/pingwa/octoprint.sh snapshot"
When OctoPrint refuses, its own message is the answer, for example “Printer is neither printing nor paused, 'cancel' command cannot be performed”.
- Start the listener with the listener key in the environment (and, for OctoPrint, the printer's key and address). Write
menuon WhatsApp and tap Pause.
export PINGWA_KEY=pw_THE_LISTENER_KEY export OCTOPRINT_KEY=your-octoprint-api-key OCTOPRINT_URL=http://octopi.local # OctoPrint only uvx pingwa listen --config listen.toml
The listener never hands PINGWA_KEY to a command, and it
reconnects on its own after a network drop: run it under systemd or any supervisor.
Setup with a webhook (you have a public address)
If you would rather have pingwa call a server of yours, create the
actions with a target_url (public HTTPS) instead of the listener. A tap is
then one signed POST to that URL. Neither Moonraker nor OctoPrint can check pingwa's
X-Pingwa-Signature, so do not point an action at the printer, and do not put
the printer's API on the internet: point it at a small handler that verifies the
signature and then makes the same calls. The check, with code, is in the Actions
section of llms.txt.
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Cancel", "confirm": true, "target_url": "https://your-host.example/printer/cancel"}'
The answer carries the action's secret, once: it signs every
POST of that action.
Good to know
- Run end to end on 2026-11-14 against OctoPrint 1.11.8 (the docker image with its virtual printer): pause, cancel, the refusals when nothing is printing, and the listener's config. The WhatsApp tap itself was not part of that run, and the image has no webcam, so the snapshot command was run against a stand-in web server.
- Moonraker: the two routes were checked against Moonraker's documentation and source, November 2026; they were not run against a live printer.
- Snapshot is a link, not a picture. The answer to a tap is text, so Snapshot checks that the webcam answers and then sends the snapshot link you put in its
reply_ok. The link opens on your home Wi-Fi or over a VPN, not from outside. - Who can tap. Only the owner of the number. pingwa messages only people who joined: it does not message anyone else.
- Limits and price. Each tap counts as one message against your plan's message quota, and the number of actions is part of the plan. Plans and prices are in the pricing section.
- Keys. The listener key can only run actions: it cannot send, read your messages or change the actions. If it leaks, revoke it in the panel and make a new one. The printer's key stays on your network.
FAQ
Can I resume a paused print?
Yes. Add a fourth action (labels are up to 20 characters) and a line to listen.toml: Moonraker has POST /printer/print/resume, OctoPrint takes {"command": "pause", "action": "resume"}.
Pause says exit 22, or the answer is a refusal.
The printer's API said no, most often because nothing is printing. Check the print state in Mainsail, Fluidd or OctoPrint.
The listener says pingwa refused the key.
It needs a key with the actions:listen scope (or a full-access key) in PINGWA_KEY. It stops with that message instead of retrying.
What if the machine is off or the listener is down?
A tap waits 60 seconds for a listener. After that nothing runs and you get a message that nobody was listening, so a stale tap never fires when the machine comes back.
Scan the code and get instant access. It opens WhatsApp with “join” ready to send, and your API key comes straight back.
pingwa carries the message over the official Meta Cloud API. Your own number stays out of it (why that matters).