Hook event types
The Studio service supports 7 different hook event types:- after_event_pulled - After an event is successfully pulled from device
- after_all_events_pulled - After all events in a batch are processed
- after_event_processed - After an event is processed and stored
- after_thumbnail_generated - After a thumbnail is generated for an event
- on_file_detected - When a new file is detected in the incoming directory
- on_error - When an error occurs during processing
- on_service_start - When the media service starts for a device
List hooks
GET /api/hooks
List all hooks with optional device filtering
Query parameters
Filter hooks by device ID. Omit to get all hooks.
Response
Returns an array of hook objects.Unique hook identifier
Hook event type
Action name to execute
Device ID for device-specific hooks, or null for global hooks
Whether the hook is active
Parameters to pass to the action
Example request
Create hook
POST /api/hooks
Create a new event hook
Request body
Hook event type. Must be one of the 7 supported event types.
Name of the action to execute when the event occurs
Device ID for device-specific hook. Omit for global hook that applies to all devices.
Whether the hook is active
Parameters to pass to the action. Supports template variables.
Response
ID of the created hook
Indicates if creation was successful
Example: Create device-specific hook
Example: Create global hook
Update hook
PATCH /api/hooks/:id
Update an existing hook
Path parameters
Hook identifier
Request body
Hook event type
Action name to execute
Whether the hook is active
Parameters to pass to the action
Response
Indicates if update was successful
Example request
Delete hook
DELETE /api/hooks/:id
Delete a hook
Path parameters
Hook identifier
Response
Indicates if deletion was successful
Example request
Get hooks by event type
GET /api/hooks/events/:eventType
Get all hooks for a specific event type
Path parameters
Event type to filter by
Response
Returns an array of hook objects matching the event type.Example request
Parameter templating
Hook parameters support dynamic template variables that are automatically replaced with context values:{{device_id}}- Current device ID{{event_name}}- Event filename{{media_type}}- Media type (image, video, audio, etc.){{file_path}}- Full file path{{timestamp}}- Current timestamp{{date}}- Current date in YYYY-MM-DD format
Example with templates
Hook execution flow
- Event occurs - Media processing triggers an event
- Hook lookup - System finds all enabled hooks for the event type
- Device filtering - Applies device-specific and global hooks
- Parameter injection - Replaces template variables with actual values
- Action execution - Calls the configured action with parameters
- Error handling - Logs failures but doesn’t interrupt processing