This page looks best with JavaScript enabled

How to Send Messages to OpenClaw Remotely

 ·  ☕ 1 min read

1. Configure hooks

  • Configure hooks in openclaw.json
1
2
3
4
5
6
7
  "hooks": {
    "enabled": true,
    "token": "xxx",
    "path": "/openclaw/hooks",
    "allowRequestSessionKey": true,
    "allowedAgentIds": ["*"]
  },

See https://docs.openclaw.ai/automation/webhook

The token here must not be the same as the gateway’s token.

2. Sending a message

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
curl --location 'https://xxx.com/openclaw/hooks/agent' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer xxx' \
--data '{
  "message": "Introduce yourself, and send the message to https://xxx.com/api/v1/webhook/send?key=xxx",
  "agentId": "main",
  "sessionKey": "hooks-api-002",
  "wakeMode": "now",
  "deliver": true,
  "thinking": "low",
  "timeoutSeconds": 120
}'

Because the request above is asynchronous, the response contains only a runId, and there is no interface to query the result, so have OpenClaw send the result to the specified webhook address.


WeChat Official Account
WRITTEN BY
WeChat Official Account