This document covers the trigger system that initiates workflow executions. Triggers are entry points that activate workflows in response to events such as webhook payloads, scheduled times, API calls, manual user actions, and external provider events (e.g., new emails or RSS updates).
For information about the execution engine that runs after triggers fire, see Workflow Execution Engine. For background job processing, see Background Execution & Job Queue.
The platform supports several primary trigger types, categorized by their activation mechanism and whether they require polling or push-based events.
| Trigger Type | Activation Method | Key Implementation | Polling |
|---|---|---|---|
| Starter | Standard entry point (Chat, Manual, API) | resolveExecutorStartBlock | No |
| Webhook | External HTTP POST | apps/sim/app/api/webhooks/trigger/[path] | No |
| Schedule | Cron-based recurrence | apps/sim/blocks/blocks/schedule.ts | No |
| Email/RSS | Provider-specific events | apps/sim/lib/webhooks/rss-polling-service.ts | Yes |
| Manual/API | UI Button or REST call | apps/sim/blocks/blocks/api_trigger.ts | No |
Sources: apps/sim/executor/utils/start-block.ts32-74 apps/sim/blocks/blocks/schedule.ts8-20 apps/sim/lib/webhooks/rss-polling-service.ts1-20
The following diagram illustrates the flow from an external event to the resolution of a start block within the execution engine.
Sources: apps/sim/executor/utils/start-block.ts32-74 apps/sim/lib/core/security/input-validation.ts50-160 apps/sim/executor/variables/resolver.ts39-93 apps/sim/lib/webhooks/provider-subscriptions.ts66-205
The system uses resolveExecutorStartBlock to identify the correct entry point for a workflow based on the ExecutionKind ('chat', 'manual', or 'api') and whether the workflow is a child workflow apps/sim/executor/utils/start-block.ts13-35
triggerAllowed: true or specific trigger categories apps/sim/executor/utils/start-block.ts40-58classifyStartBlockType determines the entry path (e.g., chat, webhook, api) based on block metadata and triggerModeEnabled apps/sim/executor/utils/start-block.ts85-91UnifiedStartOutput. This includes input, conversationId, and files apps/sim/executor/utils/start-block.ts259-280inputFormat. Supported types include string, number, boolean, object, and array apps/sim/executor/utils/start-block.ts136-170Sources: apps/sim/executor/utils/start-block.ts1-280 apps/sim/lib/workflows/triggers/triggers.ts1-50
Webhooks allow external services to trigger workflows via HTTP. The system handles "push" webhooks through provider-specific subscriptions.
validatePathSegment to prevent path traversal attacks apps/sim/lib/core/security/input-validation.ts50-160validateUrlWithDNS resolves hostnames to IPs and blocks private/reserved ranges apps/sim/lib/core/security/input-validation.server.ts56-121The system manages lifecycle subscriptions for external providers:
createTeamsSubscription uses the Microsoft Graph API to create chat message subscriptions with a max lifetime of 4230 minutes (~3 days) apps/sim/lib/webhooks/provider-subscriptions.ts66-185getCredentialOwner and refreshAccessTokenIfNeeded before calling provider APIs apps/sim/lib/webhooks/provider-subscriptions.ts35-60Sources: apps/sim/lib/webhooks/provider-subscriptions.ts1-205 apps/sim/lib/core/security/input-validation.ts50-160 apps/sim/lib/core/security/input-validation.server.ts56-121
The ScheduleBlock allows workflows to run based on time intervals or Cron expressions.
The block supports various frequencies via the scheduleType dropdown apps/sim/blocks/blocks/schedule.ts24-40:
0 0 * * *) apps/sim/blocks/blocks/schedule.ts118-124Intl.DateTimeFormat apps/sim/blocks/blocks/schedule.ts147-198The cronExpression sub-block includes a wandConfig, allowing the AI Copilot to generate valid cron expressions from natural language descriptions like "every weekday at 9am" using a specialized system prompt apps/sim/blocks/blocks/schedule.ts125-143
Sources: apps/sim/blocks/blocks/schedule.ts8-215
Triggers provide the initial context used by downstream blocks. The VariableResolver and BlockResolver handle these references.
isReference identifies strings like <start_block.input> apps/sim/executor/variables/resolvers/block.ts37-47resolveBlockReference parses path segments to extract specific nested data from the trigger payload apps/sim/executor/variables/resolvers/block.ts78-86function block, formatValueForCodeContext ensures the literal is correctly escaped for JavaScript or Python apps/sim/executor/variables/resolvers/block.ts213-215The handleBackwardsCompat method in BlockResolver ensures that legacy trigger output structures (specifically for response and workflow blocks) remain functional even if the internal schema evolves apps/sim/executor/variables/resolvers/block.ts106-147
Sources: apps/sim/executor/variables/resolvers/block.ts1-216 apps/sim/executor/variables/resolver.ts95-120
Sources: apps/sim/executor/utils/start-block.ts32-74 apps/sim/app/api/function/execute/route.ts1-102 apps/sim/tools/function/execute.ts72-103
Refresh this wiki