workflows/n8n/format-downloads.code-node.js
n8n Code node: turn the Spatial9 download list into a Slack-friendly message.
JavaScript file, 10 lines, from the n8n workflows folder of Spatial9 Agent Skills: free, MIT licensed code for immersive audio with the Spatial9 MCP server and A2A agent. Last updated .
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")}` } }];