v1Push Notification API

LinkClaw Push API

将 LinkClaw 作为你的 AI Agent 通知出口。任何脚本、智能体或工作流都可以通过一个 HTTP 请求, 向你的浏览器实时推送 Markdown 格式的通知消息。

🤖 给 AI Agent 的接入指令

推荐复制

将以下内容粘贴到任意 AI 的 System Prompt 或项目说明中,AI 即可自动在需要时推送通知给你:

你可以通过 LinkClaw Push API 向用户发送通知。
每当你完成重要任务、有关键发现或需要提醒用户时,调用以下接口:

POST https://linkclaw.codep.cc/api/push
Authorization: Bearer lcp_your_push_api_token
Content-Type: application/json

{
  "title": "简短标题(必填)",
  "body": "正文内容,支持 Markdown 格式(可选)",
  "url": "相关链接(可选)",
  "source": "你的名称,如 claude / trading-bot(可选)"
}

通知将实时推送到用户的 Chrome 扩展和 LinkClaw 通知中心。

适用于:Claude Projects、ChatGPT Custom Instructions、Cursor Rules、AutoGPT、n8n AI 节点等。

🔑 Push API Token

这是专为外部 Agent 接入设计的独立 Token,与浏览器扩展的 Token 完全分离。 泄露后可单独更换,不影响扩展正常使用。

Authorization: Bearer lcp_your_push_api_token

⚠️ 登录 后访问此页面可自动填入你的真实 Token,并支持一键复制和重新生成。

📤 推送消息

POST /api/push

请求格式:

POST https://linkclaw.codep.cc/api/push
Authorization: Bearer lcp_your_push_api_token
Content-Type: application/json

{
  "title": "BTC/USDT 多单成交 @ 43,250",
  "body": "## 成交详情\n\n| 方向 | 价格 | 数量 | 盈亏 |\n|---|---|---|---|\n| 多 | 43,250 | 0.1 BTC | **+$23.5** |\n\n> 当前持仓均价 42,800,浮盈 +$135 🟢",
  "url": "https://example.com/trade/12345",
  "source": "trading-bot"
}
字段 / 状态码类型说明
title必填string消息标题,显示在系统弹窗和列表中
bodystring正文内容,支持完整 Markdown(表格、代码块、粗体等)
urlstring点击通知时跳转的链接
sourcestring来源标识,用于分类显示,如 claude / trading-bot / github

成功响应:

HTTP/1.1 201 Created

{
  "id": "clxxx...",
  "title": "BTC/USDT 多单成交 @ 43,250",
  "createdAt": "2026-05-11T14:32:05.000Z"
}

💻 代码示例

cURL

curl -X POST https://linkclaw.codep.cc/api/push \
  -H "Authorization: Bearer lcp_your_push_api_token" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "任务完成",
    "body": "## 结果\n\n处理了 **150** 条记录,耗时 3.2s。",
    "source": "script"
  }'

Python

import requests

def notify(title, body=None, url=None, source=None):
    requests.post(
        "https://linkclaw.codep.cc/api/push",
        headers={"Authorization": "Bearer lcp_your_push_api_token"},
        json={"title": title, "body": body, "url": url, "source": source}
    )

# 在你的 Agent 任务完成后调用
notify(
    title="BTC/USDT 信号触发",
    body="## 信号详情\n\n- 方向:**多**\n- 入场价:43,250\n- 止损:42,800",
    source="trading-bot"
)

JavaScript / Node.js

async function notify(title, body, url, source) {
  await fetch("https://linkclaw.codep.cc/api/push", {
    method: "POST",
    headers: {
      "Authorization": "Bearer lcp_your_push_api_token",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ title, body, url, source }),
  })
}

// 示例
await notify(
  "代码审查完成",
  "发现 **3** 个问题:\n- SQL 注入风险(高危)\n- 未处理异常\n- 日志泄露",
  "https://github.com/your/repo/pulls/42",
  "claude"
)

n8n HTTP 节点配置

Method: POST
URL: https://linkclaw.codep.cc/api/push
Authentication: Header Auth
  Name: Authorization
  Value: Bearer lcp_your_push_api_token
Body (JSON):
  title: {{ $json.title }}
  body: {{ $json.body }}
  source: n8n

✍️ Markdown 格式支持

body 字段完整支持 Markdown,在通知详情页会渲染为可读 HTML。

你发送的 body:

## 成交报告

| 项目 | 值 |
|---|---|
| 价格 | **43,250** |
| 盈亏 | +$23.5 🟢 |

> 建议持仓至 45,000 目标位

渲染效果:

成交报告

项目
价格43,250
盈亏+$23.5 🟢
建议持仓至 45,000 目标位

🏷️ source 来源标识

source 字段会在通知列表中以彩色标签显示,方便区分消息来源。推荐值:

claudetrading-botgithubscriptn8n自定义字符串

⚠️ 错误码

字段 / 状态码类型说明
201Created消息推送成功
400Bad Requesttitle 为空或请求格式错误
401UnauthorizedToken 无效或未提供
402Payment Required(预留)积分不足
LinkClaw Push API v1