with one click
iii-custom-triggers
// Builds custom trigger types for events iii does not handle natively. Use when integrating webhooks, file watchers, IoT devices, database CDC, or any external event source.
// Builds custom trigger types for events iii does not handle natively. Use when integrating webhooks, file watchers, IoT devices, database CDC, or any external event source.
Browser SDK for connecting to the iii engine from web applications via WebSocket. Use when building browser-based clients that register functions, invoke triggers, or consume streams from the frontend.
Binary streaming between workers via channels. Use when building data pipelines, file transfers, streaming responses, or any pattern requiring binary data transfer between functions.
Registers cron triggers with 7-field expressions to run functions on recurring schedules. Use when scheduling periodic jobs, timed automation, crontab replacements, cleanup routines, report generation, batch processing, or calendar-based work that is genuinely time-driven.
Configures the iii engine via iii-config.yaml — workers, adapters, queue configs, ports, and environment variables. Use when deploying, tuning, or customizing the engine.
Handle iii engine and SDK errors across Node, Python, Rust, and browser workers. Use when interpreting error codes, retryability, RBAC denial, timeouts, handler failures, or SDK-specific exception surfaces.
Registers functions and triggers on the iii engine across TypeScript, Python, and Rust. Use when creating workers, registering function handlers, binding triggers, or invoking functions across languages.
| name | iii-custom-triggers |
| description | Builds custom trigger types for events iii does not handle natively. Use when integrating webhooks, file watchers, IoT devices, database CDC, or any external event source. |
Comparable to: Custom event adapters, webhook receivers
Use the concepts below when they fit the task. Not every custom trigger needs all of them.
registerTriggerType({ id, description }, handler) defines a new trigger type with registerTrigger and unregisterTrigger callbacksid, function_id, config, and optional metadataiii.trigger({ function_id, payload: event }) to invoke the registered functionhttp, cron, durable:subscriber, state, stream, subscribeExternal event source (webhook, file watcher, IoT, CDC, etc.)
→ Custom trigger handler (registerTriggerType)
→ iii.trigger({ function_id, payload: event })
→ Registered function processes the event
| Primitive | Purpose |
|---|---|
registerTriggerType({ id, description }, handler) | Define a new trigger type with lifecycle hooks |
unregisterTriggerType(id) | Clean up a custom trigger type |
TriggerConfig: { id, function_id, config, metadata? } | Configuration passed to the trigger handler |
iii.trigger({ function_id, payload: event }) | Fire the registered function when the event occurs |
See ../references/custom-triggers.js for the full working example — a custom trigger type that listens for external events and routes them to registered functions.
Also available in Python: ../references/custom-triggers.py
Also available in Rust: ../references/custom-triggers.rs
Code using this pattern commonly includes, when relevant:
registerWorker(url, { workerName }) — worker initializationiii.registerTriggerType({ id, description }, { registerTrigger, unregisterTrigger })iii.register_trigger_type({ "id": id, "description": description }, TriggerHandlerSubclass())iii.register_trigger_type(RegisterTriggerType::new(id, description, handler))registerTrigger(config) / register_trigger(config) is invoked by the engine when a trigger instance is registeredunregisterTrigger(config) / unregister_trigger(config) is invoked when that trigger instance is removediii.trigger({ function_id: config.function_id, payload: eventPayload }) — fire the target functionunregisterTrigger (close connections, remove listeners, clear intervals)const logger = new Logger() — structured loggingconfig.id.registerTrigger, not in module top-level code.unregisterTrigger so deleted triggers do not leak timers or connections.config.iii.trigger().condition_function_id, let the trigger dispatch path evaluate the condition before invoking the target function.trigger_request_format and call_request_format schemas where the SDK supports them, so discovery and generated skills know the config and handler payload shapes.Use the adaptations below when they apply to the task.
file-watcher, mqtt, db-cdc)registerTrigger, start the listener (open socket, receive webhook, subscribe to topic, attach watcher, or consume CDC)unregisterTrigger, tear down the listener to avoid resource leaksconfig.id for clean unregistrationiii.trigger({ function_id, payload: event })iii-http-endpoints.iii-cron-scheduling.iii-queue-processing.iii-custom-triggers when iii has no built-in trigger type for the event source.iii-custom-triggers in the iii engine.