while this is definitely an option, I would like to disencourage from this low-level approach which did not pay off in the official foreman_hooks plugin. Users are hitting issues every time we changed our model, also not everything is an ActiveRecord event.
We are currently working hard on the new Subscription API which allows plugins to hook into Foreman events in a similar but more controlled manner. For end users, I would encourage users to consider using the new Foreman Webhooks plugin based on this API:
It makes use of our templating engine so everytime we change some internal data structure, webhooks should not break when using our own templates (or should be pretty easy to fix template clones by comparing the changes).
This all is work in progress but this is our priority now to deliver this in 2.3/2.4 timeframe. Feedback or contributions welcome!
Edit: After reading my post, I think the tone was not the best. To clarify, it’s awesome you share your work and we want to see as many plugins as possible. Thanks!