Service hooks are notifications that you can subscribe to which allow you to receive API updates when events happen in Xplenty such as cluster created, or job failed. Service hooks allow you to avoid polling the API to receive up-to-date statuses and have the notifications delivered to other services that are not calling Xplenty's APIs (such as monitoring services).
To use service hooks, you can create a webhook via Xplenty's UI. Each webhook has a URL and a set of events you want to be notified about. After defining the webhook, Xplenty will POST to the URL notifications, every time the events are taking place.
The notification's web request body is the same as the response body for an API request for the same resource. Read more here.
Creating Service HooksService hooks are defined at the account level by account administrators. To create a service hook:
- Click your avatar, then click Account settings
- Click Service Hooks from the left pane menu.
- Click + new hook.
- In the list, choose Webhook.
- Enter webhook URL (HTTP or HTTPS).
Select the events you want to be notified about using this webhook:
All Job Notifications: All events below.
- Job Submitted: Job was submitted by user or schedule for execution.
- Job Started: Job execution started.
- Job Stopped: Job stopped by user.
- Job Completed: Job completed successfully.
- Job Failed: Job completed with failure.
- All Cluster Notifications: All events below.
- Cluster Requested: Cluster creation requested by user or schedule.
- Cluster Available: Cluster is available and jobs can be run on it.
- Cluster Terminated: Cluster is terminated.
- Cluster Idled: No activity on the cluster for a specified interval.
- Cluster Error: Cluster error occurred and jobs can't be executed on it.
- By default, the webhook is created active but you can disable it if you wish.
- Click create webhook
- You can trigger a ping event to test the webhook.