The webhook interface in salt-api is a wrapper around firing a Salt
event -- it is a fire-and-forget interface and does not wait for the
Reactor to receive the event or react to it or for the command to go
out then return with the results/errors. It is best used to initiate
actions that have already been tested.
There's a lot of layers between those two operations and it's useful
to know those layers. A simple way to get started is:
1. Write an .sls file and test it from the CLI calling `salt <tgt>
state.sls <mod>` as normal.
2. Once that is working run the same job using the `--async` flag then
look up the result of the job using `salt-run jobs.lookup_jid <jid>`
(because this is what the Reactor will do).
3. Once that is working call `state.sls` in the same way but from a
Reactor file (same action, but in YAML syntax instead of CLI syntax),
usually using `event.send` to trigger the event (which is what the
webhook does) and with debug logging on the master to see the result
from the reactor. [1] Make sure you can look up the result of the job
using `salt-run jobs.list_jobs` / `salt-run jobs.lookup_jid <jid>` as
before.
4. Once that is working change the reactor to listen for the webhook event tag.
And, of course, if you have any other questions as you go be sure to
ask on this list. :-)
[1]
https://docs.saltstack.com/en/latest/topics/reactor/index.html#debugging-the-reactor