A powerful JavaScript SDK for building custom applications within the Domo platform
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
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:- ASK - Your app sends a request with a unique ID
- ACK - Parent acknowledges receipt (optional callback)
- REPLY - Parent sends response when operation completes (optional callback)
Environment Context
Access information about the current user and environment viaDomo.env:
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 URLoptions(object, optional) - Request options
Promise<ResponseBody>
Basic Usage:
'array-of-objects'(default) - ReturnsObjectResponseBody[]'array-of-arrays'- ReturnsArrayResponseBodywith metadata'csv'- Returns CSV string'excel'- Returns Excel Blob'plain'- Returns plain text string
Domo.getAll(urls, options?)
Fetch multiple datasets or endpoints in parallel.
Parameters:
urls(string[]) - Array of API endpoint URLsoptions(object, optional) - Request options applied to all requests
Promise<ResponseBody[]>
Example:
Domo.post(url, body?, options?)
Send a POST request to create data.
Parameters:
url(string) - API endpoint URLbody(object | string, optional) - Request bodyoptions(object, optional) - Request options
Promise<ResponseBody>
Example:
Domo.put(url, body?, options?)
Send a PUT request to update data.
Parameters:
url(string) - API endpoint URLbody(object | string, optional) - Request bodyoptions(object, optional) - Request options
Promise<ResponseBody>
Example:
Domo.delete(url, options?)
Send a DELETE request to remove data.
Parameters:
url(string) - API endpoint URLoptions(object, optional) - Request options
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 methodurl(string) - API endpoint URLoptions(object, optional) - Request optionsbody(object | string, optional) - Request body
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
- Receives:
function - Unsubscribe function
Example:
Domo.onFiltersUpdated(callback)
Listen for page filter changes.
Parameters:
callback(function) - Called when filters change- Receives:
filters(Filter[]) - Array of filter objects
- Receives:
function - Unsubscribe function
Example:
"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
"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
- Receives:
function - Unsubscribe function
Example:
Domo.onAppDataUpdated(callback)
Listen for custom app data updates.
Parameters:
callback(function) - Called when app data is received- Receives:
data(any) - Custom data object
- Receives:
function - Unsubscribe function
Example:
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 objectspageStateUpdate(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 acknowledgedonReply(function, optional) - Called when request completes- Receives:
response(any) - Response data
- Receives:
string - Request ID for tracking
Example:
column(string, required) - Column name to filter onoperator(string, required) - Filter operator (see supported operators above)values(array, required) - Values to filter bydataType(string, required) - Data type:"STRING","NUMERIC","DATE", or"DATETIME"
Domo.requestVariablesUpdate(variables, onAck?, onReply?)
Update page variables programmatically.
Parameters:
variables(Variable[]) - Array of variable objectsonAck(function, optional) - Called when request is acknowledgedonReply(function, optional) - Called when request completes
string - Request ID for tracking
Example:
Domo.requestAppDataUpdate(data, onAck?, onReply?)
Send custom app data to other apps on the same page.
Parameters:
data(any) - Custom data objectonAck(function, optional) - Called when request is acknowledgedonReply(function, optional) - Called when request completes
void
Example:
Navigation
Domo.navigate(url, isNewWindow?)
Navigate to a different page within Domo.
Parameters:
url(string) - Domo page URL or routeisNewWindow(boolean, optional) - Open in new tab/window (default: false)
- 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:
Utilities
Domo.extend(overrides)
Extend or override static methods and properties of the Domo class.
Parameters:
overrides(object) - Object with methods/properties to override
void
Example:
- 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
undefined
Example:
Domo.__util
Internal utilities exposed for advanced use cases.
Available Utilities:
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
- Navigation: Routes are automatically prefixed with
/m#on mobile web - Touch Events: Consider touch-friendly UI for mobile apps
- Performance: Mobile devices may have limited resources - optimize data fetching
- Testing: Test on actual devices or simulators for best results
Error Handling
All HTTP methods return Promises. Usetry/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 usingextend():
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.| Deprecated Method | New Method | Description |
|---|---|---|
Domo.onDataUpdate | Domo.onDataUpdated | Listen for dataset changes |
Domo.onFiltersUpdate | Domo.onFiltersUpdated | Listen for filter changes |
Domo.onAppData | Domo.onAppDataUpdated | Listen for app data changes |
Domo.filterContainer | Domo.requestFiltersUpdate | Set page filters |
Domo.sendVariables | Domo.requestVariablesUpdate | Update page variables |
Domo.sendAppData | Domo.requestAppDataUpdate | Send custom app data |
Migration Steps
- Find and Replace:
- Update Dependencies:
- Test Thoroughly:
Contributing
Contributions are welcome! Please follow these guidelines:- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Add tests for new functionality
- Run tests:
npm test - Build:
npm run build - Commit:
git commit -m "Add my feature" - Push:
git push origin feature/my-feature - Open a Pull Request
Development Setup
Made with ❤️ by the Domo team