A webhook is a method HRWize uses to notify third-party applications that something has happened in the HRWize system other than where that event is triggered by bulk actions such as bulk uploads.
This is very useful when using bulk uploads, thus, when the webhook has been received, you can then signal API and do something.
In HRWize, we currently support 18 webhooks that covers three main actions in the system - add, update, and delete.
employee.add |
employee.update |
employee.delete |
timeoff.add |
timeoff.update |
timeoff.delete |
expense.add |
expense.update |
expense.delete |
mileage.add |
mileage.update |
mileage.delete |
timesheet.add |
timesheet.update |
timesheet.delete |
training.add |
training.update |
training.delete |
Please Note - Webhooks will only fire when a core piece of information is affected. For example, when an employee is made a leaver, the system updates a number of records such as time off and training, but these will not fire the time off webhooks. Likewise, if you archive a record, this will not trigger a webhook.
Setting Up Webhooks
As an administrator, simply go to:
Administration > Company > Settings > API > Webhooks
Once there, click on the 'Add' button, and you will then need to enter 3 pieces of information:
- URL - This is the URL of the script which will catch the incoming webhook. This URL must be available on the internet for us to POST to.
- Secret - This is your secret phrase or password that you will use to validate an incoming webhook.
- Events - These are the events you would like the webhook to trigger.
Webhook Formatting
In HRWize, our webhooks are always sent by a POST request and has a standard format consisting of:
-
A header - There are 2 pieces of information:
- Content-Type - application/JSON;
- Authorization - This will be your secret.
- A body - The body will always contain JSON data.
For the header section, we strongly recommend that you check the secret each time you receive a webhook and ensure that it matches the secret you are expecting. If you fail to do so, it is possible that you could receive webhooks that did not come from HRWize.
Please also ensure that you check for any incoming webhook URL and IP address to ensure it also is the one you are expecting to receive.
As for the body, there will be a JSON array that contains 2 pieces of information:
- Event - This is the event that triggered the webhook;
- ID - This is the ID of the object in HRWize which caused this to trigger.
For example, if employee ID 12345 was updated, the body would look somewhat like this:
If time off ID 23456 was deleted, the body would look somewhat like this:
HRWize
Comments