DEV Community

Cover image for Automatically trigger Netlify Functions on specific events
Phil Hawksworth for Netlify

Posted on • Originally published at netlify.com

1

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 or explore the examples and tutorials in the functions playground

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more