一键导入
code-engine
// Execute Code Engine functions from apps with domo.post and strict packagesMapping input/output contracts.
// Execute Code Engine functions from apps with domo.post and strict packagesMapping input/output contracts.
Step-by-step orchestrator for building Domo App Studio apps with native KPI cards via community-domo-cli. Sequences app creation, pages, theme, hero metrics, native charts, filter cards, layout assembly, and navigation. CLI-first — no raw API calls.
Domo KPI card CRUD via community-domo-cli — body schema, column mapping, beast modes, chart type index with on-demand reference files, and gotchas.
**Generating sample data for Domo** -- invoke when a user needs to create realistic sample datasets and upload them to a Domo instance. Primary signals: requests for sample data, demo data, test data, fake data for Domo; mentions of Salesforce, Google Analytics, QuickBooks, NetSuite, Google Ads, Facebook Ads, HubSpot, Marketo, or Health Portal sample data; questions about the datagen CLI or domo_data_generator. Covers: generating datasets, uploading to Domo, creating datasets in Domo, rolling dates, entity pools, connector icons, catalog management, and adding new dataset definitions. Skip for: real connector setup, production data pipelines, data transformations (Magic ETL), or Domo App Platform.
Create AppDB collections via CLI-first workflows where collection creation also provisions the required datastore, then returns collection identifiers for manifest wiring and document-write follow-up. Use when an agent must initialize new AppDB storage for a Domo app, not just list/get collections or create documents.
Create Domo Code Engine packages from CLI workflows with deterministic payload contracts, automatic function parameter datatype mapping, and manifest packagesMapping follow-up guidance. Use when an agent must create a new package/versioned package container rather than only invoke an existing function from app runtime code.
Update Domo Code Engine packages through CLI-driven versioned lifecycle workflows with compatibility checks, datatype contract safeguards, and manifest mapping drift synchronization. Use when an agent must update package code or create a new package version and keep app mappings aligned.
| name | code-engine |
| description | Execute Code Engine functions from apps with domo.post and strict packagesMapping input/output contracts. |
Use a contract-first pattern for Code Engine calls.
In practice, prefer direct domo.post('/domo/codeengine/v2/packages/{alias}', params) when wiring app calls.
Package lifecycle operations are handled by CLI skills:
~/.agents/skills/code-engine-create/SKILL.md~/.agents/skills/code-engine-update/SKILL.mdUse this skill for runtime invocation patterns inside app code, not package create/update orchestration.
domo.post)npm install ryuu.js
import domo from 'ryuu.js';
const response = await domo.post('/domo/codeengine/v2/packages/calculateTax', {
amount: 1000,
state: 'CA'
});
// First integration pass: inspect exact response shape for this function
console.log('Code Engine response:', response);
const body = response?.body ?? response?.data ?? response;
// Some package contracts return nested envelopes:
// { response: { ... } } or { response: { response: { ... } } }
const unwrapResponse = (value: unknown) => {
let current = value as any;
let depth = 0;
while (current && typeof current === 'object' && 'response' in current && depth < 6) {
current = current.response;
depth += 1;
}
return current;
};
const normalized = unwrapResponse(body);
// Handle common output shapes
const output =
normalized?.output ??
normalized?.result ??
normalized?.value ??
normalized;
if (typeof output === 'number') {
// numeric output
} else if (typeof output === 'string') {
// string output
} else if (output && typeof output === 'object') {
// structured object output
} else {
throw new Error('Code Engine returned no usable output');
}
packagesMapping (with s)Use packagesMapping and define full parameter/output contracts.
{
"packagesMapping": [
{
"name": "myPackage",
"alias": "myFunction",
"packageId": "00000000-0000-0000-0000-000000000000",
"version": "1.0.0",
"functionName": "myFunction",
"parameters": [
{
"name": "param1",
"displayName": "param1",
"type": "decimal",
"value": null,
"nullable": false,
"isList": false,
"children": [],
"entitySubType": null,
"alias": "param1"
}
],
"output": {
"name": "result",
"displayName": "result",
"type": "number",
"value": null,
"nullable": false,
"isList": false,
"children": [],
"entitySubType": null,
"alias": "result"
}
}
]
}
Version pinning rule:
"version": "x.y.z" explicitly in each packagesMapping entry.version as null unless the user explicitly wants unpinned/latest behavior.When recommending or generating Code Engine calls, the agent must explicitly tell the user:
nullable expectationsresponse envelope (and if nested envelopes are possible)This is required so the user can build a matching Code Engine function and manifest contract.
async function executeFunction(alias: string, payload: Record<string, unknown>) {
try {
const response = await domo.post(`/domo/codeengine/v2/packages/${alias}`, payload);
console.log('Code Engine response:', response);
return response?.body ?? response?.data ?? response;
} catch (error) {
console.error(`Code Engine call failed for alias ${alias}`, error);
throw error;
}
}
When calling a Domo-provided global package (e.g. DOMO Notifications, DOMO DataSets, DOMO Users),
the exported function names and their exact parameter signatures are not discoverable via the REST API
— GET /api/codeengine/v2/packages/{id}/versions/{v} returns "functions": [] for all global packages.
How to find them: navigate to the package source in the Domo UI:
https://{instance}.domo.com/codeengine/{packageId}
This opens the Code Engine editor showing the full JavaScript source for the package. Read it to find:
sendEmail, sendBuzzRequest)Why this matters: guessing function names against the API returns 404 for every wrong name, giving no indication of what the correct name is. Without reading the source first, you will burn multiple round-trips and may need the user to paste the source manually.
03ba6971-98d0-4654-9bfd-aa897816df33)Key functions found in source:
| Function | Parameters (positional) | Notes |
|---|---|---|
sendEmail | recipientEmails, subject, body, personRecipients, groupRecipients, attachments, attachment, includeReplyAll | recipientEmails is a single comma-separated string, not an array |
sendEmailToListOfEmails | to, subject, body, attachments, attachment, includeReplyAll | to is an array of strings |
sendBuzzRequest | channelId, message | channelId must be a valid UUID |
sendExternalEmail | to, subject, body, attachments, attachment, includeReplyAll | Validates against authorized domain whitelist |
Gotcha:
sendEmailtakesrecipientEmailsas a plain string (e.g."user@example.com"), not an array. Passing an array causes silent failure or incorrect routing.
https://{instance}.domo.com/codeengine/{packageId} before writing any calldomo.post('/domo/codeengine/v2/packages/{alias}', params) patternpackagesMapping (not packageMapping)packagesMapping.version is explicitly pinned when deterministic package behavior is requiredpackagesMapping.parameters and output include full contract fields (name, displayName, type, value, nullable, isList, children, entitySubType, alias)body/data/raw response shape and nested response envelopes