Skip to main content
Version: v4 | v5 | v6 (latest)
A powerful JavaScript SDK for building custom applications within the Domo platform
npm version TypeScript domo.js (published as ryuu.js, developed as domo.js) is a comprehensive JavaScript library that enables developers to build interactive custom applications within the Domo platform. It provides seamless communication between your custom app and the Domo environment, supporting data fetching, real-time events, filters, variables, and cross-platform mobile integration.

Quick Start

Get started with ryuu.js in just a few lines:

Features

  • HTTP API Access - Authenticated requests to Domo datasets, datastores, and APIs
  • Real-time Events - Listen for dataset updates, filter changes, and variable updates
  • Filter Management - Get and set page-level filters programmatically
  • Variable Management - Access and update page variables
  • Custom App Data - Send custom data between apps on the same page
  • Navigation - Programmatically navigate within Domo
  • Mobile Support - Full iOS and Android compatibility
  • TypeScript Ready - Complete type definitions included
  • Zero Dependencies - Minimal bundle size with no runtime dependencies
  • Extensible - Override or extend functionality via extend() method

Installation

NPM

Then import in your application:

CDN / Script Tag

TypeScript

TypeScript definitions are included automatically:

Core Concepts

Communication Architecture

Your custom app runs in an iframe within the Domo platform. ryuu.js establishes a bidirectional communication channel using:
  • MessageChannel API - Primary communication mechanism for desktop/web
  • webkit.messageHandlers - iOS native integration
  • Global objects - Android/Flutter integration

Request-Reply Pattern

Async operations (like updating filters) use an ASK-ACK-REPLY pattern:
  1. ASK - Your app sends a request with a unique ID
  2. ACK - Parent acknowledges receipt (optional callback)
  3. REPLY - Parent sends response when operation completes (optional callback)

Environment Context

Access information about the current user and environment via Domo.env:
Security Note: Environment properties come from URL parameters and can be spoofed. Always verify with the API for secure operations:

Token Injection

A single MutationObserver watches document.documentElement with subtree: true. For every DOM node added at any depth, it automatically injects the Domo session token (ryuu_sid) into relative href and src attributes. Token is fetched once per batch — you don’t need to manage auth manually.

API Reference

HTTP Methods

All HTTP methods return Promises and support multiple data formats.

Domo.get(url, options?)

Fetch data from a Domo dataset or API endpoint. Parameters:
  • url (string) - API endpoint URL
  • options (object, optional) - Request options
Returns: Promise<ResponseBody> Basic Usage:
Format Options:
Supported Formats:
  • 'array-of-objects' (default) - Returns ObjectResponseBody[]
  • 'array-of-arrays' - Returns ArrayResponseBody with metadata
  • 'csv' - Returns CSV string
  • 'excel' - Returns Excel Blob
  • 'plain' - Returns plain text string
Query Parameters:
Best Practice: Always filter and paginate large datasets to avoid slow responses:

Domo.getAll(urls, options?)

Fetch multiple datasets or endpoints in parallel. Parameters:
  • urls (string[]) - Array of API endpoint URLs
  • options (object, optional) - Request options applied to all requests
Returns: Promise<ResponseBody[]> Example:
With Options:

Domo.post(url, body?, options?)

Send a POST request to create data. Parameters:
  • url (string) - API endpoint URL
  • body (object | string, optional) - Request body
  • options (object, optional) - Request options
Returns: Promise<ResponseBody> Example:

Domo.put(url, body?, options?)

Send a PUT request to update data. Parameters:
  • url (string) - API endpoint URL
  • body (object | string, optional) - Request body
  • options (object, optional) - Request options
Returns: Promise<ResponseBody> Example:

Domo.delete(url, options?)

Send a DELETE request to remove data. Parameters:
  • url (string) - API endpoint URL
  • options (object, optional) - Request options
Returns: Promise<ResponseBody> Example:

