Triggers
Learn about triggers when building workflow servers using the Ebbot Integrations SDK on this page.
Triggers let your workflow server notify the Ebbot platform when something happens in the integrated system. A trigger defines a subscription type in the manifest and registers runtime routes that dispatch events to the workflow engine.
How Triggers are discovered
The workflow server scans a module (usually named fns) for functions decorated with @workflow_trigger from integrations_sdk.triggers. Each decorated function becomes a trigger in the generated manifest.
Define a Trigger
Triggers register HTTP routes on the FastAPI app and use dispatch(subscription_id, payload) to send events to subscribers.
from fastapi import FastAPI
from pydantic import BaseModel
from integrations_sdk.triggers import workflow_trigger
class HookData(BaseModel):
messageId: str
message: str
@workflow_trigger(
description="Message received",
result=HookData,
installInstructions="Docs on point, README magic",
docs="How the hook_trigger trigger works",
)
def hook_trigger(dispatch, app: FastAPI):
@app.post("/hook-trigger/{subscriptionId}")
def hook_trigger(subscriptionId: str, data: HookData):
dispatch(subscriptionId, data)Key points:
description,docs, andinstallInstructionsare surfaced in the manifest.resultis the Pydantic model or JSON schema for the dispatched payload.The inner FastAPI route is where you parse inbound events and call
dispatch.
Attach Trigger metadata
Use TriggerMetadata to include a reference to the source item that triggered the event. This is helpful when you need to track which external record a dispatch corresponds to, for example when reconciling usage for billing. You can also pass along any additional metadata that you might want to include as data.
Connection env and subscription options
Triggers can read env/secrets from the connection or from the subscription itself. This drives the subscription schema in the manifest and ensures the platform collects the right data at install time.
Connection env and secrets
Subscription options and secrets
Notes:
connectionEnv/connectionSecretspull from the connection.triggerOptions/triggerSecretsare collected per subscription.getEnv(subscription_id)resolves the correct values for that subscription.
Trigger lifecycle hooks
Use TriggerEvents to run logic when a subscription is created. This is useful for provisioning remote webhooks or storing derived configuration.
If the hook raises an exception, the subscription creation is rolled back.
Multiple Triggers on one endpoint
Use with_triggers when several triggers share a route and you want to dispatch by trigger name.
Subscription schemas in the Manifest
When you set connectionEnv / connectionSecrets or triggerOptions / triggerSecrets, the trigger's subscriptionSchema is included in the manifest so the Ebbot platform knows which values are required to install the subscription.
Runtime behavior
At runtime, the workflow server:
Resolves the subscription by ID.
Validates incoming payloads with your Pydantic models.
Dispatches events to the engine for each subscription.
If required env or secrets are missing, dispatching fails with a validation error rather than sending incomplete data.
Last updated
Was this helpful?

