Skip to main content

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

Examples: Use Functions: Publish events to stream for real-time analytics
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

function
string
required
Which function to executeExamples:

Function Inputs

inputs
object
required
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

Track user events in real-time stream
Use when: Need real-time event processing and analytics
Store and retrieve app configuration
Use when: Need persistent configuration across flows
Handle file uploads with object storage
Use when: Need to store files/media
Convert between data formats
Use when: Integrating systems with different formats
Merge data from multiple sources
Use when: Need to combine nested data structures
Generate dynamic content from templates
Use when: Need dynamic content generation
Organize data for analysis
Use when: Need to organize data by property
Aggregate and analyze stream data
Use when: Need to analyze streaming data
Upload files to partner SFTP servers
Use when: Need to deliver files to partners/systems via SFTP
Chain multiple functions together
Use when: Need modular function composition
Work with XML-based SOAP APIs
Use 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
Use Map when:
  • Need to transform data structure
  • Extracting/restructuring objects
  • Functions don’t fit your use case
Use Eval when:
  • Need custom algorithms
  • Complex logic not available
  • Combining multiple operations uniquely
Use External Services when:
  • Specialized service required (e.g., Twilio for SMS)
  • Already using external provider
  • Need features not in QuivaWorks

Troubleshooting

Causes:
  • Wrong function name
  • Typo in function name
Solutions:
  • Check function documentation for exact name
  • Verify function exists: publish-message-to-stream not publish-to-stream
  • Note: Some functions renamed (e.g., JSON-XMLjson-xml)
Causes:
  • Missing required parameter
  • Wrong parameter format
  • Wrong parameter name
Solutions:
  • Review function documentation for exact parameter names
  • Note parameter changes: datavariables (handlebars), key_namekey (secrets)
  • Check that base64 functions take direct input, not wrapped in object
  • Verify variable references
Causes:
  • Stream or bucket doesn’t exist
  • Wrong name
Solutions:
  • Create stream/bucket first
  • Verify exact name
  • Check account has access
Causes:
  • Wrong variable path
  • Function didn’t execute
Solutions:
  • 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
Causes:
  • Wrong host or port
  • Network issues
  • Server not responding
Solutions:
  • Verify host and port are correct
  • Check network connectivity
  • Increase connectionTimeout if server is slow
  • Verify credentials are correct

Next Steps

Explore All Functions

Browse complete function library

Map Step

Custom data transformations

Eval Step

Custom JavaScript for complex logic

HTTP Request

Call external APIs