Guides & Tutorials
Automatically trigger Netlify Functions on specific events
Throughout December we'll be highlighting a different Netlify feature each day. It might just be the thing you need to unlock those creative juices, and dust off that domain you registered but never deployed! Keep an eye on the blog and on Twitter for each feature!
Netlify Functions can be triggered via your UI with a user event like clicking a button, or visiting directly the endpoint /.netlify/functions/<your function name>
in your browser, but we've also made available what we call event-driven functions.
"What is this?", I hear you ask.
There are some events happening when you use Netlify that can automatically trigger a function.
For example, if you have a Netlify Form on your site, you can trigger a function automatically when receiving a new submission, simply by naming your function file submission-created.js
. That's all!
The events currently working with this feature are:
- deploy-building
- deploy-failed
- deploy-locked
- deploy-succeeded
- deploy-unlocked
- identity-login
- identity-signup
- identity-validate
- split-test-activated
- split-test-deactivated
- split-test-modified
- submission-created
You could use them to notify co-workers when your app's deploys are locked, or when a deploy fails, when a user signs up, and more!
If you'd like more information about Netlify Functions, check out our docs.