switchboard hook
Calls a webhook route through the engine's socket, with a method, query items, a body and headers.
Details #
switchboard hook <route> sends a request to /hooks/<route> over the engine's Unix socket, so it needs no token, key or signature. It prints the answer body and exits 0 for a 2xx status. For anything else it prints nothing on standard output, says the status and the reason on standard error and exits 1. A 202 with no run ids means no macro that is turned on took the call; the command says so on standard error (exit 0).
switchboard hook build-done -X POST -d '{"status":"passed"}'
switchboard hook shortcuts/lights -q state=on
With --wait, a route that answers 202 with run ids then waits for each run and prints how it ended.
Parameters #
switchboard hook <route> [-X GET|POST] [-d @file|text|json] [-q k=v]… [-H 'Name: value']… [--wait] call a webhook through the engine (--wait prints the run it started)
Gotchas #
Calling through the socket skips the route's auth on purpose, so use curl with the key to test what a remote sender sees.
If the engine is not running the command exits with 69 and says how to start it.