What this sets up
You’ll configure Moltbot Gateway webhooks so an incoming request to POST /hooks/fieldy runs through a transform module (fieldy-webhook.js) before triggering an agent run.
Behavior notes (defaults in fieldy-webhook.js):
- - Saying "Hey, Fieldy" (or just "Fieldy") will trigger the agent with the text after the wake word.
- Transcripts without the wake word will not wake the agent; they’ll only be logged to JSONL files by
fieldy-webhook.js (under <workspace>/fieldy/transcripts/). - You can adjust wake words, parsing, and logging behavior by editing
fieldy-webhook.js.
1) Put the transform script in the configured transforms dir
Your hooks.transformsDir is:
INLINECODE7
Move the script from this repo:
- - From: INLINECODE8
- To: INLINECODE9
Notes:
- - Make sure the destination filename is exactly
fieldy-webhook.js (matches the config below).
2) Add the webhook mapping to ~/.clawdbot/moltbot.json
Add this config:
CODEBLOCK0
Important:
- -
hooks.token is required when hooks are enabled (see Webhooks docs). - Ensure
hooks.enabled: true exists somewhere in your config (and optionally hooks.path, default is /hooks).
3) Restart the Gateway
Plugins/config changes generally require a gateway restart. After restarting, the webhook endpoint should be live.
4) Configure the webhook URL in the Fieldy app
- - Log in to your Fieldy app
- Go to Settings → Developer Settings
- Set Webhook Endpoint URL to:
INLINECODE16
Note: Moltbot supports sending the token via header too, but many webhook providers only support query params. Moltbot still accepts ?token= (see Webhooks docs).
5) Test
Example request (adjust host/port and token):
CODEBLOCK1
此设置的功能
您将配置Moltbot Gateway的webhook,使得对POST /hooks/fieldy的传入请求在触发agent运行之前,先通过一个转换模块(fieldy-webhook.js)进行处理。
行为说明(fieldy-webhook.js中的默认设置):
- - 说Hey, Fieldy(或仅Fieldy)将触发agent处理唤醒词之后的文本。
- 不包含唤醒词的转录文本不会唤醒agent;它们仅会被fieldy-webhook.js记录到JSONL文件中(位于/fieldy/transcripts/目录下)。
- 您可以通过编辑fieldy-webhook.js来调整唤醒词、解析和日志记录行为。
1) 将转换脚本放入配置的转换目录中
您的hooks.transformsDir配置为:
/root/clawd/skills/fieldy/scripts
从本仓库移动脚本:
- - 来源:src/fieldy-webhook.js
- 目标:/root/clawd/skills/fieldy/scripts/fieldy-webhook.js
注意:
- - 确保目标文件名完全为fieldy-webhook.js(与下方配置匹配)。
2) 将webhook映射添加到~/.clawdbot/moltbot.json
添加以下配置:
json
hooks: {
token: insert-your-token,
transformsDir: /root/clawd/skills/fieldy/scripts,
mappings: [
{
match: {
path: fieldy
},
action: agent,
name: Fieldy,
messageTemplate: {{message}},
deliver: true,
transform: {
module: fieldy-webhook.js
}
}
]
}
重要提示:
- - 启用hooks时,hooks.token是必需的(参见Webhooks文档)。
- 确保配置中存在hooks.enabled: true(可选添加hooks.path,默认为/hooks)。
3) 重启Gateway
插件/配置更改通常需要重启gateway。重启后,webhook端点应处于活动状态。
4) 在Fieldy应用中配置webhook URL
- - 登录您的Fieldy应用
- 进入设置 → 开发者设置
- 将Webhook端点URL设置为:
https://your-url.com/hooks/fieldy?token=insert-your-token
注意:Moltbot也支持通过标头发送token,但许多webhook提供商仅支持查询参数。Moltbot仍然接受?token=(参见Webhooks文档)。
5) 测试
示例请求(调整主机/端口和token):
bash
curl -X POST http://127.0.0.1:18789/hooks/fieldy \
-H Authorization: Bearer insert-your-token \
-H Content-Type: application/json \
-d {transcript:Hey Fieldy summarize this: hello world}