defineWorkflowBlockDeactivate wires a deactivate handler to a trigger block. The handler runs once when the workflow is disabled or replaced by a new version. The handler also runs when a workspace uninstalls your app, because Attio pauses all workflows that use your app. See Cleaning up on uninstall.
Mirror what activate.ts set up: typically, tear down the webhook registration with the upstream service.
Parameters
The handler function. Receives a context object with
config (typed from the block’s configSchema) and metadata.metadata mirrors what was passed to activate, including the uniqueActivationId needed to identify the registration to tear down:Errors and retries
If the handler returns{type: "error"}, Attio does not call it again. If the handler throws, Attio calls it again, for a maximum of 5 attempts. In both cases, the workflow stays paused.
Example
deactivate.ts
See also
- Registering a trigger: trigger activate handler
- Receiving a trigger event: trigger event handler
- File structure: complete folder layout for trigger and step blocks