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.createetc... | 
| X-VirtFusion-Event-Status | The event status. success,failetc... | 
| 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 | successfailany | - | 
Server
| ID | Event | Status Triggers | Data Body Includes | 
|---|---|---|---|
| 1 | server.create | successfailany | server object/falseargs objectallocation object/false | 
| 2 | server.destroy | successfailany | server object/false | 
| 3 | server.build | successfailany | server object/false | 
| 4 | server.assign.ipv6 | successfailany | server objectipv6.block object/falseipv6.subnet object/falseipv6.ip object/falseipv6.routeBlock object/falseipv6.routeSubnet object/false | 
| 5 | server.unassign.ipv6 | successfailany | server objectipv6.block object/falseipv6.subnet object/falseipv6.ip object/falseipv6.routeBlock object/falseipv6.routeSubnet object/false | 
| 6 | server.poweroff | successfailany | server object/false | 
| 7 | server.boot | successfailany | server object/false | 
| 8 | server.restart | successfailany | server object/false | 
| 9 | server.shutdown | successfailany | server object/false | 
| 10 | server.suspend | successfailany | server object/false | 
| 11 | server.unsuspend | successfailany | server object/false | 
| 12 | server.insert.cd | successfailany | server object/false | 
| 13 | server.eject.cd | successfailany | server object/false | 
| 14 | server.change.boot.order | successfailany | server object/false | 
| 15 | server.enable.vnc | successfailany | server object/false | 
| 16 | server.disable.vnc | successfailany | server object/false | 
| 17 | server.reset.password | successfailany | server object/false | 
| 18 | sserver.disk.trim | successfailany | server object/false | 
| 19 | server.assign.ipv4 | successfailany | server object/falseipv4.block object/falseipv4.ip object/false | 
| 20 | server.unassign.ipv4 | successfailany | server object/falseipv4.block object/falseipv4.ip object/false | 
| 21 | server.migrate | successfailany | server object/falsehypervisor.source objecthypervisor.destination object | 
| 22 | server.migrate.complete | successfailany | server object/falsehypervisor.source objecthypervisor.destination object | 
| 23 | server.migrate.revert | successfailany | server object/falsehypervisor.source objecthypervisor.destination object | 
| 31 | server.migrate.live | successfailany | server object/falsehypervisor.source objecthypervisor.destination object | 
| 32 | server.migrate.live.cancel | successfailany | server object/falsehypervisor.source objecthypervisor.destination object | 
| 33 | server.migrate.live.abort | successfailany | server object/falsehypervisor.source objecthypervisor.destination object | 
User
| ID | Event | Status Triggers | Data Body Includes | 
|---|---|---|---|
| 25 | user.create | successany | user object/false | 
| 26 | user.modify | successany | user.before object/falseuser.after object/false | 
| 27 | user.delete | successany | user object/false | 
System
| ID | Event | Status Triggers | Data Body Includes | 
|---|---|---|---|
| 28 | system.backup.local | successfailany | log object/false | 
| 29 | system.backup.scp | successfailany | log object/false | 
| 30 | system.monitor.hypervisor | successfailany | type stringhypervisor object/false | 
| 34 | system.mailout | successfailany | mailout object/false | 
| 35 | system.mailout.recipient | successfailany | mailout object/falserecipient object/false | 
Integrations
A simple PHP application can be found here that
supports Slack, Discord, Google Chat, Pushover and Telegram notifications.