defineWorkflowBlockTrigger wires an event handler to a trigger block. The handler runs once for each incoming request to metadata.triggerCallbackUrl, the URL registered with the upstream service during activation.
Here you decide whether the event should start a workflow run, and (if so) what outcome data to send into the workflow.
Parameters
The block returned by
defineWorkflowBlock in block.ts.The handler function. Receives the raw
req (a standard Request object) and a context object with config (typed from the block’s configSchema) and metadata.metadata provides workflow identity context for the incoming event:| Field | Type | Description |
|---|---|---|
workflowId | string | ID of the workflow this block belongs to. |
workflowVersionId | string | ID of the active workflow version. |
workflowBlockId | string | ID of this block instance within the workflow. |
uniqueActivationId | string | ID of the activation that registered this callback. Matches the value passed to activate. |
triggerCallbackUrl | string | The URL incoming events are sent to. |
workflowTitle | string | Human-readable title of the workflow. |
workflowUrl | string | Link to the workflow in the Attio UI. |
Example
trigger.ts
See also
- Registering a trigger: trigger activate handler
- Outcome schema: typing the data field in return values
- File structure: complete folder layout for trigger and step blocks