Webhooks

To provide more visibility and information about the events happening after the user is redirected to WMS, we offer an optional Webhook facility.

In order to opt-in to receive the events via a webhook, you need to provide a URL for the webhook which will be added to the Config ID along with an assigned MAC secret for validation.

If a Config ID has a webhook associated with it, events will be sent to the webhook as they happen. The events will be sent in the body of a POST call to the webhook.

Events

EventSeverityPayloadDescription
WMS_LOADEDINFO-WMS has been loaded
CONFIGURATION_LOADEDINFO-Config fetched using the provided Config ID
CAMERA_PERMISSION_GRANTEDINFO-User has granted the camera permission
CAMERA_PERMISSION_DENIEDERROR-User has denied the camera permission
CAMERA_STARTEDINFO-Camera started. This can be either by user or automatically.
MEASUREMENT_STARTEDINFO-Measurement Started. This can be either by user or automatically.
MEASUREMENT_CREATEDINFOMeasurement IDMeasurement created and got the measurement ID
INTERMEDIATE_RESULTSINFOSNR, Sequence, Measurement IDIntermediate result received
SCAN_COMPLETEDINFOMeasurement IDScan has completed and waiting for the final results
RESULTS_RECEIVEDINFOMeasurement IDFinal results have been received
REDIRECTING_TO_CALLBACKINFOMeasurement ID (if created)Starting the redirect to the callback URL
MEASUREMENT_CANCELEDWARNMeasurement IDMeasurement has been cnceled
CONSTRAINT_VIOLATIONERRORConstraint Violated, Measurement ID (If created)A constraint has been violated (resulting in measurement cancel)
PAGE_UNLOADEDINFOMeasurement ID (If created)Either the user has closed the browser (tab) or typed a new URL and navigating away from WMS
WEBSOCKET_DISCONNECTEDWARNMeasurement IDWebsocket has been disconnected
WEBSOCKET_RECONNECTEDINFOMeasurement IDWebsocket has been reconnected
WEBSOCKET_RECONNECTION_FAILEDERRORMeasurement IDWebsocket failed to reconnect
API_ERRORERRORAPI Error Code, Measurement ID (If created)API threw an error
PAGE_VISIBILITY_CHANGEINFOVisible / Hidden, Measurement ID (If created)User minimized / maximized the browser or switched to anothe tab / application

Event body

{
  "timestamp": 1689684577,
  "sessionId": "ryueiwoqfh910fu3rpqruvfiu",
  "sequence": 0,
  "event": "MEASUREMENT_CREATED",
  "severity": "INFO"
  "payload": {
    "measurementId": "f0c8ca8d-111d-4dcf-a69d-46ed39a2db06"
  },
}
FieldDescription
timestampThe time of the event
sessionIdThe session ID provided when constructing the call-in URL
sequenceThe sequence of the event, starts at 0 and incremented with each event
eventEvent code as shown on the list of events
payloadIf the event has a payload, it will be provided in the payload section. Example: Measurement ID, SNR etc.

Webhook Validation

A hash of the body contents using the hook's MAC secret (macSecret) is given in the X-WMS-Content-MAC header. The recipient can verify this value to make sure that the webhook call was initiated by WMS by doing the following computation (in JavaScript, for example):

// Note: Use the provided MAC secret here
const hmac = require('crypto').createHmac('sha256', macSecret);
hmac.update(requestBody.toString(), 'ascii');
const expectedContentHmac = 'hmac-sha256=' + hmac.digest('hex');

Note

The Webhook URL needs to be set up at your end and shared with the Nuralogix team in order to update it in your Config ID.