# Set up your first OpenClaw agent webhook

Canonical: https://cwyn.com/pages/openclaw-guide-first-inbound-agent-webhook.html
Last updated: 2026-11-19T11:17:48-05:00

OpenClaw operations guide

Short answer. Enable the OpenClaw agent webhook on loopback, send a synthetic request with curl, and verify the completed run in Gateway logs. Use an installed Gateway service on the test machine. The examples assume the Gateway is bound to loopback on port 18789 and the test agent is main.

Last updated November 19, 2026

The [OpenClaw Complete Setup Pack](https://cwyn.com/pages/pack-openclaw-complete-setup-pack.html) is an optional paid kit ($14.95). Use its workspace starter files and tool-profile patches to prepare a test agent before connecting real events.

OpenClaw Complete Setup Pack $14.95

Start an OpenClaw workspace with editable instructions, local Gateway and tool presets, and checklists for pairing, memory, costs and rollback.

By CWYN · Reviewed November 19, 2026 against OpenClaw 2026.11.5

## 1. Pick one local test agent

Use an installed Gateway service on the test machine. The examples assume the Gateway is bound to loopback on port `18789` and the test agent is `main`. Confirm that the agent can answer a normal text prompt. Use an agent whose tool policy blocks external actions during this test. The [inbound webhook reference](https://docs.openclaw.ai/automation/cron-jobs/webhooks) describes how an HTTP request starts a turn.

## 2. Enable the hook for that agent

Find the active config with [`openclaw config file`](https://docs.openclaw.ai/cli/config) and merge this block. Replace `HOOK_TOKEN` with a long random token dedicated to webhooks. Use the same agent ID here and in the test request.

```
{
  hooks: {
    enabled: true,
    token: "HOOK_TOKEN",
    path: "/hooks",
    allowedAgentIds: ["main"],
    allowRequestSessionKey: false,
  },
}
```

## 3. Validate the config and watch the Gateway logs

Run these commands on the Gateway host. Correct any validation error before restarting. Leave the log view open for the test.

```
openclaw config validate
openclaw gateway restart
openclaw logs --follow
```

## 4. Send one test request on loopback

Use another terminal on the same host. Set `OPENCLAW_HOOK_TOKEN` in that terminal without saving the token in shell history, then adjust the port if needed. The synthetic message needs no tools or external delivery. `deliver: false` suppresses the announcement. Tool restrictions come from the agent policy.

```
curl --include http://127.0.0.1:18789/hooks/agent \
  -H "Authorization: Bearer $OPENCLAW_HOOK_TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: webhook-smoke-001' \
  --data '{"message":"Summarize this test event: the sample import completed.","name":"Webhook smoke test","agentId":"main","deliver":false}'
```

## 5. Match the admitted run to a completed run

Look for HTTP `200` and a `runId`. That records admission. Find `hook agent run completed` with the same ID in the Gateway logs and check for `status=ok`. No chat announcement is expected for this test.

[Get your free CWYN Score](https://cwyn.com/pages/score.html)

## Related guides

- [OpenClaw webhook 200 but no reply? Check delivery](https://cwyn.com/pages/openclaw-guide-webhook-no-reply.html)
- [Limit tools for one OpenClaw agent](https://cwyn.com/pages/openclaw-guide-per-agent-tool-profile.html)
- [OpenClaw automation error: agentId outside caller scope](https://cwyn.com/pages/openclaw-guide-automation-agent-outside-caller-scope.html)
- [Set up your first OpenClaw cron job](https://cwyn.com/pages/openclaw-guide-first-openclaw-cron-job.html)

## Next steps

- [All 135 OpenClaw guides](https://cwyn.com/guides/openclaw/)
- [OpenClaw setup walkthrough](https://cwyn.com/setup/openclaw/)
- [CWYN Score](https://cwyn.com/pages/score.html)
- [OpenClaw Complete Setup Pack ($14.95)](https://cwyn.com/pages/pack-openclaw-complete-setup-pack.html)
