onExecution function that implements the flow’s business logic.
Create a flow with the flow() helper and add it to the flows array of your integration() call.
Flow types
- Standard flow
- Polling flow
A standard flow is triggered by an inbound webhook request or a schedule. It can optionally define a custom
onTrigger function; if omitted, Prismatic provides a default HTTP trigger.Required fields
The display name for this flow in the Prismatic UI.
A permanent, unique identifier for this flow. Changing
name is safe as long as stableKey stays the same. Never reuse a stableKey within the same integration.The main function invoked when this flow runs. Receives
context (config vars, component actions, logger, etc.) and params (trigger payload accessible via params.onTrigger.results).Optional fields
A human-readable description shown in the Prismatic UI.
Defaults to
standard. Set to 'polling' to enable polling context. Requires schedule and onTrigger.Cron expression or config variable reference for scheduled execution. Required when
triggerType is 'polling'. Can include an optional timezone field.When
true, the platform waits for onExecution to complete and returns its result as the HTTP response body. Defaults to false.Marks this flow as an AI agent flow exposed on the integration’s MCP server. Defaults to
false.Custom trigger function or a reference to a component trigger. If omitted on standard flows, Prismatic’s default HTTP trigger is used.
Retry policy for the flow. See RetryConfig.
Execution queue behavior. See QueueConfig.
Security model for this flow’s webhook endpoint. Defaults to
'customer_optional'. See Endpoint security.Static API keys used when
endpointSecurityType is 'organization'.Marks this flow as the preprocess flow for the integration. Only one flow per integration may set this. See Endpoint configuration.
Default error handling behavior for steps in this flow. See StepErrorConfig.
JSON Schema definitions for flow inputs and outputs. Used with AI agent flows.
onTrigger vs omitting it
For most webhook-driven flows you do not need to define onTrigger. The default HTTP trigger:
- Accepts any HTTP method.
- Parses JSON, form data, and raw bodies automatically.
- Returns
200 OKimmediately (or theonExecutionresult ifisSynchronous: true).
onTrigger when you need to:
- Validate an HMAC signature before execution proceeds.
- Transform the raw payload before
onExecutionsees it. - Return a custom HTTP response regardless of
isSynchronous. - Reference a component trigger (e.g., an OAuth token refresh trigger).
Lifecycle hooks
onInstanceDeploy and onInstanceDelete
These optional functions run when a customer deploys or removes an instance of the integration. Use them to register or clean up external resources.
webhookLifecycleHandlers
Use webhookLifecycleHandlers to register and deregister webhooks on a third-party system when the flow’s webhook URL is created or destroyed.
RetryConfig
Configure automatic retries when a flow execution fails.Maximum number of retry attempts. Must be between 0 and 10.
Minutes to wait before each retry. Must be between 0 and 60.
When
true, the delay doubles with each failed attempt.Field name in the trigger payload used as a unique request ID. Duplicate executions with the same ID are cancelled before the retry runs.
QueueConfig
Control how concurrent executions are queued. Choose one of the four variants:- parallel
- throttled
- sequential
- standard
All incoming requests execute simultaneously with no concurrency cap.
StepErrorConfig
Define default error handling at the flow level. Individual steps can override this.fail— Abort the execution and mark it failed.ignore— Log the error and continue to the next step.retry— Retry the failing step up tomaxAttemptstimes.
Maximum retry attempts for a failing step. Must be between 0 and 5. Only relevant when
errorHandlerType is 'retry'.Seconds to wait between step retries. Must be between 0 and 60.
When
true, delay doubles with each retry. Defaults to false.When
true, ignores the error after all retry attempts are exhausted. Defaults to false.Endpoint security types
TheendpointSecurityType field controls what callers must provide when invoking a flow’s webhook endpoint.
| Value | Behavior |
|---|---|
unsecured | No authentication required. Any caller can invoke the endpoint. |
customer_optional | Customers may optionally provide an API key. Default. |
customer_required | Callers must supply a valid customer-specific API key. |
organization | Callers must supply one of the keys listed in organizationApiKeys. |
Accessing trigger data
InsideonExecution, the trigger payload is available at params.onTrigger.results. The TriggerPayload type exposes:
| Field | Type | Description |
|---|---|---|
headers | Record<string, string> | HTTP headers from the inbound request |
queryParameters | Record<string, string> | URL query string parameters |
rawBody.data | unknown | Unparsed request body |
body.data | unknown | Parsed request body |
pathFragment | string | Extended path info after the webhook URL |
webhookUrls | Record<string, string> | Webhook URLs for each flow in this instance |
webhookApiKeys | Record<string, string[]> | API keys per flow |
invokeUrl | string | The URL used for this invocation |
customer | CustomerAttributes | Customer details |
instance | InstanceAttributes | Instance details |
flow | FlowAttributes | Flow details |
startedAt | string | UTC timestamp when execution started |
