Webhook Overview

Webhooks allow your application to be told when changes are made within a Deputy install automatically. After a webhook is setup, Deputy will send a POST request to your application with information about whatever has changed.

For example, if you setup a Webhook related to adding timesheets, every time a user adds a timesheet, you're application will be informed. This is especially useful for those who may want to offer as close to possible real time integrations with the Deputy system.

Almost every part of Deputy is available for a Webhook integration. Anything which is available as a Resource can have a Webhook applied to it.

For example you can have Webhooks related to timesheets being updated, employees being created, or sales being added just to name a few. Each type of action requires an individual Webhook to be setup. For example for your application to be informed when a timesheet is added or a timesheet is updated, that would be two Webhooks.

There is no limit to how many Webhooks you can setup per Deputy install.

📘

Eventing

By default every event that occurs in Deputy related to a task will be fired as a webhook. For example by default Timesheets will fire webhooks when the timesheet is initiated (ie. an employee clocks on), when the timesheet becomes pending (when the employee clocks off), when the time becomes approved by a manager and when the pay becomes approved by a manager.

It is important that as part of your development, you consider what specific events you need to target and add filtering to the webhooks to ensure you only receive the traffic your application requires. For any assistance with this please contact [email protected].

Payload of webhook

Deputy will post the webhook to your server in a JSON format. The JSON will be an object which has a topic and data property: [topic => topic_name, data=> OBJECT or [OBJECT]]

Deputy will also add the following three headers:

  • X-Deputy-Secret: Checksum of the data payload which is a sha256 hmac of the body, salted with a secret key. This is for Enterprise based installs. To get the private key from an enterprise install go to Enterprise -> Advanced Settings -> Private Key for API Signining in Deputy
  • X-Deputy-Webhook-Callback: The resource URL of the webhook that generated this hook call
  • X-Deputy-Generation-Time: Unix timestamp of when the webhook was sent.