pingwa
Recipe · Remote control

Open the gate from WhatsApp.

Put a button in WhatsApp that does one real thing: opens the office gate, lifts the parking barrier, unlocks a short-let flat, restarts a service. You tap it, or someone you invite taps it from their own phone. No app to install, no bot to set up, no account or password for your guest. Your system gets one signed request per tap, and the answer comes back in the chat.

Office gate

Staff and couriers open it from the chat they already have, only on weekdays and only during office hours.

Parking barrier

A visitor gets the button for the day of the visit; it stops working on its own after that.

Short-let lock

The guest gets the door for the length of the stay. You remove them at check-out, or let the end date do it.

Restart a service

The on-call person restarts the stuck worker from the phone, with a “Run it?” question first.

§ 1

How it works

  1. You create a button once, with the address of the thing it controls: your gate controller, your lock's bridge, a small script on the server.
  2. You write menu to the pingwa number and tap the button. pingwa sends your system one signed request; its answer comes back to you in the chat. A button can ask “Run it?” first, so a stray tap does nothing.
  3. To let someone else in, you invite them as a guest with only the buttons you choose, for the dates and hours you choose. They join with one message from their own WhatsApp and can be removed at any moment.
pingwa · WhatsApp
Actions you can run: tap one.
Office gateParking barrier
what a guest sees after writing menu

Why WhatsApp: the people you let in already have it, and a guest needs nothing but their phone number. pingwa sends through WhatsApp's official business service on its own number, so nobody links a personal account to anything.

§ 2

Create the button

The rest of the page is for whoever wires it up. Send join on WhatsApp (the button below) and a key comes straight back. An action is the button: a label, the HTTPS address it calls (target_url) and confirm to ask Yes / Cancel first.

The button
curl -X POST https://pingwa.dev/v1/actions \
  -H "Authorization: Bearer pw_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label": "Office gate", "target_url": "https://gate.example.com/pingwa", "confirm": true}'

The answer holds the action's id and its secret (whsec_…), the secret once: store it, it signs every request of this button. Write menu to the pingwa number and the button is there.

Only at the gate? Add "near": {"lat": 52.2297, "lon": 21.0122, "radius_m": 100} (at least 50 m). A tap then asks for the person's current location: inside the radius the button runs and the POST also carries location (the point and its distance_m); outside nothing runs and they are told how far off they are. WhatsApp cannot tell a live position from a pin dropped anywhere on the map, so this is friction and a record, not proof that someone stood there.

§ 3

Receive the tap

Each tap is one POST to the target_url. It names the button and the person who tapped (a name and a role, never a phone number):

POST https://gate.example.com/pingwa
{
  "event": "action_triggered",
  "run_id": "9f2c1d7e",
  "action_id": "b41a0c33",
  "label": "Office gate",
  "actor": {"name": "Anna", "role": "guest"},
  "triggered_at": "2026-11-14T08:02:11+00:00"
}

The handler checks the X-Pingwa-Signature header (the HMAC-SHA256 of the exact raw body with the action's secret), refuses a request older than 5 minutes or one it has handled already (a captured request stays validly signed), does the thing, and answers {"reply": "..."}: that text goes back to whoever tapped. Any other answer than a 2xx tells them it could not run.

gate.py: FastAPI, the whole receiving side
import hashlib, hmac, os
from datetime import UTC, datetime, timedelta
from fastapi import FastAPI, HTTPException, Request

SECRET = os.environ["PINGWA_ACTION_SECRET"].encode()   # the whsec_... from § 2
seen = set()   # run ids already handled: keep them in your database
app = FastAPI()

def open_gate():
    ...   # your relay, controller or lock call goes here

@app.post("/pingwa")
async def tap(request: Request):
    raw = await request.body()   # the exact bytes: do not re-encode
    want = "sha256=" + hmac.new(SECRET, raw, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(want, request.headers.get("X-Pingwa-Signature", "")):
        raise HTTPException(401)
    event = await request.json()
    age = datetime.now(UTC) - datetime.fromisoformat(event["triggered_at"])
    if age > timedelta(minutes=5) or event["run_id"] in seen:
        raise HTTPException(409)
    seen.add(event["run_id"])
    open_gate()
    return {"reply": f"Gate opening for {event['actor']['name']}"}

Answer within a few seconds: start a slow job and reply at once. Restarting a service is the same handler with subprocess.run(["systemctl", "restart", "worker"]) in place of open_gate().

§ 4

Let someone else tap it

A guest gets the buttons you list and nothing else: no alerts, none of your messages, no key. hours keeps the access to set days and times (here weekdays, 07:00 to 19:00); expires_at ends it, and left out the access ends 7 days from now. Use the key of your main number.

Invite a guest
curl -X POST https://pingwa.dev/v1/guests \
  -H "Authorization: Bearer pw_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Anna", "actions": ["ACTION_ID"], "hours": {"days": [1, 2, 3, 4, 5], "from": "07:00", "to": "19:00", "timezone": "Europe/Warsaw"}}'

The answer holds a link, shown once. Send it to your guest: it opens WhatsApp with join guest-… ready to send, and that message is their consent. From then on menu shows them the button. Each tap reaches your handler with "role": "guest" and their name. To end it early: DELETE /v1/guests/<id>, and their very next tap is refused.

§ 5

No public address?

A box behind a home router or a factory firewall can't take a POST. Create the action without target_url and run pingwa listen on that machine: it asks pingwa for taps (a long poll out) and runs a command per button. Worked examples: freqtrade and 3D printers; the details are in llms.txt.

§ 6

FAQ

Does my guest need an app or an account?

No. They need WhatsApp and the link you send them. Their first message (join guest-…) is the consent; after that they write menu and tap. They never see your messages, and stop ends their access from their side.

Why not a Telegram bot?

A Telegram bot works if everyone you let in uses Telegram and you are happy to run the bot. This is for the people who already live in WhatsApp, with no bot of your own to host: one button, one signed request, nothing to maintain on the chat side.

What does my system have to do?

Answer one HTTPS POST per tap (§ 3), or run pingwa listen if it has no public address (§ 5). pingwa decides who may tap; your handler decides what the tap does.

QR code to join pingwa on WhatsApp

Scan the code and get instant access. It opens WhatsApp with “join” ready to send, and your API key comes straight back.

The handler above was run against a local pingwa server: a guest's tap, signed and checked, answered in the chat. Your relay, lock or controller call is yours to add and to test.