Skip to main content

Webhooks

Watch jobs deliver page change events to the webhook_url you configure.

Configure a callback URL​

Provide webhook_url when you create a monitoring job or update a job:

curl https://openapi.flowda.ai/v1/watch/jobs \
-H "Authorization: Bearer $FLOWDA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/pricing",
"schedule": {"interval_seconds": 3600},
"webhook_url": "https://your-app.example.com/hooks/flowda"
}'

The required schedule object must contain exactly one of interval_seconds or cron. The legacy top-level schedule_interval and schedule_cron fields are rejected. A cron schedule uses the IANA timezone in timezone; interval schedules run on the UTC timeline.

Callback signing secret​

When a new callback URL is registered, the response includes data.data.webhook_secret — the callback address sits in the platform's nested body, next to data.data.job.

Returned only once

Store webhook_secret immediately. It is returned only when the new URL is registered and is the HMAC key used to verify callbacks.

A URL is registered once per account. Reusing a URL that was already registered — including after deleting the job — never returns its secret again, and GET /v1/watch/jobs/{id} never returns it. There is no read-back or rotate endpoint: register a new callback URL (for example a new path) and update the job to rotate the secret. When no secret is returned, data.data.webhook_secret_note explains why.

Delivery​

The fetch platform sends events through a flowda relay rather than directly to your callback URL. This keeps platform credentials out of requests to your application.

flowda stores your callback URL, forwards the events, and signs the callbacks with your webhook_secret. Job responses show your callback URL rather than the internal relay address.

Callback request​

Each event is delivered as POST to your webhook_url with Content-Type: application/json. The body is the change event; these headers carry what you need to authenticate and deduplicate it:

HeaderMeaning
X-Watch-Signaturet= followed by unix seconds, then ,v1= followed by a lowercase hex digest.
X-Flowda-EventEvent name; currently watch.change_detected.
X-Flowda-Event-IdStable idempotency key built from the job, the check and the event.
X-Flowda-Delivery-IdIdentifier of this delivery.
X-Flowda-AttemptAttempt number, starting at 1.

The digest is HMAC-SHA256(webhook_secret, timestamp + "." + body) — the unix timestamp from the header, a dot, then the raw request body bytes:

import hashlib
import hmac


def verify(secret: str, header: str, raw_body: bytes) -> bool:
parts = dict(piece.split("=", 1) for piece in header.split(","))
timestamp, digest = parts.get("t"), parts.get("v1")
if not timestamp or not digest:
return False
expected = hmac.new(
secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, digest)

Verify the bytes you received, before parsing them: decoding the JSON and serializing it again changes the bytes and breaks the signature. Treat a timestamp more than 5 minutes away from your own clock as a replay and reject it.

Answer 2xx as soon as you have accepted the event, and do the slow work afterwards. A non-2xx answer is retried, up to 6 delivery attempts in total, with delays of 10s, 1m, 5m, 30m and 2h between them; 4xx answers other than 408, 425 and 429 stop immediately, and Retry-After is honoured up to 10 minutes. A retry can therefore arrive for an event you have already handled — compare X-Flowda-Event-Id before doing the work.

Event body​

Each delivery is a watch.change_detected event. Only change events are sent: a check that finds no change delivers nothing, and a job without webhook_url sends nothing.

FieldMeaning
eventAlways watch.change_detected today.
delivered_atUnix seconds when the platform created the event. This is not the signature timestamp t, which is set when we hand the request to you — it can be a few seconds later, and later still on a retry.
data.job.job_idThe job's public id, the {id} of /v1/watch/jobs/{id}.
data.job.url, data.job.statusThe monitored URL and the job's status at that moment.
data.check.check_idCheck id, the {check_id} of /v1/watch/jobs/{id}/checks/{check_id}.
data.check.checked_atWhen the page was fetched.
data.check.changedtrue for every delivered event.
data.check.diff_summaryOne-line summary of the change, for example 1 line modified.
data.check.resultThe fetch result: status_code (the target site's, not this API's), url as requested, final_url after redirects.
data.diffThe change itself: mode (text or json), unified_diff, hunks[], summary, truncated.
data.diff.hunks[].pathWhere the change is: a CSS/XPath selector, a JSON pointer, or a line marker such as L683, depending on the job's selectors and diff_modes.

data.job and data.check are subsets of the objects the job endpoints return — call GET /v1/watch/jobs/{id}/checks/{check_id} when you need the full check record.

{
"event": "watch.change_detected",
"delivered_at": 1793234266,
"data": {
"job": {
"job_id": "job_example000000000000",
"url": "https://www.example.com/pricing",
"status": "active"
},
"check": {
"check_id": "chk_example000000000000",
"checked_at": "2026-10-29T00:37:42Z",
"changed": true,
"diff_summary": "0 lines added / 0 lines removed / 1 line modified",
"result": {
"status_code": 200,
"url": "https://www.example.com/pricing",
"final_url": "https://www.example.com/pricing/"
}
},
"diff": {
"changed": true,
"mode": "text",
"truncated": false,
"summary": {"added_lines": 0, "removed_lines": 0, "modified_lines": 1, "change_ratio": 0.0011},
"hunks": [
{
"path": "L683",
"change_type": "modified",
"before": "<input type=\"hidden\" name=\"nonce\" value=\"cb2c700ff4\">",
"after": "<input type=\"hidden\" name=\"nonce\" value=\"6736fab388\">"
}
],
"unified_diff": "--- previous\n+++ current\n@@ -680,7 +680,7 @@\n"
}
}
}

Our relay re-serializes the event before sending it, so keys arrive in alphabetical order and the body is not byte-identical to what the platform produced. That is exactly why you must verify the signature over the bytes you received. The full schema is WatchEvent in the OpenAPI document — the changeDetected callback of POST /v1/watch/jobs.

Test your verifier against a fixed sample​

Before going live, check your verifier with this known-answer tuple:

secret whsec_EXAMPLEsecret
t 1793234266
body {"event":"watch.change_detected","delivered_at":1793234266,"data":{"job":{"job_id":"job_example000000000000","url":"https://www.example.com/pricing","status":"active"},"check":{"check_id":"chk_example000000000000","changed":true}}}
X-Watch-Signature t=1793234266,v1=06f172a6db59be1f62a69db93093142030d79fec915cb025d7704e98c34b497d

If your verifier accepts that header for those bytes, your algorithm and encoding are right.

Receiver recommendations​

  • Use an HTTPS callback URL.
  • Verify the signature before processing the event. Return 401 if verification fails.
  • Return a 2xx response promptly and move slow processing to a background queue.
  • Deduplicate events because the same event can be delivered more than once.

Set webhook_url to null or an empty string when updating a job to remove its callback.