Events
The anatomy of Events.
The Flatfile platform encompasses a comprehensive suite of tools. Firstly, it offers a REST API, which can be accessed through the , empowering users to effortlessly manipulate resources. Additionally, an Event bus is available for seamless subscription to resource-related notifications.
To simplify the process of utilizing the Flatfile API, the Flatfile PubSub Client serves as a lightweight wrapper. It enables developers to seamlessly trigger API calls upon receiving Events from any PubSub driver, thus ensuring a smooth and streamlined integration process.
The anatomy of an Event
Flatfile Events adhere to a standardized structure, and Event listeners have the flexibility to handle Events within Flatfile using any of the following syntaxes.
Using Events
Once an Event is received, it is routed to any awaiting listeners which are added with addEventListener()
or its alias on()
.
An Event context is passed to an EventFilter
Building with events
By leveraging the robust capabilities of our @flatfile/listener library, we can seamlessly intercept any Event and execute a callback function based on the values encapsulated within the Event itself.
Event Topics
Utilize the reference provided by the response of each Event topic to determine the desired outcome or plan subsequent actions accordingly.
Workbook
workbook:created
Called when a new workbook is created.
workbook:updated
Called when workbook metadata is updated. For example, updating the name of a workbook. Adding data to a workbook does not emit this Event.
workbook:deleted
Called when a workbook is deleted.
workbook:expired
Called when a workbook is expired.
Document
document:created
Called when a document is created on a workbook.
document:updated
Called when a document is updated on a workbook.
document:deleted
Called when a document is deleted on a workbook.
Sheet
sheet:updated
Called when a sheet is updated. For example, running sheet level validations. Adding data to a sheet does not emit this event.
sheet:deleted
Called when a sheet is deleted.
Snapshot
snapshot:created
Called when a snapshot is created of the sheet. This can be triggered by the API endpoint or when AI Assist is used to modify a sheet.
Record
commit:created
Commits are created when a cell in a Record (which is in a Sheet) is created or updated.
commit:completed
This only runs when trackChanges is enabled on the workbook. This event fires when a commit has completed and any record changes have finished.
layer:created
Called when a new layer is created within a commit. A layer is a programmatically generated artifact of a commit. For example, when a data hook or formatting rule applies formatting or validation automatically. Layers cannot be updated or deleted, but you can ignore them to see the original source data.
File Upload
file:created
Called when a file upload begins or a new file is created.
file:updated
Called when a file is updated. For example, when a file has been extracted into a workbook.
file:deleted
Called when a file is deleted.
file:expired
Called when a file is expired.
Jobs
job:created
Called when a new job is first created. Some jobs will enter an optional planning state at this time. A job with ‘immediate’ set to true will skip the planning step and transition directly to ‘ready.‘
job:ready
Called when a new job is ready to execute. Either the job has a complete plan of work or the job is configured to not need a plan. This is the only event most job implementations will care about. Once a ready job is acknowledged by a listener, it transitions into an executing state.
job:updated
Called when a job is updated. For example, when a listener updates the state or progress of the job. The event will emit many times as the listener incrementally completes work and updates the job.
job:completed
Called when a job has completed.
job:outcome-acknowledged
Called to trigger workflow actions after the user has acknowledged that the job has completed or failed. Background jobs will skip this step.
job:failed
Called when a job fails.
job:deleted
Called when a job is deleted.
Agents
agent:created
Called when a new agent is deployed.
agent:updated
Called when an agent is updated.
agent:deleted
Called when an agent is deleted.
Space
space:created
Called when a new space is created.
space:updated
Called when a space is updated.
space:deleted
Called when a space is deleted.
space:expired
Called when a space is expired.
space:archived
Called when a space is archived.
space:guestAdded
Called when a guest is added.
space:guestRemoved
Called when a guest’s access is revoked from a space.
Secret
secret:created
Called when a new secret is created.
secret:updated
Called when a secret is updated.
secret:deleted
Called when a secret is deleted.