Following along? Download the starting code from our Getting Started repository and refactor it as we go, or jump directly to the final version with actions.
What Are Actions?
Actions are interactive buttons that appear in the Flatfile interface, allowing users to trigger custom operations on their data. Common Actions include:- Submit: Process your data and POST it to your system via API
- Validate: Run custom validation rules
- Transform: Apply data transformations
- Export: Generate reports or exports

Actions appear as buttons in the Flatfile interface
What Changes We’re Making
To add Actions to our Listener with validation, we need to make two specific changes:1. Add Actions Array to Blueprint Definition
In thespace:configure
Listener, we’ll add an actions
array to our Workbook creation. This enhances our Blueprint to include interactive elements:
2. Add Action Handler Listener
We’ll add a new Listener to handle when users click the Submit button:Complete Example with Actions
This example builds on the Listener we created in the previous tutorials. It includes the complete functionality: Space configuration, email validation, and Actions.
Complete Example: The full working code for this tutorial step is available in our Getting Started repository: JavaScript | TypeScript
Understanding Action Modes
Actions can run in different modes:foreground
: Runs immediately with real-time progress updates (good for quick operations)background
: Runs as a background job (good for longer operations)
submitActionForeground
) determines which Listener will handle the Action.
Testing Your Action
Local Development
To test your Listener locally, you can use theflatfile develop
command. This will start a local server that will listen for Events and respond to them, and will also watch for changes to your Listener code and automatically reload the server.
Step-by-Step Testing
After running your listener locally:Testing Steps
- Create a new Space in your Flatfile Environment
- Upload (or manually enter) some data to the contacts Sheet with both valid and invalid email addresses
- See validation errors appear on invalid email Fields
- Click the “Submit” button
- Watch the logging in the terminal as your data is processed and the job is completed
What Just Happened?
Your Listener now handles three key Events and provides a complete data import workflow. Here’s how the new action handling works:1. Blueprint Definition with Actions
We enhanced the Blueprint definition to include action buttons that users can interact with. Adding actions to your workbook configuration is part of defining your Blueprint.2. Listen for Action Events
When users click the Submit button, Flatfile triggers a Job that your listener can handle using the same approach we used for thespace:configure
job in 101.01.
Jobs are named with the pattern <domain>:<operation>
. In this case, the domain is workbook
since we’ve mounted the Action to the Workbook blueprint, and the operation is submitActionForeground
as defined in the Action definition.
3. Retrieve and Process Data
Get all the data from the workbook and process it according to your business logic.4. Provide User Feedback
Keep users informed about the processing with progress updates and final results.space:configure
- Defines the Blueprint with interactive actionscommit:created
- Validates email format when users commit changesworkbook:submitActionForeground
- Processes data when users click Submit
Next Steps
Congratulations! You now have a complete Listener that handles Space configuration, data validation, and user Actions. For more detailed information:- Learn more about Actions
- Understand Job lifecycle patterns in Jobs
- Learn more about Events
- Organize your Listeners with Namespaces
- Explore plugins: Job Handler and Space Configure