Guides
Follow-up watchers
Some watches only work in order, like "when the store lists the new keyboard, tell me when it's under $200", since there's no page to watch for a price until it's listed. Put the second watcher in then, and when the first one matches, we create it on the page that matched.
{
"target": { "query": "Q6 HE", "match": "line" },
"conditions": { "all": [{ "field": "availability", "op": "=", "value": "in_stock" }] },
"where": { "sites": ["keychron.com"], "aggregate": "first" },
"schedule": { "every": "1h", "until": "+180d" },
"then": {
"conditions": { "all": [{ "field": "price", "op": "<", "value": 200 }] },
"schedule": { "every": "6h", "until": "+90d" }
}
}What the follow-up gets
| Field | Value |
|---|---|
target | match: url on the page that matched, with the parent's attributes |
conditions, schedule | From then |
where | From then, or the site that matched |
notify | From then, or the parent's |
location, fetch | The parent's |
The parent's matched event names it under then:
"then": [{ "url": "https://www.keychron.com/products/keychron-q6-he-wireless-custom-keyboard", "child_id": "wch_8s1d4f6g7h2j3k5l9q0w" }]The follow-up has parent_id set, signs its webhooks with the parent's webhook_secret, and otherwise works like any other watcher.
Rules
- The parent must stop at its first match, with
until: "after_first_match"oraggregate: "first". - A
thencan't have its ownthen. - We check
thenwhen you create the parent, so a bad one fails right away. It can't have aversioncondition, since the follow-up watches one page and has no version to compare. - If we can't create the follow-up, the event has
then_skippedinstead ofchild_id:"limit"at the watcher limit, or an error code if the follow-up no longer passes our checks.
In the examples
- Requests with
then: Holdout