A webhook is a way for HR-ON Staff to notify your application about events in real-time. It allows you to receive notifications about events automatically when they occur in HR-ON Staff, without having to poll the API for updates continuously.
Webhooks are useful for automating data synchronization between HR-ON Staff and your internal systems or to trigger actions in your application based on specific events that occur in HR-ON Staff.
For example, you can set up a webhook to notify your application whenever a new employee is created, or when an employee's information is updated.
POST
requests and must respond with a 200 OK
status code to received events.200 OK
status in time, then after 10 consecutive failures, the webhook will be deactivated and must be re-verified.POST
requests to the specified URL.X-HR-ON-Token
header.To create a webhook, you need to send a POST request to the Create Webhook endpoint with the following parameters:
endpoint
: The URL where the webhook will send data.eventNames
: An array of events that will trigger the webhook.token
: A unique token that will be sent with the webhook request to verify its authenticity.POST /webhooks
Host: https://webhook.hr-on.com/v1
Content-Type: application/json
Body: {
"endpoint": "https://your-webhook-receiver-url.com",
"eventNames": ["EmployeeCreated", "EmployeeUpdated"],
"token": "your_unique_token_here"
}
You can see the full list of response properties in the Create Webhook endpoint documentation, but the most important one is id
, which is the unique identifier for the webhook you just created. You will need this ID to manage your webhook in the next steps.
After creating the webhook, you need to verify it using the Verify Webhook endpoint.
The verification process involves your endpoint receiving a POST
request with a payload containing a randomly generated 64 byte string, which your endpoint must return in the response body.
POST /webhooks/{webhookId}/verify
Host: https://webhook.hr-on.com/v1
Content-Type: application/json
If everything is set up correctly, and your endpoint responded with a 200 OK
status and the same 64 byte string in the response body, your webhook will be verified.
You can test your webhook by triggering a test event using the Trigger Webhook endpoint. This will send a sample event to your webhook endpoint, allowing you to verify that it is working correctly.
POST /webhooks/{webhookId}/trigger
Host: https://webhook.hr-on.com/v1
Content-Type: application/json
Body: {
"eventName": "EmployeeCreated",
}
Your endpoint will receive a POST
request with a sample payload matching what you would receive in a real event.
You will always receive the following properties in the payload:
message
- A user friendly message describing the event.eventName
- The name of the event that was triggered.sentAt
- The date and time when the event was sent.You will also receive one of the following properties, depending on the event name:
employeeId
- The ID of the employee that was created or updated.departmentId
- The ID of the department that was created or updated.documentId
- The ID of the document that was uploaded or deleted.Do note that any IDs from these test events are fake and will not correspond to any real data in your HR-ON Staff account.
When your endpoint receives a webhook event, you are then able to consume it and take action based on the event. The payload will contain the same properties as the test event, but with real data.
The most common use case is to update your internal systems with new data from HR-ON Staff, when an employee is updated.
Below is an example of how this simple flow could look like:
{
"message": "An employee has been updated",
"eventName": "EmployeeUpdated",
"sentAt": "2025-06-17T11:00:00.000Z",
"employeeId": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
}
GET /employees/3fe2987b-ef4e-4b7c-b321-89585e2a4178
Host: https://api.hr-on.com/v1/staff
Authorization: Bearer your_access_token_here
Creates a new webhook. For it to receive events, it then has to be verified.
endpoint required | string The endpoint that should receive events. The endpoint should have either "http://" or "https://" in front of the URL |
eventNames required | Array of strings (WebhookEventName) Items Enum: "DepartmentCreated" "DepartmentDeleted" "DepartmentUpdated" "DocumentDeleted" "DocumentUploaded" "EmployeeCreated" "EmployeeDeleted" "EmployeeUpdated" A list of the event names to subscribe for. |
token required | string A user-specified token used to verify that requests were sent by HR-ON. This token will be set as a header called 'X-HR-ON-Token' in every event sent to the endpoint. |
required | object (IWebhook) Used for generating docs with tsoa express controllers. |
success required | boolean Whether or not the request was successful |
{- "endpoint": "string",
- "token": "string",
- "eventNames": [
- "DepartmentCreated"
]
}
{- "success": true,
- "item": {
- "id": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "companyId": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "endpoint": "string",
- "token": "string",
- "verifiedAt": "string",
- "createdAt": "string",
- "updatedAt": "string",
- "failed": 0,
- "events": [
- {
- "name": "string",
- "description": "string"
}
]
}
}
Deletes a specific webhook given its UUID.
id required | string The UUID of the webhook. |
message required | string A user friendly message |
success required | boolean Whether or not the request was successful |
curl --request DELETE \ --url https://webhook.hr-on.com//v1/webhooks/%7Bid%7D \ --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
{- "success": true,
- "message": "string"
}
Fetches a specific webhook given its UUID.
id required | string The UUID of the webhook. |
required | Array of objects (IWebhook) |
required | object (PageInfo) |
curl --request GET \ --url https://webhook.hr-on.com//v1/webhooks/%7Bid%7D \ --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
{- "items": [
- {
- "id": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "companyId": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "endpoint": "string",
- "token": "string",
- "verifiedAt": "string",
- "createdAt": "string",
- "updatedAt": "string",
- "failed": 0,
- "events": [
- {
- "name": "string",
- "description": "string"
}
]
}
], - "pageInfo": {
- "size": 0,
- "offset": 0,
- "total": 0
}
}
Fetches all webhooks. Use size and offset parameters to paginate through the results.
eventName | string Enum: "DepartmentCreated" "DepartmentDeleted" "DepartmentUpdated" "DocumentDeleted" "DocumentUploaded" "EmployeeCreated" "EmployeeDeleted" "EmployeeUpdated" Filters webhooks by the given event name. |
offset | integer <int32> Specifies the amount of items to skip before selection. |
size | integer <int32> Specifies the amount of items to be returned. Defaults to 20. |
required | Array of objects (IWebhook) |
required | object (PageInfo) |
curl --request GET \ --url 'https://webhook.hr-on.com//v1/webhooks?size=SOME_INTEGER_VALUE&offset=SOME_INTEGER_VALUE&eventName=SOME_STRING_VALUE' \ --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
{- "items": [
- {
- "id": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "companyId": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "endpoint": "string",
- "token": "string",
- "verifiedAt": "string",
- "createdAt": "string",
- "updatedAt": "string",
- "failed": 0,
- "events": [
- {
- "name": "string",
- "description": "string"
}
]
}
], - "pageInfo": {
- "size": 0,
- "offset": 0,
- "total": 0
}
}
Triggers an event for the given webhook subscription. Response body will contain properties based on the event, and holds the same properties as a real webhook event of the same type would. For example, if the event is 'EmployeeCreated', the response body will contain the employeeId. In order for your endpoint to receive events, it first needs to be verified. Use for testing if your endpoint correctly receives events from the webhook subscription
id required | string The UUID of the webhook |
eventName | string (WebhookEventName) Enum: "DepartmentCreated" "DepartmentDeleted" "DepartmentUpdated" "DocumentDeleted" "DocumentUploaded" "EmployeeCreated" "EmployeeDeleted" "EmployeeUpdated" |
eventName required | string (WebhookEventName) Enum: "DepartmentCreated" "DepartmentDeleted" "DepartmentUpdated" "DocumentDeleted" "DocumentUploaded" "EmployeeCreated" "EmployeeDeleted" "EmployeeUpdated" |
message required | string |
sentAt required | string |
departmentId | string |
documentId | string |
employeeId | string |
{ }
{- "message": "string",
- "eventName": "DepartmentCreated",
- "sentAt": "string",
- "employeeId": "string",
- "departmentId": "string",
- "documentId": "string"
}
Updates the webhook based on the given UUID. After it is updated, it needs to be verified again, in order to receive events.
id required | string The UUID of the webhook. |
endpoint | string The endpoint that should receive events. |
eventNames | Array of strings (WebhookEventName) Items Enum: "DepartmentCreated" "DepartmentDeleted" "DepartmentUpdated" "DocumentDeleted" "DocumentUploaded" "EmployeeCreated" "EmployeeDeleted" "EmployeeUpdated" A list of the event names to subscribe for. |
token | string A user-specified token used to verify that requests were sent by HR-ON. This token will be set as a header called 'X-HR-ON-Token' in every event sent to the endpoint. |
required | object (IWebhook) Used for generating docs with tsoa express controllers. |
success required | boolean Whether or not the request was successful |
{ }
{- "success": true,
- "item": {
- "id": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "companyId": "3fe2987b-ef4e-4b7c-b321-89585e2a4178",
- "endpoint": "string",
- "token": "string",
- "verifiedAt": "string",
- "createdAt": "string",
- "updatedAt": "string",
- "failed": 0,
- "events": [
- {
- "name": "string",
- "description": "string"
}
]
}
}
Verifies a webhook. A payload containing a randomly generated 64 byte string will be sent in the body of a POST request to your endpoint. Return the payload in its entirety in your response body to verify the webhook.
id required | string The UUID of the webhook |
message required | string A user friendly message |
success required | boolean Whether or not the request was successful |
curl --request POST \ --url https://webhook.hr-on.com//v1/webhooks/%7Bid%7D/verify \ --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
{- "success": true,
- "message": "string"
}