Webhooks

Receive inbound events from external systems into DocsChat.

Requirements

  • Standard+ plan (apiAccess)
  • Workspace webhook secret (shown in Admin → API settings)

Authentication

Every request must include:

x-webhook-secret: YOUR_WORKSPACE_SECRET

Missing or invalid secret → 401.

Endpoint

POST /api/webhooks/inbound
x-webhook-secret: whsec_xxxxx
Content-Type: application/json

{
  "event": "chat.message",
  "sessionId": "clxx...",
  "message": "User message from external system"
}

Response 200

{
  "received": true,
  "workspaceId": "..."
}

Supported events

EventBehavior
chat.messageAppends USER message to session if session belongs to workspace
OtherLogged; acknowledged

Extend the handler in src/app/api/webhooks/inbound/route.ts for custom events.

Secret rotation

  1. Generate a new secret for the workspace
  2. Update integrator configuration
  3. Monitor logs for 401 from the old secret
  4. Remove the old secret after a grace period

Never commit webhook secrets to version control.

Plan enforcement

Free and Hobby workspaces receive 403 — upgrade to Standard+.

Related