{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jambonz.org/schema/components/actionHook",
  "title": "ActionHook",
  "description": "A webhook or websocket callback that jambonz invokes when a verb completes. Reports verb results (e.g. speech recognition from 'gather', dial outcome) and receives the next verbs to execute. In webhook mode: jambonz POSTs to this URL and the HTTP response body is the next verb array. In WebSocket mode: this value becomes an event name emitted on the session — bind session.on('/hookName', (evt) => {...}) and respond with session.reply() (NOT session.send()). The callback payload always includes 'reason' plus verb-specific fields (e.g. 'speech', 'digits' for gather). Can be a simple URL/path string or an object with additional options.",
  "oneOf": [
    {
      "type": "string",
      "format": "uri",
      "description": "A URL to invoke. For webhook applications this is an HTTP(S) URL. For websocket applications this is typically a relative path or event name.",
      "examples": ["https://myapp.example.com/gather-result", "/gather-result"]
    },
    {
      "type": "object",
      "description": "A hook specification with URL and additional options.",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "The URL to invoke."
        },
        "method": {
          "type": "string",
          "description": "The HTTP method to use. Only applies to webhook applications.",
          "enum": ["GET", "POST"],
          "default": "POST"
        },
        "basicAuth": {
          "$ref": "auth",
          "description": "Basic authentication credentials to include in the request."
        }
      },
      "required": ["url"]
    }
  ]
}
