Webhooks allow third-party services to receive near real-time inspection event notifications from SafetyCulture.
You must have the "Administrator" permission set to use webhook endpoints.
Webhooks will be sent in the form of a POST HTTP request to the specified URL when an event like inspection starting, updating, completing, archiving, unarchiving takes place.
Any inspection event in the top-level organization of the user that registered the webhook will trigger the webhook. In other words, webhooks are set up per organization, not per user account.
To create a webhook, register the URL within your application that will receive the webhook payload sent when the event is triggered.
To keep the payload size manageable, the webhook payload only contains a subset of the inspection and template information. For example, the following is a payload from the TRIGGER_EVENT_INSPECTION_HAS_STARTED
event.
{
"webhook_id": "5378baaa-a470-48cc-8f11-ae2893551234",
"version": "3.0.0",
"event": {
"date_triggered": "2023-07-11T23:04:24Z",
"event_types": [
"TRIGGER_EVENT_INSPECTION",
"TRIGGER_EVENT_INSPECTION_METADATA",
"TRIGGER_EVENT_INSPECTION_HAS_STARTED"
],
"triggered_by": {
"user": "user_b0bc1fcbef1a4ecf9f9b3d2dbddb1234",
"organization": "53465cd9-8933-4518-9b7e-c7a71b3b1234"
}
},
"resource": {
"id": "audit_047ef3d184014ce7a04bc65701b51234",
"type": "INSPECTION"
},
"data": {
"event": {
"inspection_has_started": {}
},
"details": {
"inspection_id": "audit_047ef3d184014ce7a04bc65701b51234",
"template_id": "template_5ac67d8738af471f9ad861232d8e1234",
"org_id": "53465cd9-8933-4518-9b7e-c7a71b3b1234",
"modify_time": "2022-05-10T05:24:56Z",
"canonical_start_time": "2022-05-10T05:24:56Z",
"score": {}
}
}
}
If the service receiving the webhook replies with an error, the webhook will be retried with a delay. A total of 4 attempts are made, each with a delay of 100 seconds in between:
Webhook delivery is on a best effort basis, no guarantee is provided that a particular webhook will be delivered within a time frame or at all. The Search modified inspections functionality can help client code verify which inspections changed in a given date range and to compare with received webhooks to ensure completeness.
When inspections are processed on a mobile device (as opposed to the SafetyCulture web app or using the API directly), webhooks will only be triggered when these inspections are synced to the SafetyCulture server.
In the following sections we describe how to perform CRUD operations on webhooks.
Ensure that inspections containing media are fully synced before exporting a PDF or Word report export as a result of receiving a webhook notification to avoid exported reports being corrupt files. To check if media is uploaded use the media download endpoints or wait for a reasonable amount of time before initiating a report export.
Supported Trigger Events
These are the supported trigger events for webhooks.
Inspections
Trigger event | Description |
---|---|
TRIGGER_EVENT_INSPECTION | All inspection events. |
Trigger event | Description |
---|---|
TRIGGER_EVENT_INSPECTION_METADATA | When any of the metadata events in this inspections table is triggered. |
TRIGGER_EVENT_INSPECTION_HAS_STARTED | When an inspection is started. |
TRIGGER_EVENT_INSPECTION_CLONED | When an inspection is duplicated. |
TRIGGER_EVENT_INSPECTION_COMPLETED_STATUS | When an inspection is marked as complete or incomplete. |
TRIGGER_EVENT_INSPECTION_LOCATION | When an inspection's start or completion location is captured. This only applies to inspections started or completed on the mobile app. |
TRIGGER_EVENT_INSPECTION_DURATION | When an inspection's duration is updated. |
TRIGGER_EVENT_INSPECTION_ARCHIVED_STATUS | When an inspection is archived or restored from the archive. |
TRIGGER_EVENT_INSPECTION_DELETED_STATUS | When an inspection is deleted. |
TRIGGER_EVENT_INSPECTION_OWNER | When an inspection's owner is set. |
TRIGGER_EVENT_INSPECTION_ACCESS | When an inspection's access rules are updated. |
TRIGGER_EVENT_INSPECTION_ORGANISATION | When an inspection's associated organization is updated. This shouldn't be triggered in most cases. |
Trigger event | Description |
---|---|
TRIGGER_EVENT_INSPECTION_ITEM_UPDATED | When any of the events in this inspection items table is triggered. |
TRIGGER_EVENT_INSPECTION_ITEM_SITE | When the response to a site question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_TEXT | When the response to a text answer question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_TEMPERATURE | When the response to a number answer (temperature format) question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_ADDRESS | When the response to a location question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_ASSET | When the response to an asset question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_DATETIME | When the response to a date & time question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_CHECKBOX | When the response to a checkbox question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_LIST | When the response to a multiple-choice question is updated. A list item is a multiple-choice question that either has more than 5 responses, multiple selection enabled, a response that contains more than 30 characters, or a Global Response Set. |
TRIGGER_EVENT_INSPECTION_ITEM_QUESTION | When the response to a multiple-choice question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_MEDIA | When the response to a media question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_DRAWING | When the response to an annotation question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_SIGNATURE | When the response to a signature question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_SLIDER | When the response to a slider question is updated. |
TRIGGER_EVENT_INSPECTION_ITEM_NOTE | When the note for a question is updated. |
The following table contains deprecated inspection trigger events. Registration of these events will be discontinued in the near future. Alternatives have been suggested in the description.
Note: Deprecated trigger events cannot be registered together with non-deprecated trigger events.
Trigger event | Description |
---|---|
TRIGGER_EVENT_INSPECTION_STARTED | Inspection started. (Deprecated. Please use TRIGGER_EVENT_INSPECTION_HAS_STARTED ) |
TRIGGER_EVENT_INSPECTION_UPDATED | Inspection updated. (Deprecated. Please use TRIGGER_EVENT_INSPECTION ) |
TRIGGER_EVENT_INSPECTION_COMPLETED | Inspection completed. (Deprecated. Please use TRIGGER_EVENT_INSPECTION_COMPLETED_STATUS ) |
TRIGGER_EVENT_INSPECTION_ARCHIVED | Inspection archived. (Deprecated. Please use TRIGGER_EVENT_INSPECTION_ARCHIVED_STATUS ) |
TRIGGER_EVENT_INSPECTION_UNARCHIVED | Inspection unarchived. (Deprecated. Please use TRIGGER_EVENT_INSPECTION_ARCHIVED_STATUS ) |
Actions
Trigger event | Description |
---|---|
TRIGGER_EVENT_ACTION_UPDATED | Action updated. |
TRIGGER_EVENT_ACTION_CREATED | Action created. |
TRIGGER_EVENT_ACTION_TITLE_UPDATED | Action title updated. |
TRIGGER_EVENT_ACTION_DESCRIPTION_UPDATED | Action description updated. |
TRIGGER_EVENT_ACTION_DATE_DUE_UPDATED | Action date due updated. |
TRIGGER_EVENT_ACTION_STATUS_UPDATED | Action status updated. |
TRIGGER_EVENT_ACTION_PRIORITY_UPDATED | Action priority updated. |
TRIGGER_EVENT_ACTION_COLLABORATORS_UPDATED | Action collaborators updated. |
TRIGGER_EVENT_ACTION_SITE_UPDATED | Action site updated. |
TRIGGER_EVENT_ACTION_DELETED | Action deleted. |
TRIGGER_EVENT_ACTION_ASSET_UPDATED | Action asset updated. |
TRIGGER_EVENT_ACTION_LABELS_UPDATED | Action labels updated. |
Incidents
Trigger event | Description |
---|---|
TRIGGER_EVENT_INCIDENT_UPDATED | Issue updated. |
TRIGGER_EVENT_INCIDENT_CREATED | Issue created. |
TRIGGER_EVENT_INCIDENT_TITLE_UPDATED | Issue title updated. |
TRIGGER_EVENT_INCIDENT_DESCRIPTION_UPDATED | Issue description updated. |
TRIGGER_EVENT_INCIDENT_DATE_DUE_UPDATED | Issue date due updated. |
TRIGGER_EVENT_INCIDENT_STATUS_UPDATED | Issue status updated. |
TRIGGER_EVENT_INCIDENT_PRIORITY_UPDATED | Issue priority updated. |
TRIGGER_EVENT_INCIDENT_COLLABORATORS_UPDATED | Issue assignee updated. |
TRIGGER_EVENT_INCIDENT_CATEGORY_UPDATED | Issue category updated. |
TRIGGER_EVENT_INCIDENT_SITE_UPDATED | Issue site updated. |
TRIGGER_EVENT_INCIDENT_DELETED | Issue deleted. |
Media
The media uploaded event triggers once a full media file has been uploaded to SafetyCulture.
This event only gets triggered by uploaded image media files. Videos and PDF files are not supported.
Trigger event | Description |
---|---|
TRIGGER_EVENT_MEDIA_UPLOADED | Media uploaded. |
These events will return a JSON structure similar to.
{
"webhook_id": "8475debb-a531-4fc6-b25f-eaeee6e75b82",
"event": {
"date_triggered": "2022-05-10T05:24:56Z",
"event_types": ["TRIGGER_EVENT_MEDIA_UPLOADED"],
"triggered_by": {
"user_type": "user",
"user": "fd2a2355-da0f-499e-b7a6-4df5c4c89722",
"organization": "fac4e871-cc83-403e-b1d7-007b5809f8e7"
}
},
"resource": {
"id": "94924cfa-23c4-4211-917f-e00b822ee1b2",
"type": "TASK"
},
"data": {
"media_id": "37ceed41-9371-4851-995b-6869984a3e65",
"media_type": "IMAGE",
"media_url": "https://api-media-download.safetyculture.com/originals/3/7/c/e/37ceed41-9371-4851-995b-6869984a3e65?<signature>",
"content_length": 2515,
"file_extension": ".png"
}
}