Skip to main content

Hooks

This module exposes some hooks for you to interact with at key lifecycle events of objects.

KatapultVirtualMachineBuildRequested

Fires when a VM build has been created with Katapult.

use \WHMCS\Module\Server\Katapult\WHMCS\Service\VirtualMachine;

\add_hook('KatapultVirtualMachineBuildRequested', 0, function(VirtualMachine $service) {
\sendMessage('Katapult Server Building Email', $service->id);
});

KatapultVirtualMachineBuilt

Fires when a VM has finished building and has been persisted to the WHMCS database.

use \WHMCS\Module\Server\Katapult\WHMCS\Service\VirtualMachine;

\add_hook('KatapultVirtualMachineBuilt', 0, function(VirtualMachine $service) {
\sendMessage('Katapult Server Built Email', $service->id);
});

KatapultVirtualMachineBuildTimedOut

Fires when a VM build has timed out. The module will continue to check for the build, but this hook will only be fired once. The timeout is set to 15 minutes.

use \WHMCS\Module\Server\Katapult\WHMCS\Service\VirtualMachine;

\add_hook('KatapultVirtualMachineBuildTimedOut', 0, function(VirtualMachine $service) {
// Send a notification to an admin or open a ticket
});