Trigger Lifecycle Events
When a customer deploys or deletes an instance of your integration, you often need to do something in a third-party system - register a webhook, create a folder, or tear down resources. Prismatic lifecycle functions let you hook into those moments.
The three lifecycle hooks
onInstanceDeploy runs synchronously each time an instance is deployed (including re-deployments). Use it for short setup tasks like creating folders or custom record types. It must complete within 30 seconds.
webhookLifecycleHandlers.create also runs on deploy, but is specifically for registering webhooks in third-party apps. It also runs when you enter listening mode in the integration designer, making it easy to test webhook-driven flows without a full deployment. You can also trigger it manually from the Test Runner drawer using Test Deploy.
onInstanceDelete and webhookLifecycleHandlers.delete are the mirrors of their deploy counterparts - they run when an instance is deleted (or when you exit listening mode) so you can clean up whatever was created.
For longer-running setup tasks (like an initial data sync), use an Instance Deployed management trigger instead. Management triggers run as full flow executions and aren't subject to the 30-second limit.
webhookLifecycleHandlers functions don't have access to flow-scoped persisted data. Store any state you need (like a webhook ID) in crossFlowState, using the flow's stable ID to keep keys unique across flows.
Lifecycle functions run every time an instance is deployed - not just the first time. Make sure they can run multiple times safely.
Learn more
See Instance lifecycle for the full execution order, code examples, and an FAQ on when to use each hook.