Trigger Flows When External Systems Change State
For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append.mdto anykestra.io/docs/*URL for plain Markdown.
Trigger flows automatically by polling external systems for new data or events.
Polling triggers repeatedly check an external system at a fixed interval. When new data or events are detected, they automatically start a new flow execution.
Kestra provides polling triggers for a wide variety of systems, including databases, message queues, cloud storage, and FTP servers.
Polling triggers are not limited to external connectors. Some plugins also provide script-based polling triggers, allowing you to run code on an interval and emit only when a condition matches. The script plugins for Python, Shell, and JavaScript each provide ScriptTrigger and CommandsTrigger variants for polling with code or commands.
The polling frequency is controlled by the interval property. When triggered, the flow has access to the polling results through the trigger variable, making the retrieved data immediately available for downstream tasks.
Example
For example, the following flow polls a PostgreSQL table every 5 minutes. When new rows are available, it deletes them (to prevent duplicate processing) and logs the retrieved values.
id: jdbc-triggernamespace: company.team
inputs: - id: db_url type: STRING
tasks: - id: update type: io.kestra.plugin.jdbc.postgresql.Query url: "{{ inputs.db_url }}" sql: DELETE FROM my_table
- id: log type: io.kestra.plugin.core.log.Log message: "{{ trigger.rows }}"
triggers: - id: watch type: io.kestra.plugin.jdbc.postgresql.Trigger url: myurl interval: "PT5M" sql: "SELECT * FROM my_table"Like all triggers, polling triggers support a when Pebble expression. When set, the trigger only creates an execution if when evaluates to true after new data is detected — useful for filtering results before the flow runs.
In Enterprise Edition, you can assign polling triggers to a specific Worker Queue using workerSelector.tags. This controls which workers execute the polling.
Browse the plugin catalog and filter by Trigger to see all available polling triggers, including file detection, database, and message queue variants.
Enterprise example
In Enterprise Edition, the Salesforce Trigger enables flows to start automatically when new records are created in Salesforce. For example, the flow below sends a Slack notification whenever a new contact is added.
id: salesforce_contact_triggernamespace: company.salestasks: - id: notify_sales_manager type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook url: "{{ secret('SLACK_WEBHOOK_URL') }}" messageText: "New contact created"
triggers: - id: new_contact_trigger type: io.kestra.plugin.ee.salesforce.Trigger interval: "PT5M" connection: username: "{{ secret('SALESFORCE_USERNAME') }}" password: "{{ secret('SALESFORCE_PASSWORD') }}" authEndpoint: "{{ secret('SALESFORCE_AUTH_ENDPOINT') }}" query: "SELECT Id, FirstName, LastName, Email, Phone, Company, CreatedDate FROM Contact WHERE CreatedDate >= LAST_N_MINUTES:5"Was this page helpful?