Webhooks
Product Compatibility
Quality Risk Management | Production Management | Responsible Sourcing & Compliance |
---|---|---|
✅ | ✅ | ❌ |
What is a Webhook?
In Inspectorio Quality Risk Management (QRM), you can create webhooks to receive real-time HTTP notifications of changes to specific events that happened in your Inspectorio QRM account. This allows you to collect data from Inspectorio QRM to build reports, dashboards, and more.
You can switch on any specific events. 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"
}
}
Access Webhooks page
- Log in to Inspectorio QRM platform as admin or account owner.
- On the main menu, select Configuration > Webhooks.
- On the Webhooks page, select Add webhook.
Create a new webhook
On the Create Webhook page, fill in the fields as follows:
- Webhook Name (mandatory): The 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 QRM's event.
- Events (mandatory): Inspectorio QRM 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, switch 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, make sure you turn off this section.
- After entering the information, select Add webhook button to create new webhook. This webhook will be activated automatically.
Edit an existing webhook
All of your webhooks will appear on the list on the Webhooks 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:
- Select the three-dot menu under Action column and select Edit.
- Select the webhook name under Name column.
The fields in the Edit Webhook page are the same as in the Create Webhook page, and you can edit any data as needed. Then, select the Save changes button.
Deactivate, activate, and delete webhooks
Inspectorio QRM allows you to deactivate, activate, or delete any existing webhook on your Webhooks page.
- Deactivate a webhook: If your webhook is Active (with green check mark) and you want to deactivate it, hover over the Status column of the webhook and select Deactivate this webhook. After deactivating the webhook, you will not receive any event’s information for this webhook. This webhook will still be listed on your Webhooks page.
- Activate a webhook: If your webhook is Inactive (with grey icon) and you want to activate it, hover over the Status column of the webhook and select Activate this webhook. After activating the webhook, you will receive the event’s information of this webhook.
- Delete a webhook: If you want to delete a webhook permanently, select the three-dot menu under the Action column and select Remove. You will see a confirmation popup to confirm this action. Select the Remove webhook button in this popup to delete the selected webhook. After deleting the webhook, you will not see this webhook on Webhooks page anymore and will not receive any event’s information for this webhook. Note that removing the webhook will not delete any old data.
Events available
We started Webhooks implementation on Inspectorio QRM 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 QRM 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).