Trigger
poll() runs inside the plugin’s sandbox worker, invoked over
JSON-RPC (trigger.poll). Read How plugins run
for the execution model — network posture, logging to stderr, and file
callbacks all apply here too.The interface
A trigger subclassesBasePollingTrigger[ConfigType] and implements poll.
Class attributes
ConfigType is your TriggerConfiguration subclass (a NodeConfiguration, so its fields are Parameter(...) with optional display= widgets, just like a node’s config). It reaches your instance as self.config.
poll contract
stateis whatever your previouspollreturned as its second element (an empty dict on the first poll). Use it as a cursor — a last-seen id, a timestamp, a page token.- Return
(events, new_state).eventsis a list of JSON-serializable dicts; each dict’s fields become the trigger inputs for one workflow run. Return[]when nothing is new.new_stateis persisted by the platform and handed back on the next poll.
outputs map tells the editor which fields the event carries so they can be bound to workflow inputs.
Using credentials
If a trigger needs to authenticate to an external service, declare the credential type(s) it uses and read them fromctx:
BaseIntegration / BaseCredentials pair in the same plugin — see Creating integrations.
Registering the trigger
Return your trigger classes from the plugin’striggers() method:
TriggerDefinition) at packaging time. Regenerate manifest.json whenever a trigger’s name, config, or outputs change.
A plugin must provide at least one node, integration, or data source —
triggers alone don’t make a valid plugin. Ship a trigger alongside the node or
integration it drives.
Testing
-
Locally,
noxus plugin serveexercises your plugin’s surfaces, excepttrigger.poll— polling is driven only by the platform, so the local dev server does not expose it. Testpolldirectly instead: -
End to end, install the plugin against a running stack and let the platform schedule the poll and create runs. The reference plugin in
tests/plugins/and itsrun_plugin_e2e.pydriver exercise a trigger this way.
Related
How plugins run
The sandbox execution model behind
trigger.poll.Creating integrations
Define the credentials a trigger reads from
ctx.