Webhooks
This service allows to create incoming webhooks, in order to allow users to perform some actions directly, bypassing the endpoints authorizations.
Features
- Generate webhooks for any user through Moleculer REPL
- Allow users to create their own webhooks with a secured endpoint
- Handle different kind of actions, depending on your needs
Dependencies
Install
Usage
Optionally, you can configure the API routes with moleculer-web:
Generating new webhooks
You generate a webhook by providing a user and an action. The action must be in the list of allowedActions
, in the settings.
Through the command line
Start Moleculer in REPL mode and call the generate
action like this:
Through a secured endpoint
POST
to the /webhooks
endpoint as a logged-in user, providing the action that will be handled by this endpoint as JSON.
Posting to a webhook
When you generate a webhook, you will receive an URI in response. You can then post JSON data to this webhook. It will be handled by the action(s) you defined.
Queuing incoming POSTs
If you wish, you can use the Bull task manager to queue incoming POSTs and make sure no data is lost.
All you need to do is add Moleculer's official Bull service as a mixin:
Please look at the official documentation for more information.