Skip to main content
This walks you through receiving your first Flow Payroll event. You need an access token (see Authentication) and somewhere to run a small web server.
1

Build a receiver

A receiver is a URL on your server that accepts an HTTP POST. It must do three things, in this order:
  1. Check the signature, to be sure the request came from Flow Payroll.
  2. Store the event, or put it on a queue.
  3. Answer quickly with a success status (any status from 200 to 299).
Do the real work (updating your records, sending emails) afterwards, not before answering.
This receiver checks the v1a signature with your endpoint’s public key, which is the recommended way: the receiver holds nothing that could sign a fake delivery. To check the v1 signature with the signing secret instead, see Verify with the signing secret.You do not have the public key yet. You get it in step 3.
2

Give it a public HTTPS address

Flow Payroll can only deliver to a public https:// address on the standard HTTPS port (443), so it will not reach localhost on your machine. While you build, a tunnelling tool gives your local server a temporary public address. Point one at port 3000 and it gives you an address such as https://a1b2c3d4.tunnel.example.com.Your receiver’s URL is then https://a1b2c3d4.tunnel.example.com/webhooks/flow-payroll.
3

Register it as an endpoint

An endpoint is Flow Payroll’s record of your receiver: its URL, which events it wants, and the keys its deliveries are signed with.
The answer contains endpoint.endpointId (starting ep_), publicKey (starting whpk_) and signingSecret (starting whsec_). Copy publicKey into FLOW_WEBHOOK_PUBLIC_KEY and restart your receiver. The public key is not a secret, and you can read it again at any time from GET /endpoints/{endpointId}/secrets.
The signing secret is shown only once. This receiver does not need it, but store it in your secrets manager if you might check v1 signatures later. If you lose it, rotate to get a new one.
4

Send a test event

Your receiver logs Received webhook.test, and the answer to your call says "succeeded": true with the status your receiver gave. If it says false, the statusCode tells you why: 400 usually means the public key in your receiver is not this endpoint’s.
5

Receive a real event

Finalise a payslip in sandbox. Within seconds your receiver logs Received payslip.finalised. To receive more kinds of event, add them:
employee.* means every employee event, including ones we add later. Event types lists them all.

Before you go live

  • Your receiver runs on your own server, not a tunnel, at a stable https:// address.
  • It verifies every delivery and rejects failures with 400. See Verify signatures.
  • It records each event’s id in a database and skips repeats. See Handle duplicates.
  • It answers within 15 seconds and does slow work afterwards. See Answer quickly.
  • The live endpoint is created with your live token, and your receiver has its public key (and its signing secret is in your secrets manager, if you use it). Sandbox and live endpoints, keys and secrets are separate.
  • Someone is told when deliveries fail. Check the delivery log, or alert on your own receiver’s errors.