# How do you implement event-triggered functions?

**URL:** <https://answers.netlify.com/t/how-do-you-implement-event-triggered-functions/2856>\
**Category:** Support\
**Tags:** lambda-functions\
**Created:** [August 20, 2019, 12:26am UTC](https://answers.netlify.com/t/how-do-you-implement-event-triggered-functions/2856 "2019-08-20T00:26:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicmeriano](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nicmeriano/32/1427_2.png) [@nicmeriano](https://answers.netlify.com/u/nicmeriano)\
**Post date:** [August 20, 2019, 12:26am UTC](https://answers.netlify.com/t/how-do-you-implement-event-triggered-functions/2856/1 "2019-08-20T00:26:57Z")

</div>

I’d like to create a function that runs only once every time my site is deployed. This function would make some API requests and write the response to a database (Firestore) from which my React app can retrieve and use the data without making additional/unnecessary API calls. After reading the docs I still don’t understand how to implement such a function. Also, since I’d like to update my database once a day, are there any limits to how many times I can deploy my site?

Thanks!

---

<div class="post-metadata">

**Author:** ![TravisBallard](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/travisballard/32/2215_2.png) [@TravisBallard](https://answers.netlify.com/u/TravisBallard)\
**Post date:** [August 21, 2019, 4:31pm UTC](https://answers.netlify.com/t/how-do-you-implement-event-triggered-functions/2856/2 "2019-08-21T16:31:35Z")

</div>

What I did was create a NodeJS script and that then added a script to my package.json to run it.

```auto
"scripts": {
    "build": "npm run fetch-missing-images && gatsby build",
    "build:prod": "npm run build; npm run lambda-build",
    "lambda-build": "netlify-lambda build functions",
    "fetch-missing-images": "node fetchMissingImages.js"
  },

```

Then I changed the build command in my deploy settings to be build:prod which triggers build which then runs my node app to update my db with missing images.

Hope that helps,  
Travis Ballard

---

<div class="post-metadata">

**Author:** ![luke](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/luke/32/39_2.png) [@luke](https://answers.netlify.com/u/luke)\
**Post date:** [August 23, 2019, 8:47am UTC](https://answers.netlify.com/t/how-do-you-implement-event-triggered-functions/2856/3 "2019-08-23T08:47:30Z")

</div>

@nicmeriano, about build limits (meaning: “how many times I can deploy my site”), at this time we do not limit build counts. Deploying once a day would not be an issue.

We do limit build _concurrency_ based on the plan level. There is more information about build concurrency limits [here](https://www.netlify.com/pricing/#features-concurrent-builds).
