Getting Started

Setting Up Webhooks

Have TempClock tell your systems the moment something happens: a clock, an approval, a locked pay week, an export, a booking change.

Talk to us Browse all guides

Before You Start

What you need.

Before you start

  • A web address on your side that accepts HTTPS POST requests (port 443, reachable from the internet)
  • An API key with Webhooks read and write access, plus read access to the data of the events you want (see below). Or ask the agency to add the subscription for you
  • Somewhere safe to keep the signing secret

What Webhooks Do

Push, not poll.

Instead of your system asking TempClock every few minutes whether anything changed, TempClock sends it a signed message when it does. Events come from the consoles, the client portal, the kiosk, the worker app, the site board, the API and scheduled jobs (for example the no-show check or the auto clock-out). A few changes send no event yet, for example a worker taking, declining or confirming a shift, cover for an absent worker, or workers imported from a file: the Webhooks reference lists them under each event, with the read that catches them. Each message is queued and sent within about a minute.

Choose Events

Pick what your system needs to know.

Event Sent when Key also needs
pay_week.locked A pay week is locked and its figures frozen: pull payroll now Payroll read
export.created A Sage, Xero or payroll file is made Payroll read
timesheet.approved, timesheet.client_rejected, timesheet.queried Shifts are approved, rejected or queried Timesheets read
clock_in, clock_out A worker clocks in or out. A clock at the kiosk or in the worker app goes to the worker's home client, so a pooled worker at your site sends you no event: see the Webhooks reference Timesheets read
shift.created, shift.updated, shift.cancelled, shift.no_show Bookings change, or a booked worker does not turn up Shifts read
worker.created, worker.updated Workers are added or changed Workers read

The full list (with every payload) is on the Webhooks reference. * subscribes to everything, including events added later, and needs all four read levels.

Create a Subscription

Through the API, or ask the agency.

With the API

Send the address and events with a key that has Webhooks write access. The reply contains the signing secret, once: store it now.

curl -s -X POST "$TC_BASE/webhooks.php" \ -H "Authorization: Bearer $TC_KEY" -H "Content-Type: application/json" \ -d '{"url": "https://hooks.example.com/tempclock", "events": ["pay_week.locked", "export.created"], "description": "Payroll system"}'

Or in the agency console

The agency can add it under Setup > Webhooks: choose the client, enter the address and tick the events. The secret is shown once there too.

Note

A subscription made with an API key follows that key. If the key is revoked, expires or loses the access an event needs, nothing more is sent to it. Addresses inside a private network are refused.

Verify Signatures

Make sure each message really came from TempClock.

Each message has an X-TempClock-Signature header: sha256= and the HMAC-SHA256 of the exact body, keyed with your secret. Work it out on the raw bytes you received and compare in constant time:

<?php $body = file_get_contents('php://input'); $want = 'sha256=' . hash_hmac('sha256', $body, getenv('TEMPCLOCK_WEBHOOK_SECRET')); if (!hash_equals($want, $_SERVER['HTTP_X_TEMPCLOCK_SIGNATURE'] ?? '')) { http_response_code(401); exit; } // ... queue the work, then answer quickly: http_response_code(200);

Node.js and Python versions are on the Webhooks reference.

Send a Test

Check your address works before real events arrive.

A test sends a ping to that one subscription straight away and tells you what your address answered:

curl -s -X POST "$TC_BASE/webhooks.php?id=12&action=test" -H "Authorization: Bearer $TC_KEY"

In the agency console, use Send test on the subscription. A response_code of 0 means TempClock could not reach your address at all (wrong address, not public, or not HTTPS on port 443).

Watch Deliveries

Every message is logged for 90 days.

  • Answer with any 2xx status within 5 seconds. Do the work afterwards, from your own queue.
  • Anything else is retried after 1 minute, 5 minutes, 30 minutes and 2 hours (5 attempts in all).
  • One exception: if your address's host name does not resolve when a message is sent (even during a short DNS fault), or resolves to a private address, that message is not retried. It shows as failed in the log; use Send again once the address works.
  • A retry has the same X-TempClock-Delivery id: keep the ids you have handled and ignore repeats.
  • The delivery log (GET /webhooks.php?id=12&action=deliveries, or Log in the agency console) shows each message, the exact body sent and what your address answered. The agency can Send again a failed one.

Troubleshooting

Common problems.

Problem What to check
403 insufficient_scope when subscribing The key needs read access to the data of each event as well as Webhooks write (the reply names the missing level).
400 validation_failed on url The address must be HTTPS on port 443 and reachable from the internet.
Nothing arrives Is the subscription active? Is the key that made it still active, with the access the events need? Check the delivery log.
Signature never matches Compute it on the raw body before parsing JSON, and use the latest secret (a new secret replaces the old one at once).
The same event twice A retry after a slow or failed answer: de-duplicate on X-TempClock-Delivery.

Know who turned up, and pay every hour right.

Face-verified clock-ins, live geofencing and payroll-ready timesheets in one system. Tell us how your shifts run and we will show you how it fits.

Hosted in the EU · Your largest site live first, with us alongside · No app needed to clock in