events
If your system uses web-hooks, you can implement them in your module with events. Events can be simpler or more complex than actions, depending on what you want to do with them.
Declare an event
If you just want to pass the payload of your web-hook to the Marjory event, you need to declare the event in the marjory.yml
by specifying how to find the event type and some informations on the event.
Let's say your web-hooks works with this type of payload:
Here is how to declare the event in the marjory.yml
:
Event type in nested object
If your event name is in a nested object, you can divide it using .
separator. Example, if your object looks like this...
... you can write the path like this:
Event with a handler function
If you want to modify the content of an event, you can create a function that will receive the payload and you can work with it before returning a ModuleResponse
.
To do so, you can create a function similar to actions but in the events
folder. Your function name must match the name of your event in the marjory.yml
.
Last updated