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 Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

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

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay