-
Notifications
You must be signed in to change notification settings - Fork 1
10. webhooks
Push approach: HTTP POST to push data to StackStorm API from a script or software when an event you are interested in occurs.
The ST2 rule engine monitor triggers on the message bus (RabbitMQ).
In ST2, a trigger refers to the internal representation in ST2 of an external event.
With ST2 you can create your own sensors which allow you to define the trigger structure.
We are going to use custom webhook which has already a built-in trigger, so there is no need to define this trigger yourself in that case.
You need to use an ST2 rule in a yaml file.
You can write a new rule yourself or use an existing one (from an installed pack.sudo st2 rule list -p napalm).
What's the diff between a regular rest call (toward ansible tower as example) and a custom webhook in ST2:
ST2 webhook is a characterization of an (no ST2) event: you are just transmitting to ST2 some sort of information. Then ST2 rule engine will decide what to do with these details. Because there is a rule engine between events and potential actions, one event can fire off many actions.
Using a regular rest call to a system (ansible tower ...) is a more imperative approach where you are requesting an very tool-related thing. Also there is one to one_only relationship between the rest call and the its outcome.