Callbacks
Callback reference for fylr plugins — the hooks fylr runs during its own API calls, how a callback program is executed, and how data flows in and out.
Callbacks are predefined hooks in fylr's API. When fylr handles a save, a workflow transition, a collection upload or an export, it runs the plugin program registered for that hook, hands it the relevant data, and reads back the plugin's result. Each hook has its own input and output format — the sub-pages of this section are the reference, one page per hook:
callbacks.transition_db_pre_save.<name>
as an action of a workflow transition, before the save
collection_upload.<name> (top level)
when files are uploaded into a collection (hotfolder, WebDAV, /api/v1/eas?collection=…)
callbacks.export_transport.<procedure>
once per transport, after an export has finished
All hooks share one callback contract — the info map with API URLs and access tokens, the plugin_user mechanism, and the error format.
How a callback program runs
Every callback (and every extension) is described by the same exec map in the manifest. fylr runs the program through the execserver: the service names the runtime (node, python3, exec for standalone binaries, …), and commands lists the programs to run.
Commands run sequentially in a transient working directory; the chain stops at the first failing command. The plugin's own files are not in that directory — reference them with the
%_exec.pluginDir%placeholder.The payload arrives on STDIN when the command declares
stdin: { type: body }.The response is read from STDOUT when the command declares
stdout: { type: body }.The context (
infomap) can additionally be passed as a command argument with the%info.json%placeholder — it is substituted as an inline JSON string, not a file path.STDERR is not part of the response — programs use it for diagnostics.
exec:
service: "node"
commands:
- prog: "node"
stdin: { type: body } # the callback payload, as JSON
stdout: { type: body } # the callback response, as JSON
args:
- type: "value"
value: "%_exec.pluginDir%/server/my_callback.js"Timeouts
A callback job must finish within the configured plugin job timeout — fylr.execserver.pluginJobTimeoutSec, default 2400 seconds (40 minutes); 0 is not unlimited but 30 seconds. A single callback sets its own limit in its manifest entry with exec.timeout, a duration string such as "2h" (the older exec.timeoutSec in seconds still works; "0" or no value means the plugin job timeout). A command's timeoutSec limits that one command, within the job's limit. The execserver also stops a command that shows no progress for ten minutes (see Execution limits); exec.stallTimeout (for example "20m", "0" turns it off) changes that for the callback.
Before it runs, the callback waits for a free execserver slot, for at most fylr.execserver.connectTimeoutSec (default 120 seconds); the wait does not count toward the job timeout. A callback that gets no slot in that time does not run, and the operation fails as on a callback error: a save, a workflow transition or a collection upload is rejected with DbPreSaveFailed (HTTP 400), an export fails. When none of the configured execservers can be reached, the callback fails at once.
Errors
A callback signals an error by exiting non-zero, or by writing an API-error JSON wrapped under a top-level error key (in which case a zero exit code is fine). The callback contract page describes the format; each hook's page describes what an error does to the running operation (a pre-save error aborts the whole save, an export error fails the export, …).
A minimal callback plugin
manifest.yml — register one db_pre_save step:
server/touch.js — read the payload, change nothing:
Read next
The callback contract — the
infomap, access tokens,plugin_user, errors.db_pre_save — validate or modify objects on every save.
transition_db_pre_save — hook into workflow transitions.
Workflow Webhooks — the same hooks over plain HTTP, without a plugin.
Collection upload — participate in hotfolder / WebDAV / collection uploads.
export and export_transport — post-process and deliver exports.
manifest.yml — the
execmap and placeholders in detail.
Last updated