Domo.domoHttp(method, url, options?, body?)

Low-level HTTP method for full control over requests. All other HTTP methods use this internally. Parameters:
  • method (RequestMethods) - HTTP method
  • url (string) - API endpoint URL
  • options (object, optional) - Request options
  • body (object | string, optional) - Request body
Returns: Promise<ResponseBody> Example:

Event Listeners

Event listeners enable real-time reactivity to changes in the Domo platform. All listener methods return an unsubscribe function.

Domo.onDataUpdated(callback)

Listen for dataset update events. Parameters:
  • callback (function) - Called when a dataset is updated
    • Receives: datasetAlias (string) - Alias of the updated dataset
Returns: function - Unsubscribe function Example:
Use Case: Refresh your app’s visualizations when underlying data changes without requiring a page reload.

Domo.onFiltersUpdated(callback)

Listen for page filter changes. Parameters:
  • callback (function) - Called when filters change
    • Receives: filters (Filter[]) - Array of filter objects
Returns: function - Unsubscribe function Example:
Filter Object Structure:
Supported Operators: String Operators:
  • "IN" - Value is in list
  • "NOT_IN" - Value is not in list
  • "CONTAINS" - Value contains string
  • "NOT_CONTAINS" - Value doesn’t contain string
  • "STARTS_WITH" - Value starts with string
  • "NOT_STARTS_WITH" - Value doesn’t start with string
  • "ENDS_WITH" - Value ends with string
  • "NOT_ENDS_WITH" - Value doesn’t end with string
Numeric/Date Operators:
  • "EQUALS" - Equals value
  • "NOT_EQUALS" - Not equals value
  • "GREATER_THAN" - Greater than value
  • "GREAT_THAN_EQUALS_TO" - Greater than or equals value
  • "LESS_THAN" - Less than value
  • "LESS_THAN_EQUALS_TO" - Less than or equals value
  • "BETWEEN" - Between two values

Domo.onVariablesUpdated(callback)

Listen for page variable changes. Parameters:
  • callback (function) - Called when variables change
    • Receives: variables (object) - Variables object with IDs as keys
Returns: function - Unsubscribe function Example:
Variables Object Structure:
Note: Variable IDs (like “391”) are defined by Domo. Inspect the variables object in your app to find the correct IDs.

Domo.onAppDataUpdated(callback)

Listen for custom app data updates. Parameters:
  • callback (function) - Called when app data is received
    • Receives: data (any) - Custom data object
Returns: function - Unsubscribe function Example:
Use Case: Enable communication between multiple custom apps on the same Domo page.

Emitters

Emitters send messages to the parent Domo platform to trigger actions or update state.

Domo.requestFiltersUpdate(filters, pageStateUpdate?, onAck?, onReply?)

Update page-level filters programmatically. Parameters:
  • filters (Filter[]) - Array of filter objects
  • pageStateUpdate (boolean, optional) - Optional boolean indicating if the page state should be updated by the filter. When false, on the card level filter state will be updated. (default: true)
  • onAck (function, optional) - Called when request is acknowledged
  • onReply (function, optional) - Called when request completes
    • Receives: response (any) - Response data
Returns: string - Request ID for tracking Example:
With Callbacks:
Filter Requirements: All filter objects must include:
  • column (string, required) - Column name to filter on
  • operator (string, required) - Filter operator (see supported operators above)
  • values (array, required) - Values to filter by
  • dataType (string, required) - Data type: "STRING", "NUMERIC", "DATE", or "DATETIME"

Domo.requestVariablesUpdate(variables, onAck?, onReply?)

Update page variables programmatically. Parameters:
  • variables (Variable[]) - Array of variable objects
  • onAck (function, optional) - Called when request is acknowledged
  • onReply (function, optional) - Called when request completes
Returns: string - Request ID for tracking Example:
Variable Object Structure:

