Memory Blocks
Memory Blocks
Section titled “Memory Blocks”Memory blocks provide persistent key-value storage for maintaining flow-level persistence. Acts as lightweight database for storing temporary data, counters, flags, or information your automation needs to remember across multiple events.
What is the Memory?
Section titled “What is the Memory?”Persistent storage system built into Flows that allows you to:
- Store and retrieve key-value pairs
- Set optional time-to-live (TTL) values for automatic cleanup
- Organize data using collections (namespaces)
- Share data between different blocks
Memory Block Types
Section titled “Memory Block Types”Memory Set
Section titled “Memory Set”Stores a value in the memory under a specified key.
Configuration:
- Collection: Static text value acting as namespace for your data
- Key: JavaScript expression evaluating to key name
- Value: JavaScript expression evaluating to value to store
- TTL: Optional JavaScript expression evaluating to seconds before automatic deletion
Special Features:
The Value field can reference the old stored value via stored variable. If key doesn’t exist, stored is undefined.
Example Usage:
// Simple Value Storage{ "triage": outputs.triage?.object, "triage_ts": outputs.startASlackThread.ts, "ticket": outputs.prepareTicket,}// Simple counter incrementstored ? stored + 1 : 1
// Conditional update - only set if key doesn't exist!stored ? "initial_value" : stored
// Update with timestamp{ value: outputs.someBlock.data, lastUpdated: new Date().toISOString(), count: stored ? stored.count + 1 : 1}Memory Get
Section titled “Memory Get”Retrieves a value from the memory.
Configuration:
- Collection: Static text value matching collection used in Set operations
- Key: JavaScript expression evaluating to key name
Output:
- Returns stored value if key exists
- Returns
undefinedif key doesn’t exist
Memory List
Section titled “Memory List”Returns keys present in a specified collection.
Configuration:
- Collection: Collection to query from
- Starting Key: Key to start query from
- Limit: Maximum numśber of items to return
Output:
- Returns paginated array of key names in collection
- Returns empty array if no keys exist in collection