Webhooks

Notes

You can create webhooks from the HotspotSystem control center's Manage Webhooks page. Select the Location, the Event type, and the Callback URL to create a new one. Don't forget to write down the newly created API key.

Webhook callbacks are triggered by events listed below. When the event is fired, it makes an HTTP POST request to the Callback URL with a JSON body and a special HTTP header field to ensure that we indeed made the request. The header's name is HTTP_X_HOTSPOTSYSTEM_HMAC_SHA256 and it is signed with the previously mentioned API key.

Your script should return HTTP status code 200 in the response header which is providing information that the callback URL is working properly. Otherwise our servers will try to send you again the same request payload at the next execution.

Webhooks are not triggered right away as the events occur. Our servers process the event entries in every minute, and they also retries failed requests at least 20 times.

Sample PHP code

$api_key = '***';
$request = file_get_contents('php://input');
$headers = getallheaders();
if ($headers['HTTP_X_HOTSPOTSYSTEM_HMAC_SHA256'] == base64_encode(hash_hmac('sha256', $request, $api_key, true))) {
  http_response_code(200);
  // Do something with the request
  $json = json_decode($request, true);
} else {
  http_response_code(500);
}

More on PHP's Supported Protocols and Wrappers

Event types

Event Triggers when
customer.create a new customer has been registered
subscriber.create a new client has been subscribed to the newsletter
transaction.paid.create a new paid transaction has been recorded
transaction.voucher.create a new voucher transaction has been recorded
transaction.mac.create a new mac transaction has been recorded
transaction.social.create a new social transaction has been recorded