Use this quickstart library to deploy a simple listener agent to Flatfile that will add support for processing XLSX files to your Flatfile Simplified Javascript / CDN Portals.
- Clone this repository
- Create a
.env
file in the project root using the.env.example
file as a template, populatingFLATFILE_API_KEY
andFLATFILE_ENVIRONMENT_ID
with the values from your Flatfile account - Run the command
npm install
- Run the command
npx flatfile@latest deploy src/index.js
After you create your account in Flatfile, we create a Environment ID, a Publishable Key, and a Secret Key for you. You will need this information to configure your environment.
- Sign up or Sign in to Flatfile.
- Locate your Flatfile Environment ID and Secret Key and write it down.
- Create a
.env
file in the project root using the.env.example
file as a template. - Add the Secret Key to your
.env
file as theFLATFILE_API_KEY
variable - Add the Environment ID to your
.env
file as theFLATFILE_ENVIRONMENT_ID
variable - If you are using a different geographic region of Flatfile, update the API URL in your
.env
file as theFLATFILE_API_URL
variable. This variable is optional, and defaults to our US region unless a different value is included in your.env
file
- Run the command
npx flatfile@latest deploy src/index.js
This only needs to be deployed one time for an environment, and then the listener will be used by all Portals referencing this environment via your publishable key.
If you have more than one environment, be sure to deploy this listener to each environment, by updating the values in your .env
file and running the deploy command above.
This repository adds support for processing XLSX files by default. You may easily add support for additional formats using one of the extractors available from Flatfile (or creating your own!) View additional extractors here
- Install - add the desired plugin to your library with a command like
npm i @flatfile/plugin-json-extractor
- Import - add the correct import statement to the
src/index.js
file, likeimport { JSONExtractor } from "@flatfile/plugin-json-extractor";
- Add to Listener - add the correct listener.use call to
src/index.js
, likelistener.use(JSONExtractor());
The index.js listener may contain multiple listener.use() calls, and each one will add support for parsing that file format.