Aperçu

Set chat hooks

POST/api/v1/set_chat_hooks
Features

Set pre-, post-, and streaming webhook URLs for the AI chatbot. Pass empty string to clear an individual hook.

Price — $0.00001 per call (twice what serving it costs us), charged to the workspace balance, the same as over MCP.

Also reachable by name at POST /api/v1/tools/set_chat_hooks.

Input3
Authorizationheaderrequired
Your API key, sent as Authorization: Bearer dbk_YOUR_API_KEY.Sent from your browser straight to the API — never to Docsbook, never stored.
pre_urlstring · body
Pre-LLM hook URL — receives {question, session_id, workspace_id}, may return {block, reason} or {inject_context}
post_urlstring · body
Post-LLM hook URL — fire-and-forget POST with {question, answer, tool_calls, latency_ms}
streaming_urlstring · body
Streaming events webhook URL — fire-and-forget SSE-style events
Output3
okboolean
Whether the tool itself succeeded. A tool that ran and refused — an exhausted balance, a plan restriction, a bad argument — answers 200 with ok: false: the call was made and billed, and that refusal is its answer.
resultobject
The tool's own JSON answer, already parsed — not a string to parse a second time.
Show child attributes5
statusstring
workspace_idnumber
ai_chat_pre_hook_urlstring
null
ai_chat_post_hook_urlstring
null
ai_chat_streaming_webhook_urlstring
null
duration_msinteger
Server-side wall time for the call.
Limitations
  • REQUIRES the PRO plan or above.
Responses
200The tool ran. Read ok to see whether it succeeded.
401Missing or invalid API key.
Example input
curl -X POST 'https://docsbook.io/api/v1/set_chat_hooks' \
  -H 'Authorization: Bearer dbk_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{}'
Example output
{
  "ok": true,
  "result": {
    "status": "<status>",
    "workspace_id": 0,
    "ai_chat_pre_hook_url": "<ai_chat_pre_hook_url>",
    "ai_chat_post_hook_url": "<ai_chat_post_hook_url>",
    "ai_chat_streaming_webhook_url": "<ai_chat_streaming_webhook_url>"
  },
  "duration_ms": 0
}

Mis à jour

Cette page vous a-t-elle été utile ?