A simple little addon for making webhooks.
Download or clone this repo and move the Hooker
folder into the ~/site/addons
directory of your project.
Run the update command from the root of your project to install the addon depenencies:
php please update:addons
Done!
In your project's CP navigate to Addons > Hooker
.
Click the Hook +
button to make a new webhook.
In the replicater entry you just made, enter the endpoint that should be triggered.
Under the endpoint input you see all the Statamic events that can be lissened to. Every event you select here will trigger your hook.
If for example you want to hide personal information these keys can be hidden from the request to your endpoint.
To do this, simply add the field's key to the Hidden keys
list.
Lets say you want to send a newsletter each time a new product has been added to your shop or send a welcoming email each time a new user has been added.
In that case you make a hook with the Mailchimp trigger endpoint as URL and select eighter Saved > entry
or Saved > User
.
Each time you save an Entry or a User one of the hooks will be triggered and it will make a request to the given URL.
In order to know what happened on the receiving side, Statamic Hooker will send all the information about the event with it's request