Webhooks
VirtFusion webhooks can be used to automatically send data in real-time when certain events occur.
Webhooks require a HTTP endpoint that accepts POST requests.
Webhooks are commonly used for a variety of purposes, such as:
- Automated notifications and alerts
- Real-time data synchronization
- Triggering automated actions or workflows
- Integrating with third-party services and APIs
Authentication
Webhooks optionally support authentication using a Authorization: Bearer <token> header. The token will always be sent
base64 encoded.
Requests
Headers
All webhook requests will include the following headers:
| Header | Description |
|---|---|
X-VirtFusion-Hook | The ID of the webhook. |
X-VirtFusion-Created | ISO8601 zulu date string. 2023-04-07T07:18:15.316192Z |
X-VirtFusion-Hook-Event | The ID of the webhook event. |
X-VirtFusion-Event | The event name. server.create etc... |
X-VirtFusion-Event-Status | The event status. success, fail etc... |
User-Agent | VirtFusion-Hookshot/57HE28D3RT |
Content-Type | application/json |
Accept | application/json |
If authentication is enabled on the webhook, the following extra headers are included:
| Header | Description |
|---|---|
Authorization | Bearer <token> The Token will be automatically base64 encoded on each request. |
Body
All requests will contain at least the following in the JSON body:
{
"event": "<event.name>",
"created": "<date string>",
"hookId": "<id>",
"hookEventId": "<id>",
"eventStatus": "<status>",
"controlDomain": "<control domain>",
"controlName": "<control name>",
"controlSupportLink": "<control support link>",
"data": {
"errors": [],
...
}
}
The data property will always contain data specific to the type of event triggered.
Events
Catch All
| ID | Event | Status Triggers | Data Body Includes |
|---|---|---|---|
| 1000 | catch.all | success fail any | - |
Server
| ID | Event | Status Triggers | Data Body Includes |
|---|---|---|---|
| 1 | server.create | success fail any | server object/false args object allocation object/false |
| 2 | server.destroy | success fail any | server object/false |
| 3 | server.build | success fail any | server object/false |
| 4 | server.assign.ipv6 | success fail any | server object ipv6.block object/false ipv6.subnet object/false ipv6.ip object/false ipv6.routeBlock object/false ipv6.routeSubnet object/false |
| 5 | server.unassign.ipv6 | success fail any | server object ipv6.block object/false ipv6.subnet object/false ipv6.ip object/false ipv6.routeBlock object/false ipv6.routeSubnet object/false |
| 6 | server.poweroff | success fail any | server object/false |
| 7 | server.boot | success fail any | server object/false |
| 8 | server.restart | success fail any | server object/false |
| 9 | server.shutdown | success fail any | server object/false |
| 10 | server.suspend | success fail any | server object/false |
| 11 | server.unsuspend | success fail any | server object/false |
| 12 | server.insert.cd | success fail any | server object/false |
| 13 | server.eject.cd | success fail any | server object/false |
| 14 | server.change.boot.order | success fail any | server object/false |
| 15 | server.enable.vnc | success fail any | server object/false |
| 16 | server.disable.vnc | success fail any | server object/false |
| 17 | server.reset.password | success fail any | server object/false |
| 18 | sserver.disk.trim | success fail any | server object/false |
| 19 | server.assign.ipv4 | success fail any | server object/false ipv4.block object/false ipv4.ip object/false |
| 20 | server.unassign.ipv4 | success fail any | server object/false ipv4.block object/false ipv4.ip object/false |
| 21 | server.migrate | success fail any | server object/false hypervisor.source object hypervisor.destination object |
| 22 | server.migrate.complete | success fail any | server object/false hypervisor.source object hypervisor.destination object |
| 23 | server.migrate.revert | success fail any | server object/false hypervisor.source object hypervisor.destination object |
| 31 | server.migrate.live | success fail any | server object/false hypervisor.source object hypervisor.destination object |
| 32 | server.migrate.live.cancel | success fail any | server object/false hypervisor.source object hypervisor.destination object |
| 33 | server.migrate.live.abort | success fail any | server object/false hypervisor.source object hypervisor.destination object |
User
| ID | Event | Status Triggers | Data Body Includes |
|---|---|---|---|
| 25 | user.create | success any | user object/false |
| 26 | user.modify | success any | user.before object/false user.after object/false |
| 27 | user.delete | success any | user object/false |
System
| ID | Event | Status Triggers | Data Body Includes |
|---|---|---|---|
| 28 | system.backup.local | success fail any | log object/false |
| 29 | system.backup.scp | success fail any | log object/false |
| 30 | system.monitor.hypervisor | success fail any | type string hypervisor object/false |
| 34 | system.mailout | success fail any | mailout object/false |
| 35 | system.mailout.recipient | success fail any | mailout object/false recipient object/false |
Integrations
A simple PHP application can be found here that
supports Slack, Discord, Google Chat, Pushover and Telegram notifications.