hostinger 2.5.0 Help

Webhooks

Define Webhook

To provide a Webhook, you first need to register it within the Runtime, which can be achieved using the internal Webhook Service.

webhookService.registerEventType(VirtualizationService.class, "create");

Define Endpoint

Once the registration is complete, you must specify an Endpoint where the Webhook Event will be sent; otherwise, no actions will occur.

webhook-endpoint.png

Trigger Webhooks

To trigger you Webhook, you can use the following method:

// Create Payload for Status Packet. JsonObject payloadIO = new JsonObject(); payloadIO.addProperty("id", virtualizedIO.getId().toString()); payloadIO.addProperty("type", "virtualized"); payloadIO.addProperty("status", "created"); // Define Data Packet. JSONStatusMessage messageIO = new JSONStatusMessage(JSONStatus.SUCCESS, payloadIO); // Fire Webhook. webhookService.execute(VirtualizationService.class, "create", messageIO);

The Webhook will be automatically triggered in Background as a Thread. If you prefere the blocking method please use webhookExecution.

Last modified: 07 March 2025