Stop, check or exit your freqtrade bot from WhatsApp
Three buttons on your phone: Stop, Status and Exit all. A tap reaches a small listener on the machine that runs freqtrade, which calls freqtrade's own REST API and sends the answer back to the chat. That machine needs no public address and no port forwarding. Text join to get a key first.
What you get
Write menu to the pingwa number and the three
actions come back as buttons. Stop and Exit all
ask “Run <button>?” first, so a stray tap does nothing. After the tap, the
line the call printed is the answer:
Setup with the listener (no public address)
freqtrade usually runs at home or on a small server you do not want to open to the internet. So the machine asks pingwa for taps (a long poll out), instead of pingwa calling in. 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 step 3 and keep it off the freqtrade 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": "freqtrade-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:
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Stop", "confirm": true}'
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Status"}'
curl -X POST https://pingwa.dev/v1/actions \
-H "Authorization: Bearer pw_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"label": "Exit all", "confirm": true}'
- Turn on freqtrade's API server (
config.json) and keep it on the machine's own address. In docker use0.0.0.0inside and publish the port as127.0.0.1:8080:8080. The JWT key needs 32 characters or more:
"api_server": {
"enabled": true,
"listen_ip_address": "127.0.0.1",
"listen_port": 8080,
"jwt_secret_key": "a-random-string-of-32-characters-or-more",
"username": "freqtrader",
"password": "a-long-password"
}
Save this as freqtrade.sh next to freqtrade and make it
executable. It is the whole bridge: three calls to freqtrade's REST API with basic
auth, and a one-line answer. The login comes from the environment, not from the file.
Needs curl (7.76 or newer) and jq.
#!/usr/bin/env bash
# Called by `pingwa listen`: freqtrade.sh stop | status | exit-all
# FT_USER and FT_PASS (freqtrade's api_server login) come from the environment.
set -euo pipefail
api="${FT_API:-http://127.0.0.1:8080/api/v1}"
call() { curl --fail-with-body -sS -m 8 -u "$FT_USER:$FT_PASS" "$@"; }
text='.status // .result // .detail // .error'
case "${1:-}" in
stop) call -X POST "$api/stop" | jq -r "$text" ;;
status) call "$api/status" | jq -r 'if type == "array" then
(if length == 0 then "No open trades"
else map("\(.pair) \(.profit_pct)%") | join(", ") end)
else .detail // .error end' ;;
exit-all) call -X POST "$api/forceexit" -H 'Content-Type: application/json' \
-d '{"tradeid": "all"}' | jq -r "$text" ;;
*) echo "usage: freqtrade.sh stop|status|exit-all" >&2; exit 2 ;;
esac
- Write the listener's config, then start it with the listener key and freqtrade's login in the environment. The listener runs each command without a shell, so a
$VARinside the config would stay literal: that is why the script reads them. It never handsPINGWA_KEYto a command.
[listen] timeout = 10 # seconds a command may run; must stay below 15 [actions] "Stop" = "/home/me/pingwa/freqtrade.sh stop" "Status" = "/home/me/pingwa/freqtrade.sh status" "Exit all" = "/home/me/pingwa/freqtrade.sh exit-all"
export PINGWA_KEY=pw_THE_LISTENER_KEY export FT_USER=freqtrader FT_PASS=a-long-password uvx pingwa listen --config listen.toml
Write menu on WhatsApp and tap Status:
a few seconds later it answers with your open pairs and their profit, or
“No open trades”. A command that exits with an error answers “Could not run
<button>” with the first line it printed, for example freqtrade's “trader is
not running”. The listener reconnects on its own after a network drop, so run it
under systemd, docker or any supervisor.
Setup with a webhook (you have a public address)
If you would rather have pingwa call your server, create the actions
with a target_url (public HTTPS) instead of the listener. A tap is then
one signed POST to that URL. freqtrade's API cannot check pingwa's
X-Pingwa-Signature, so do not point the action at freqtrade itself, and
do not put freqtrade's API on the internet: point it at a small handler of yours
that verifies the signature and then calls the same three routes. 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": "Stop", "confirm": true, "target_url": "https://your-host.example/freqtrade/stop"}'
The answer carries the action's secret, once: it signs every
POST of that action. The calls to make from the handler are the ones in
freqtrade.sh.
Good to know
- Run end to end on 2026-11-14 against freqtrade 2026.10 (the docker image, dry-run, API server on): all three calls, the script's answers and the listener's config, including a stopped bot and a wrong password. The WhatsApp tap itself was not part of that run.
- What Stop does. It is freqtrade's own
/stop: the bot stops entering and stops managing trades, and open trades stay open until you start it again (POST /api/v1/start, or the freqtrade UI). For a gentler stop that keeps managing open trades and only blocks new ones, use/api/v1/stopentryin the script. Exit all asks freqtrade to exit every open trade now, whatever its profit. - Try it on a dry-run bot first. Nothing here is financial advice.
- 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. freqtrade's password stays on your machine.
FAQ
freqtrade already has Telegram. Why this?
If Telegram works for you, keep it. This is for people who want the same three buttons in WhatsApp, with no bot token to create and no chat to set up: you text join and write menu.
Can I add Start, or Force enter?
Yes. Create another action (labels are up to 20 characters), add a line to listen.toml and a case to the script that calls /api/v1/start or another route of freqtrade's API.
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).