通过 Webhook 把每次运行的新结果发送到你自己的地址、校验签名,并用 API 密钥或 MCP 客户端读取监控。
目标:把监控找到的内容送进你自己的系统:每次运行后推送到你的地址,或随时用 API 密钥读取。两者都不收费。
ACTION FOR THE HUMAN: open https://app.anysite.io/monitors (打开监控).
https:// 地址,然后
点击保存更改。所有类型的监控都可以设置,包括帖子链接下的人。只保存 Webhook 不收费。id 去重。 每条帖子、变化、人员和条目都带有 id。同一条内容可能通过 Webhook 和 API 再次出现;保留第一条即可。要停止调用,清空 Webhook 地址并保存。设置中的重新生成密钥会生成新密钥;旧密钥会立即失效,请更新接收端。
每次运行找到内容后,会向你的地址发送一次 POST,与结果邮件同时发出:
| 请求头 | 值 |
|---|---|
Content-Type |
application/json |
User-Agent |
Anysite-Webhook/1.0 |
X-Webhook-Signature |
sha256= 加上原始请求体的十六进制 HMAC-SHA256,以密钥签名 |
{
"monitor_id": "<monitor id>",
"runs": [
{
"id": "<run id>",
"status": "done",
"result_count": 2,
"person_count": 1,
"started_at": 1764000000,
"finished_at": 1764000300,
"posts": [],
"changes": [],
"people": [],
"items": []
}
],
"has_more": false,
"next_cursor": "<cursor>"
}
posts、changes、people 和 items 中的内容与监控各标签页中的相同。items 属于自定义流程,与其条目标签页
显示的相同,其他类型中为空:kind 为 item 表示新条目,为 item_change 表示关注字段的变化;fields 是你选择显示的
字段(各带 step、path 和 value);在 item_change 上,change 是该字段的 path、old 和 new 值,以及
越过的 threshold(关注没有阈值时为 null);新条目上 change 为 null。自定义流程的一次运行:
{
"id": "<run id>",
"status": "done",
"result_count": 2,
"person_count": 0,
"started_at": 1764000000,
"finished_at": 1764000300,
"posts": [],
"changes": [],
"people": [],
"items": [
{
"id": "<item id>",
"kind": "item",
"item_url": "https://jp.mercari.com/item/m2",
"title": "Switch 2",
"fields": [
{ "step": 2, "path": "name", "value": "Switch 2" },
{ "step": 2, "path": "price", "value": 30002 }
],
"change": null,
"is_new": true,
"found_at": 1764000120
},
{
"id": "<item id>",
"kind": "item_change",
"item_url": "https://jp.mercari.com/item/m1",
"title": "Switch 1",
"fields": [
{ "step": 2, "path": "name", "value": "Switch 1" },
{ "step": 2, "path": "price", "value": 27500 }
],
"change": { "path": "price", "old": 30001, "new": 27500, "threshold": null },
"is_new": true,
"found_at": 1764000180
}
]
}
一次调用最多携带该次运行的 100 条内容;当
has_more 为 true 时,用 after=<next_cursor> 从新闻流读取其余内容。时间为 Unix 秒。重定向不会被跟随,10 秒内
没有响应的调用记为失败。
请对收到的原始字节校验签名,不要对重新编码的 JSON 校验:
import hashlib, hmac
def is_signed(secret: str, raw_body: bytes, header: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header)
和所有 Anysite API 调用一样,把 API 密钥放进 access-token 请求头。结果保留 30 天。
列出你的监控及其 ID:
curl https://api.anysite.io/monitors \
-H "access-token: YOUR_API_KEY"
ACTION FOR THE HUMAN: copy your API key at https://app.anysite.io/billing — an agent cannot obtain it.
读取监控的新闻流:找到内容的已完成运行,按从旧到新排列,每次运行带有新的帖子、变化和人员,或自定义流程的条目。
curl "https://api.anysite.io/monitors/<monitor id>/news?limit=100" \
-H "access-token: YOUR_API_KEY"
ACTION FOR THE HUMAN: copy your API key at https://app.anysite.io/billing — an agent cannot obtain it.
回答的结构与 Webhook 请求体相同,只是没有 monitor_id。保存 next_cursor,下次读取时原样作为
after=<next_cursor> 传回,即可只获取新的内容;不带 after 时从保留的最早结果开始。has_more 为 true 时请立即
再次读取。limit 为 1 到 100,默认 100。
https:// 地址。401 且为 {"detail": "Token is empty"}:调用没有带 access-token 请求头,或调用的路由不接受密钥。密钥可以读取
GET /monitors、GET /monitors/<monitor id>、其结果(posts、changes、people、companies、items)、news 和
export;运行记录、设置、暂停、恢复、删除等其他路由只接受已登录的控制台。403 且为 {"detail": "Monitors are not available for guest keys"}:访客密钥不能读取监控。404 且为 {"detail": "Monitor not found"}:该 ID 不是你的监控;请从 GET /monitors 获取。422 且为 {"detail": "cursor_invalid"}:请原样传入之前回答中的 next_cursor,或去掉 after。