Event functions run automatically when Nango reaches a connection lifecycle event. They are defined withDocumentation Index
Fetch the complete documentation index at: https://nango.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
createOnEvent().
Use them to validate credentials, register provider webhooks, seed connection-specific metadata, or clean up external resources before a connection is deleted.
Choose the lifecycle event
Supported events:| Event | When it runs | Common use |
|---|---|---|
validate-connection | During connection creation | Reject invalid credentials or missing provider permissions |
post-connection-creation | Immediately after a connection is created | Register provider webhooks, seed metadata, run setup checks |
pre-connection-deletion | Before a connection is deleted | Delete provider webhook subscriptions or external resources |
For agents
For agents
Before generating an event function, identify the lifecycle event, provider endpoint, required metadata, and desired failure behavior.For
validate-connection, throwing rejects and deletes the connection. For cleanup functions, make the provider call idempotent because the external resource may already be gone.Create a setup function
Add a file under the integration’son-events/ folder:
salesforce/on-events/register-webhook.ts
index.ts:
index.ts
Create a cleanup function
If the provider webhook is registered per connection, clean it up before the Nango connection is deleted:salesforce/on-events/delete-webhook.ts
index.ts:
index.ts