Domo.requestAppDataUpdate(data, onAck?, onReply?)

Send custom app data to other apps on the same page. Parameters:
  • data (any) - Custom data object
  • onAck (function, optional) - Called when request is acknowledged
  • onReply (function, optional) - Called when request completes
Returns: void Example:
Use Case: Coordinate interactions between multiple custom apps on the same Domo page.

Domo.navigate(url, isNewWindow?)

Navigate to a different page within Domo. Parameters:
  • url (string) - Domo page URL or route
  • isNewWindow (boolean, optional) - Open in new tab/window (default: false)
Example:
Important Notes:
  • Use Domo.navigate() instead of HTML links to change the page hosting the custom app
  • For mobile web platforms, routes are automatically prefixed with /m# (e.g., /m#/profile/3234)
  • External links are restricted to whitelisted domains (configure in Admin > Network Security > Custom Apps authorized domains)

Environment

Domo.env

Access environment information about the current context. Type: QueryParams (object) Available Properties:
Example:
Security Warning: These properties come from URL query parameters and can be spoofed. For secure user identification, always verify with the API:

Utilities

Domo.extend(overrides)

Extend or override static methods and properties of the Domo class. Parameters:
  • overrides (object) - Object with methods/properties to override
Returns: void Example:
Use Cases:
  • Add logging to all requests
  • Implement retry logic
  • Add caching layer
  • Mock responses for testing
  • Add custom error handling

Domo.getRequests()

Get all tracked requests (ASK-ACK-REPLY pattern). Returns: AskReplyMap - Object with request IDs as keys Example:

Domo.getRequest(id)

Get a specific tracked request by ID. Parameters:
  • id (string) - Request ID
Returns: Request object or undefined Example:

Domo.__util

Internal utilities exposed for advanced use cases. Available Utilities:
Note: These are internal utilities and may change between versions. Use at your own risk.

TypeScript Support

ryuu.js includes comprehensive TypeScript definitions for a better development experience.

Importing Types

Typed Requests

Typed Filters

Typed Variables

Custom Types


Mobile Platform Support

ryuu.js provides full support for iOS and Android mobile platforms through platform-specific APIs.

iOS Integration

On iOS, ryuu.js uses webkit.messageHandlers for native communication:

Android/Flutter Integration

On Android, ryuu.js uses global objects injected by the native app:

Platform Detection

ryuu.js automatically detects the platform and uses the appropriate communication method:

Mobile Considerations

  1. Navigation: Routes are automatically prefixed with /m# on mobile web
  2. Touch Events: Consider touch-friendly UI for mobile apps
  3. Performance: Mobile devices may have limited resources - optimize data fetching
  4. Testing: Test on actual devices or simulators for best results

Error Handling

All HTTP methods return Promises. Use try/catch with async/await for error handling.

Basic Error Handling

Error Object Structure

Error objects include comprehensive information:

Handling Specific Error Types

Retry Logic

Implement retry logic for transient errors:

Advanced Usage

Custom Fetch Implementation

Provide your own fetch implementation for testing or custom behavior:

Caching Layer

Add a caching layer using extend():

Request Interceptors

Add interceptors for all requests:

Type Guards

Use type guards to validate runtime data:

Complete Example

Here’s a comprehensive example showing a real-world custom app:

Migration Guide

Deprecated Methods

The following methods have been renamed for consistency. Old methods still work but are deprecated and will be removed in a future version.

Migration Steps

  1. Find and Replace:
  1. Update Dependencies:
  1. Test Thoroughly:
After migration, test all functionality to ensure everything works correctly.

Contributing

Contributions are welcome! Please follow these guidelines:
  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes
  4. Add tests for new functionality
  5. Run tests: npm test
  6. Build: npm run build
  7. Commit: git commit -m "Add my feature"
  8. Push: git push origin feature/my-feature
  9. Open a Pull Request

Development Setup


Made with ❤️ by the Domo team