webhook-transforms
它能做什么
这项技能为外部服务设置一种向你的知识库发送事件的方式。每个事件都会被转换为一个页面,并注明来源;转换失败的事件会被保存下来,而不是丢失。
适用场景
- ✓当你希望短信、会议结果或社交媒体提及自动保存到知识库的时候。
- ✓当你想定义一个外部事件应如何转换为知识库页面时。
- ✓当某个事件的转换失败时,你需要检查它的后续处理情况。
技能链接
https://github.com/garrytan/gbrain/blob/master/plugin/skills/webhook-transforms/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把录音应用发给我的每份会议摘要都保存为我知识库中的一个页面,并保留所有转换失败的事件。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会定义一个转换步骤,把事件数据转换为知识库页面,然后注册一个外部服务可以调用的地址。如果转换失败,原始数据会保存到一个暂存文件夹中,并重试一次。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Webhook Transforms
Contract
This skill guarantees:
- External events are transformed into brain pages with proper citations
- Raw payloads are preserved (dead-letter queue if transform fails)
- Entity extraction runs on every transformed event
- Input sanitization: no raw HTML/script passes to brain pages
- Error handling: transform failure logs raw payload, retries once
Phases
Define transform. Map event schema to brain page format:
- Input: raw webhook payload (JSON)
- Output: brain page content (markdown) + metadata (slug, type, citations)
- Must sanitize: strip HTML tags, escape script content
Register webhook URL. Provide the external service with the webhook endpoint.
On event received:
- Parse payload
- Run transform function
- Write brain page via
gbrain put - Extract entities, run enrichment
- Add timeline entries to mentioned entities
- Sync:
gbrain sync
Error handling:
- If transform throws: log raw payload to
_dead-letter/{timestamp}.md - Surface error type to agent
- Retry once
- Don't lose events
- If transform throws: log raw payload to
Example Transforms
SMS Received
Input: {from: "+1555...", body: "Meeting moved to 3pm", timestamp: "..."}
Output: Timeline entry on sender's brain page + task update if action item detected
Meeting Completed
Input: {title: "Weekly sync", attendees: [...], transcript: "...", summary: "..."}
Output: Delegate to meeting-ingestion skill
Social Mention
Input: {platform: "twitter", author: "@handle", text: "...", url: "..."}
Output: Brain page in media/ + entity extraction + backlinks
Output Format
Event transformed and written to brain. Report: "Webhook: {event_type} from {source} → {brain_page_path}"
When it fails
Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:
- A transformed write returns
write_pending(exit 10): the event is accepted; record the request id and poll it, never replay the event under a new id. source_binding_required/insufficient_scope: the webhook's token cannot write that source; tell the user which grant the brain host's operator must add.- A malformed payload: reject it with the parse error and log it; do not write a partial page.
Anti-Patterns
- Passing raw HTML/script to brain pages (XSS risk)
- Silently dropping events when transform fails (use dead-letter queue)
- Processing webhooks without entity extraction
- Not sanitizing external input before brain writes
常见问题
转换失败会怎样?
原始事件会被保存到暂存文件夹中,并重试一次,因此事件不会丢失。
网页内容在保存前会被清理吗?
会。HTML 和脚本内容会被去除,因此知识库页面中不会出现原始代码。
传入的事件会链接到人员和公司吗?
会。技能会对每个事件运行实体识别,并在相关人员的时间线中添加条目。
详情
作者的原始描述
Generic framework for converting external events (SMS, meetings, social mentions) into brain-ingestible signals. Define a transform function, register a webhook URL, and incoming events get processed through the brain pipeline.
repo: garrytan/gbrain
热度
- GitHub 星标
- 31k
- 排名
- #9318
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …