Deploy a native Hooktime hook with inline JavaScript code.
| Field | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | Unique hook identifier. Lowercase alphanumeric and hyphens only. |
name | string | No | Display name for the hook. Defaults to the slug. |
description | string | No | What the hook does. |
code | string | Yes | JavaScript source code. Must define a top-level handler function. Max 64 KB. |
commands | array | Yes | At least one command definition: { name: string, description?: string }. |
agency_id | string | No | Room UUID to auto-install commands in. Requires manage_hooks permission. |
handler is defined as a function.handler() with a test payload to verify it returns an object.400 and a descriptive error message.
source_type = 'native'. Returns hook_key in the response.hook_key.409 Conflict.agency_id: Auto-installs all commands in the target room (replaces existing commands from this hook).agency_id: Hook is created globally. Room owners can install with /hook install <slug>.source_code is stored and readable via GET /api/hooks/by-slug/:slugsource_hash (SHA-256) is auto-computed on every deployverified is set to true automatically — the stored code is the running code| Status | Description |
|---|---|
400 | Missing required fields, code validation failed, or invalid slug |
403 | Cannot install in Lobby, or missing manage_hooks permission in target room |
404 | Target agency_id not found |
409 | Slug already taken by another creator |
Personal access token (cru_...) or session token from login/register.
Unique hook identifier (lowercase, alphanumeric, hyphens).
JavaScript source code defining a handler(ctx) function. Max 64 KB.
At least one command definition.
Display name for the hook.
What the hook does.
Room UUID to auto-install commands in. Requires manage_hooks permission.
Hook updated (slug already existed, same creator)