Webhooks are one of a few ways web apps can communicate with one another, which allows you to send real-time information from one application to another whenever certain events occur. Webhooks can be created and configured to handle event notifications for events you would like to be notified about.
Working with Webhook Event Notifications
When working with webhook event notifications, each event notification request will contain two headers from Loopio:
X-Loopio-Content-Signature
: The JSON-encoded body of the request, hashed by the webhook's signing secret. See our article How Do I Use My Signing Secret? for more information.X-Loopio-Request-Timestamp
: The timestamp of when the request was sent.
The body of each event notification request has the same general structure, with an event property containing the name of the event and a context property containing the details of that event.
What Events Can Webhooks Subscribe To?
You can currently subscribe to Library Entry Updates, Library Review Assignments, Project Created, and Project Status Changes
Library Entry Update
This event is triggered whenever one or more Library Entries are updated. The request body will look something like this:
{
"event": "libraryEntry.updated",
"context": {
"libraryEntryIds": [1, 2, 3]
}
}
It contains the IDs of the Library Entries that have been updated.
Library Review Assignment
This event is triggered whenever a Library Review is created and assigned to someone. The request body will look something like this:
{
"event": "libraryReview.assigned",
"context": {
"libraryEntryId": 0,
"reviewId": 0,
"assignedTo": {
"id": 0,
"email": "string"
},
"assignedBy": {
"type": "user",
"id": 0,
"email": "string"
},
"dueDate": "2021-07-06T17:37:20.436Z"
}
}
It contains information about the Library Review, who assigned it, who it was assigned to, as well as its due date.
Project Created
This event is triggered whenever a Project is created. The request body will look something like this:
{ "event": "project.created",
"context": {
"projectId": 0
}
}
Project Status Changes
This event is triggered whenever a Project status has been updated. The request body will look something like this:
{
"event": "project.statusChanged",
"context": {
"projectId": 0,
"status": "ACTIVE"
}
}
It contains information about the Project, as well as what the Project’s status was changed to.
How to Handle a Webhook Event Notification
When you receive a notification for an event your webhook is subscribed to, you should verify the request came from Loopio and respond to our request with a HTTP 200 status for your webhook to remain active.
If we receive a response other than a HTTP 200 status:
- No response: we will retry sending the event notification two more times. If we still have not received a HTTP 200 status after those attempts, your webhook will be deactivated.
- HTTP 4xx statuses: your webhook will be deactivated immediately.
- Any other response: we will retry sending the event notification two more times. If we still have not received a HTTP 200 status after those attempts, your webhook will be deactivated.
Deactivated webhooks will need to be reactivated through our webhook URL validation. You can learn more about this process by reading our How Do I Validate My Webhook URL? article.