Webhooks

What is a Webhook?

In Inspectorio Sight, you can create webhooks to receive real-time HTTP notifications of changes to specific events that happened in your Inspectorio Sight. This allows you to collect data from Inspectorio Sight to build reports, dashboards and more.

You can toggle on any specific event, then Inspectorio sends you a post to *a given URL that you set for the webhook paired with that event. Inspectorio puts the data related to that event into a **JSON format and send it to your webhook’s URL.

Here is an example of response data:

{
 "messageId": "wh-638ce960-1231-11e9-a15d-d1c47c8f7593",
 "eventCode": "report.created",
 "eventName": "An Inspection report is uploaded",
 "payload": {
   "resourceId": 12301,
   "path": "/reports/12301"
 }
}

How to access the webhooks

Login to your Inspectorio Sight platform as Admin or Account Owner. Access the Configuration tab in the header of your platform, then select Webhooks in the menu. Once you are in this area at first time, click on Create your Webhooks.

How to create a new webhook

Once you navigated to Create Webhook page, you need to input the fields as below

  • Webhook Name (mandatory): the meaning name for your webhook to help you know the purpose/destination of this webhook (For example: Slack Webhook).
  • Webhook URL (mandatory): the URL of your webhook client that you want to receive the Inspectorio Sight’s event.
  • Events (mandatory): Inspectorio Sight will show the list of supporting events in this page and you must select at least 1 event for your webhook. In case you want to add all events of 1 component, you can turn on the radio button on component name (For example: INSPECTION).
  • Basic Authentication (optional): If your webhook URL has the username/password authentication, you can turn on this section and input the valid username and password here. If not, please make sure you turn off this section.
  • After you finished, click on Add webhook button to create new webhook. This webhook will be activated automatically. Create-Webhook

How to edit an existing webhook

All of your webhooks will appear in the list on the Webhooks Management page. Once created, you can edit any of the information that you configured at any time. You have 2 ways to access the Edit Webhook page:

  1. Click on 3-dots icon under Action column and select Edit
  2. Click on the Webhook name under Name column Edit-Webhook

The fields in Edit Webhook page are same as Create Webhook page and you can edit any data as you want. Click on Save changes button after finished.

How to Deactivate, Activate and Delete Webhooks

Inspectorio Sight allows you to deactivate, activate or delete any existing webhook in your Webhooks Management page.

  1. Deactivate a webhook: if your webhook has Status is Active (with green check mark) and you want to deactivate this webhook, you can hover mouse on Status on column of this webhook and click on Deactivate this webhook. After deactivated the webhook, you will not receive any event’s information for this webhook anymore. But this webhook is still displaying on your Webhook Management for using in future. Edit-Webhook
  2. Activate a webhook: if your webhook has Status is Inactive (with grey state) and you want to activate this webhook, you can hover mouse on Status on column of this webhook and click on Activate this webhook. After activated the webhook, you can receive the event’s information of this webhook. Activate-Webhook
  3. Delete a webhook: if you want to delete a webhook permanent, you can click on 3-dots icon under Action column and select Remove. You will see a confirmation popup to re-confirm for this action. Click on Remove webhook button in this popup to delete the selected webhook. After deleted the webhook, you will not see this webhook on Webhooks Management page anymore and also will not receive any event’s information for this webhook. Note that removing the webhook will not delete any old data. Remove-Webhook

Events available

We started Webhooks implementation on Inspectorio Sight with 2 specific events: Report - An Inspection report is uploaded and Report - An Inspection report file is ready to view

Example:

Payload for ‘An Inspection report is uploaded’

{
 "messageId": "wh-638ce960-1231-11e9-a15d-d1c47c8f7593",
 "eventCode": "report.created",
 "eventName": "An Inspection report is uploaded",
 "payload": {
   "resourceId": 12301,
   "path": "/reports/12301"
 }
}

For more information about this report, you should refer directly to the payload. You can identify the path of the updated resources via the webhook, then call back the proper Sight API for detail information (GET report). • resourceId – Inspectorio ID of the report • path – Path to call back this resource

Responding to Webhooks

To acknowledge the successful receipt of a webhook, Inspectorio expects a 200 HTTP status code in response. If the response time is more than 60s or the response status code is not 200, Inspectorio will mark the sending as a failure and auto retry to send the request 3 times (each time separated by 60s).