This plugin adds the ability to fetch all submissions made to Netlify Forms in your site and stash them as JSON files before your build runs making the data available to your static site generator at build time.
This plugin uses the Netlify API to request the data submitted to your forms. It can be configured to request the data from all forms, or from forms with specific names.
You can also configure this plugin to present the gathered data in the appropriate location, so your chosen static site generator can leverage it during the build.
To include this plugin in your site deployment:
# Add the plugin as a dependency of your build
npm i --s netlify-plugin-form-submissions
This plugin will fetch the submission to specified forms and stash the data prior to the execution of the build
command you have specified in your Netlify configuration. You can choose which forms you want get the submission for, or just get them all by adding some config in the netlify.toml
config file. The plugin will discover all the form present in your site.
# Config for the Netlify Build Plugin: netlify-plugin-form-submissions
[[plugins]]
package = "netlify-plugin-form-submissions"
[plugins.inputs]
# Get submissions for specific forms
# e.g. "form-name"
# e.g. ["form-name-1", "form-name-2"]
# e.g. "ALL"
# default: "ALL"
formNames = "my-snazzy-form"
# the folder to receive a json file for each form
dataDirectory = "site/_data"
The plugin uses the Netlify API to access your form submissions data and requires an access token to be stored as a site environment variable.
NETLIFY_AUTH_TOKEN
environment variable in your site dashboard containing this access token..env
file (remember to add your .env
file to your .gitignore
)