Functions Step
The Functions step provides access to QuivaWorks platform services (streams, storage) and data transformation utilities (encoding, merging, templating). Use Functions to interact with real-time streams, persist data, and transform formats.Platform Integration: Functions connect your flows to QuivaWorks’ infrastructure for real-time streaming, persistent storage, and data transformation.
How Functions Work
Functions take input, execute an operation (platform service or transformation), and return the result:When to Use Functions
| Use Functions When | Use Alternative When |
|---|---|
| Need real-time streaming | Batch processing (use HTTP/database) |
| Persist configuration/state | Temporary data in flow |
| Store files/media | External storage service preferred |
| Transform data formats (JSON/XML/Base64) | Complex custom logic (use Eval) |
| Merge complex data structures | Simple field extraction (use Map) |
Use HTTP instead: Send to external webhook (when external service required) Use Functions: Store user preferences in KV storage
Pass in flow: Temporary data that doesn’t need persistence Use Functions: Decode Base64 encoded data
Use Eval instead: Complex custom encoding algorithm (when custom logic needed)
Function Categories
QuivaWorks provides functions across multiple categories:Stream Functions
Real-time data streaming
Key-Value Storage
Fast KV storage operations
Object Storage
Large file/object storage
Data Transformation Utilities
Transform, encode, and manipulate data
Configuration
Function Selection
Which function to executeExamples:
Function Inputs
Input parameters for the functionCan reference previous steps:Each function has specific input requirements (see function documentation)
Quick Examples by Category
Stream Functions
Key-Value Storage
Object Storage
Data Transformation Utilities
Complete Function Documentation
For detailed documentation of all available functions with syntax, parameters, and examples:Functions Overview
Complete list of all available functions
Stream Functions
Real-time streaming operations
Key-Value Storage
KV bucket storage operations
Object Storage
Object storage operations
Data Transformation Utilities
Encoding, merging, templating, and utilities
Common Flow Patterns
Event Tracking Pipeline
Event Tracking Pipeline
Track user events in real-time streamUse when: Need real-time event processing and analytics
Configuration Management
Configuration Management
Store and retrieve app configurationUse when: Need persistent configuration across flows
File Upload & Storage
File Upload & Storage
Handle file uploads with object storageUse when: Need to store files/media
Data Format Conversion
Data Format Conversion
Convert between data formatsUse when: Integrating systems with different formats
Complex Data Merging
Complex Data Merging
Merge data from multiple sourcesUse when: Need to combine nested data structures
Dynamic Template Rendering
Dynamic Template Rendering
Generate dynamic content from templatesUse when: Need dynamic content generation
Data Organization & Grouping
Data Organization & Grouping
Organize data for analysisUse when: Need to organize data by property
Stream Analytics
Stream Analytics
Aggregate and analyze stream dataUse when: Need to analyze streaming data
SFTP File Delivery
SFTP File Delivery
Upload files to partner SFTP serversUse when: Need to deliver files to partners/systems via SFTP
Function Orchestration
Function Orchestration
Chain multiple functions togetherUse when: Need modular function composition
SOAP API Integration
SOAP API Integration
Work with XML-based SOAP APIsUse when: Integrating with SOAP/XML services
Best Practices
Use Platform Functions
Use QuivaWorks’ platform functions for streams and storage rather than external services when possible.
Persist Important Data
Use KV or Object storage for data that needs to persist across flow executions.
Stream Real-Time Events
Use streams for event tracking, analytics, and real-time processing.
Transform Before Agent
Clean and transform data with Functions before passing to agents.
Name Steps Clearly
Use descriptive names: “Store User Preferences” not “Function 1”
Handle Errors
Check function results and handle errors appropriately.
Use Secrets for Credentials
Always use secret-key-get-node for passwords, API keys, and sensitive data.
Modular Architecture
Use function-invoke to break complex logic into reusable functions.
Functions vs. Alternatives
Use Functions when:- Need QuivaWorks platform services (streams, storage)
- Need data transformation (encoding, merging, templates)
- Want built-in, tested operations
- Need to persist data across flows
- Need to orchestrate multiple functions
- Need to upload files via SFTP
- Need to transform data structure
- Extracting/restructuring objects
- Functions don’t fit your use case
- Need custom algorithms
- Complex logic not available
- Combining multiple operations uniquely
- Specialized service required (e.g., Twilio for SMS)
- Already using external provider
- Need features not in QuivaWorks
Troubleshooting
Function not found
Function not found
Causes:
- Wrong function name
- Typo in function name
- Check function documentation for exact name
- Verify function exists:
publish-message-to-streamnotpublish-to-stream - Note: Some functions renamed (e.g.,
JSON-XML→json-xml)
Invalid parameters
Invalid parameters
Causes:
- Missing required parameter
- Wrong parameter format
- Wrong parameter name
- Review function documentation for exact parameter names
- Note parameter changes:
data→variables(handlebars),key_name→key(secrets) - Check that base64 functions take direct input, not wrapped in object
- Verify variable references
Stream/bucket not found
Stream/bucket not found
Causes:
- Stream or bucket doesn’t exist
- Wrong name
- Create stream/bucket first
- Verify exact name
- Check account has access
Can't access output
Can't access output
Causes:
- Wrong variable path
- Function didn’t execute
- Use
${step_name.result} - For base64-decode with JSON, result is auto-parsed
- For secret-key-get-node, check
${step_name.value}or${step_name.error} - Check execution logs
- Verify step name matches
SFTP connection timeout
SFTP connection timeout
Causes:
- Wrong host or port
- Network issues
- Server not responding
- Verify host and port are correct
- Check network connectivity
- Increase connectionTimeout if server is slow
- Verify credentials are correct