Skip to main content

Working with Persistent Storage in Pipefy Integrations

Written by Product Team
Updated today

When building complex automations, you often need to "remember" information from one execution (run) to the next. Pipefy Integrations Hub provides a native Persistent Storage system (a Key-Value Store) designed specifically to retain data between different runs of a flow.


What is the Storage Piece?

The Storage piece acts as a long-term memory for your integration. Unlike standard variables that only exist while a specific flow is running, data saved in the Storage remains available for future executions.

You can interact with this storage in two ways:

  1. Visual Interface: By using the Storage utility piece in your flow canvas.

  2. Custom Code: By using the context.store object within a Code piece.


How to Use the Storage Piece

The Storage piece allows you to manage persistent data visually, without writing a single line of code. You can find it under the Utility tab when adding a new step.

Once added, you can select from the following operations:

  1. Get: Retrieves the value currently associated with a specific Key.

  2. Put: Stores a value with a specified Key. If the key already exists, the new value will overwrite the old one.

  3. Append: Adds new text or data to the end of an existing string value stored in a Key.

  4. Remove: Deletes a specific Key and its associated value from the persistent storage.

  5. Add To List: Appends an item to a list (array) stored in a Key. This is extremely useful for accumulating IDs or records across multiple runs to process them later in a batch.


Using Storage in Code Pieces

For advanced scenarios, the persistent storage is accessible directly within a Code piece via the context.store object. This is highly utilized for updating parameters, state management, or handling JSON data programmatically.

Example (Node.js):

export const code = async (context) => {
// Reading a value
const lastRunDate = await context.store.get("last_run");

// Logic to fetch data since 'lastRunDate' goes here...

// Saving a new value for the next execution
await context.store.put("last_run", new Date().toISOString());

return true;
};

Governance and Technical Limits

To ensure optimal performance and security across the Integrations Hub, the technical documentation enforces the following governance limits for the storage feature:

Feature

Limit

Key Length

Maximum 128 characters

Value Size

Maximum 512 KB


Storage vs. Files: Which one should I use?

It is important to choose the right tool for the right data type:

  • Use Persistent Storage for state parameters, metadata, timestamps, configuration strings, and small JSON objects or lists (up to 512 KB).

  • Use the Files Object for actual documents, images, or large data exports. The file system is optimized for binary data and supports files up to 10 MB. Trying to save a large file (like a Base64 string of a PDF) directly into the Store will result in an error if it exceeds the 512 KB limit.


Common Use Cases & Best Practices

  1. Delta Syncs (Pagination): Store the "Last Run Date" or the ID of the last processed record using the Put operation. On the next run, use Get to ensure your flow only fetches new data, avoiding duplicates.

  2. Accumulating Data (Queues): Use Add To List to collect item IDs from individual webhook triggers. A secondary scheduled flow can then Get this list, process all items at once (batch processing), and finally use Remove to clear the queue.

  3. Handle Empty States: When using the Get operation, always account for the possibility that the key might be empty (for example, during the very first run of a flow). Use a "Branch" piece to handle cases where no value is returned before proceeding to the next steps.

Did this answer your question?