Triggering an Employee Webhook

To trigger a webhook, first ensure that your webhook events are set up. If not, see: https://caspeco.atlassian.net/wiki/spaces/DD/pages/3289022467 .


Flow chart of an event being triggered and possibly being sent or queued.

 

Fields that will trigger a webhook

The highlighted fields in the images below will trigger a webhook transmission either in real time or at a scheduled time, depending on the scheduling of the update event.

Modifying the fields “First name”, “Last name” and “E-mail private” on an employees personal information
page will trigger a webhook.

 

Modifying the fields “Employment to”, “Main affiliation” and “Cost centre/station” on an employees employment will trigger a webhook.

Creating and Approving an Employee to Trigger “employee.created”

To create an employee go to Staff > Personal Files and click the create button in the top left corner:

If the employee is whitelisted the “employee.created”-event will be triggered and a new webhook message containing relevant data (https://caspeco.atlassian.net/wiki/spaces/DD/pages/3287842824) will be created and put in a message fast queue to be delivered as soon as possible to the configured receiving end-point. Otherwise the employee needs to be whitelisted before any events will be triggered for that employee. Once they are whitelisted you can approve the employee which will trigger the “employee.created” event.

 

Updating an Employee to Trigger “employee.updated” or “employment.ended”

Instant Creation and Transmission of Update

If an update to the employee or the employees employment is made on a relevant field (https://caspeco.atlassian.net/wiki/spaces/DD/pages/3287842824) a “employee.updated” or “employment.ended” message will be created and put in the message fast queue for instant transmission - if those events are present in the webhook configuration and the changes are effective at the time of the update.

Future Updates and Transmission of Update

Certain changes can be scheduled in the future, such as the employment end date or the employees profession. If a future update is created a change-point on the employee is created. An employees change-points can be viewed on the employees employment page:

Potential future changes are not sent to the message queue straight away, but are stored in a queue table - awaiting transmission on the date where the update will take effect. Future messages that are to be sent are retrieved by a background task which fetches future messages that are in effect every fifth hour. The retrieved future messages will then be sent to the fast message queue for immediate transmission to the configured receiving end-point.

 

Deleting an Employee to Trigger “employee.deleted”

If an employee is deleted a “employee.deleted” message is created and is sent to the fast message queue or immediate transmission to the configured receiving end-point. To delete an employee, go to Staff > Personal Files and click on the delete button in the top right corner of the Personal Information-section:

 

Hide an Employee to Trigger “employee.enabled”

To hide an employee, navigate to Staff > Employment and click on the three button with “show more”-button in the upper right corner and select “Hide Person”. The event will trigger both for when the box is checked and unchecked, but with the Enabled field set to false if the employee is set to hidden and true if the employee is set to visible.

It’s not possible to hide employees with active employments. If an employment is added to a an employee that is hidden they will become visible, which will trigger the “employee.enabled” event as well as the “employee.updated” event.

Unhide an Employee to Trigger “employee.enabled”

To unhide an employee you can either follow the steps mentioned above an unselect the “Hide person” checkbox. This results in an “employee.enabled”-message being sent.

Alternatively, you can unhide an employee by giving it an employment. This results in an “employee-enable” message being sent, followed by an “employee.update” message containing the new employment. If the employment is to be activated in the future the “employee.update”-message will be queued and sent on the day when the employment will take effect.

Initializing System by triggering “employee.created” event for all employees

To manually trigger the “employee.created” event for all currently approved employees you need at least one active webhook subscribing to said event. When you press the initialization button you will receive a message for each employee as if they have just been approved. You will then need to wait at least 10 minutes before you are allowed to run the initialization again.