New Employee Webhook Example

If your app handles any people or employee data, chances are you would like to know when an employee is added or updated in the Deputy install. Below is some example requests to setup Webhooks related to employees in the Deputy install.

πŸ“˜

https://www.webhook.site

This website is a simple tool which allows developers to see Webhook events coming through in a web interface. It's a great tool for troubleshooting any problems that may be occurring.

πŸ“˜

URL for Webhooks

To add or update webhooks the URL is always the same format
https://{clientinstall}.{geo}.deputy.com/api/v1/resource/Webhook

Basic new employee event

Below is an example of a Webhook call that will setup the Deputy install to trigger a Webhook event every time a new employee is added to the Deputy install

{
    "Topic": "Employee.Insert",
    "Enabled": 1,
    "Type": "URL",
    "Address": "https://webhook.site/a90b0a6b-43e9-4755-8bf5-3518980d373a"
}

Employee updated

How you setup a Webhook to be triggered when an employee is updated is determined by whether you want to only trigger the event when data is changed. It's possible to also setup a Webhook that will trigger if an employee is saved, even with no changes.

Every time an employee is saved example

{
    "Topic": "Employee.Save",
    "Enabled": 1,
    "Type": "URL",
    "Address": "https://webhook.site/a90b0a6b-43e9-4755-8bf5-3518980d373a"
}

Every time an employee is changed example

{
    "Topic": "Employee.Update",
    "Enabled": 1,
    "Type": "URL",
    "Address": "https://webhook.site/a90b0a6b-43e9-4755-8bf5-3518980d373a"
}

Adding a filter

By default, Webhook events will be triggered every time the action occurs in the install. However it is possible when setting up the Webhook in the Deputy install to define some filters. This allows you to have the Deputy system handle the filtering before it gets to your backend system.

For example you may have built a cooking app and only want to know when a new employee is added to the Chef area in a Deputy install. This scenario is what we have based the example below on.

{
    "Topic": "Employee.Insert",
    "Enabled": 1,
    "Type": "URL",
    "Filter": {
    "OperationalUnit": "Chef"
    }
    "Address": "https://webhook.site/a90b0a6b-43e9-4755-8bf5-3518980d373a"
}