examples/n8n/format-downloads.code-node.js

format-downloads.code-node.js: full JavaScript source from the n8n workflows folder of Spatial9 Agent Skills. Free, MIT licensed code for immersive audio...

Raw file · View on GitHub · Download every file as a zip

// n8n Code node: turn the Spatial9 download list into a Slack-friendly message.
const result = $input.first().json.result;
if (result.isError) throw new Error(result.content[0].text);   // surface Spatial9's own message

const files = result.structuredContent.downloads ?? [];
const wanted = files.filter(f => ["binaural", "youtube_video", "iamf"].includes(f.id));
const lines = wanted.map(f => `• ${f.label}: ${f.url}`);

return [{ json: { text: `Your immersive mix is ready:\n${lines.join("\n")}` } }];