{ "kind": "open-flow-workflow", "version": 1, "name": "Four Platform Content Repurposer", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_3623c43a600adc2a": { "name": "Test a content brief", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "request" } ] }, "n_ca6d5c35a616e476": { "name": "Receive content brief", "kind": "webhook", "bodyFields": [ { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "content" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "text" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": true, "handle": "brand_voice" } ], "method": "POST", "options": { "responseBody": { "kind": "workflow-outputs", "timeoutMs": 60000 } } }, "n_4207cea1ad297db3": { "inputs": { "request": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_3623c43a600adc2a", "output": "request" }, { "kind": "node", "nodeId": "n_ca6d5c35a616e476", "output": "body" } ] } }, "name": "Validate the content brief", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "request" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "content" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "processedAt" } ], "name": "Validate the content brief", "moduleId": "n_c2e8ad6894b4d193", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_e5ced122ab46bade": { "inputs": { "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4207cea1ad297db3", "output": "title" } ] }, "brandVoice": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4207cea1ad297db3", "output": "brandVoice" } ] }, "content": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4207cea1ad297db3", "output": "content" } ] } }, "name": "Analyze the source content", "retry": { "maxRetries": 2, "intervalMs": 2000 }, "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "Analyze the content and extract: 5 key points, core message in one sentence, 10 hashtags, 5 SEO keywords. Respond in JSON: { keyPoints, coreMessage, hashtags, seoKeywords }" }, { "role": "user", "content": "Title: {{title}}\nBrand Voice: {{brandVoice}}\n\nContent:\n{{content}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "gpt-4o-mini-2024-07-18", "temperature": 0.3, "max_tokens": 1000 } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "content" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Analyze the source content", "executor": { "kind": "llm", "mode": "json" } } }, "n_545def70bbe4c4bd": { "inputs": { "analysis": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e5ced122ab46bade", "output": "output" } ] }, "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4207cea1ad297db3", "output": "title" } ] }, "brandVoice": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4207cea1ad297db3", "output": "brandVoice" } ] }, "requestId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4207cea1ad297db3", "output": "requestId" } ] } }, "name": "Prepare shared platform prompts", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "analysis" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestId" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "keyPointsJson" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "coreMessage" } ], "name": "Prepare shared platform prompts", "moduleId": "n_e88086b7d592fca1", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_6e5c65ab77257837": { "inputs": { "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "title" } ] }, "keyPointsJson": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "keyPointsJson" } ] }, "coreMessage": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "coreMessage" } ] }, "brandVoice": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "brandVoice" } ] } }, "name": "Write the X thread", "retry": { "maxRetries": 2, "intervalMs": 2000 }, "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "Create a Twitter/X thread (5-7 tweets, each under 280 chars). First tweet: powerful hook. Last: CTA + hashtags. Use numbered format 1/, 2/. JSON: { \"thread\": [\"tweet1\", ...] }" }, { "role": "user", "content": "Title: {{title}}\nKey Points: {{keyPointsJson}}\nCore Message: {{coreMessage}}\nBrand Voice: {{brandVoice}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "gpt-4o-mini-2024-07-18", "temperature": 0.7, "max_tokens": 1200 } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "keyPointsJson" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "coreMessage" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Write the X thread", "executor": { "kind": "llm", "mode": "json" } } }, "n_938dfaf708d0abd4": { "inputs": { "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "title" } ] }, "keyPointsJson": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "keyPointsJson" } ] }, "coreMessage": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "coreMessage" } ] }, "brandVoice": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "brandVoice" } ] } }, "name": "Write the LinkedIn post", "retry": { "maxRetries": 2, "intervalMs": 2000 }, "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "Create a LinkedIn post: bold first line, short paragraphs, personal insight, end with question, 3-5 hashtags. 1300-1800 chars. JSON: { \"post\": \"...\" }" }, { "role": "user", "content": "Title: {{title}}\nKey Points: {{keyPointsJson}}\nCore Message: {{coreMessage}}\nBrand Voice: {{brandVoice}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "gpt-4o-mini-2024-07-18", "temperature": 0.7, "max_tokens": 1000 } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "keyPointsJson" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "coreMessage" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Write the LinkedIn post", "executor": { "kind": "llm", "mode": "json" } } }, "n_6c21161c8da1338d": { "inputs": { "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "title" } ] }, "keyPointsJson": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "keyPointsJson" } ] }, "brandVoice": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "brandVoice" } ] } }, "name": "Write the Instagram caption", "retry": { "maxRetries": 2, "intervalMs": 2000 }, "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "Create an Instagram caption: hook line, micro-story, emojis, CTA, 20-30 hashtags in separate block. JSON: { \"caption\": \"...\", \"hashtags\": [...] }" }, { "role": "user", "content": "Title: {{title}}\nKey Points: {{keyPointsJson}}\nBrand Voice: {{brandVoice}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "gpt-4o-mini-2024-07-18", "temperature": 0.75, "max_tokens": 1200 } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "keyPointsJson" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Write the Instagram caption", "executor": { "kind": "llm", "mode": "json" } } }, "n_6f7ae5e0ff43e89c": { "inputs": { "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "title" } ] }, "keyPointsJson": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "keyPointsJson" } ] }, "brandVoice": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "brandVoice" } ] } }, "name": "Write the Facebook post", "retry": { "maxRetries": 2, "intervalMs": 2000 }, "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "Create a Facebook post: relatable opening, story format, 100-250 words, conversation question at end, no external links, friendly tone. JSON: { \"post\": \"...\" }" }, { "role": "user", "content": "Title: {{title}}\nKey Points: {{keyPointsJson}}\nBrand Voice: {{brandVoice}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "gpt-4o-mini-2024-07-18", "temperature": 0.7, "max_tokens": 800 } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "keyPointsJson" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "brandVoice" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "output" } ], "name": "Write the Facebook post", "executor": { "kind": "llm", "mode": "json" } } }, "n_16b8aa2d39bdac6b": { "inputs": { "requestId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "requestId" } ] }, "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_545def70bbe4c4bd", "output": "title" } ] }, "twitter": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6e5c65ab77257837", "output": "output" } ] }, "linkedin": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_938dfaf708d0abd4", "output": "output" } ] }, "instagram": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6c21161c8da1338d", "output": "output" } ] }, "facebook": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_6f7ae5e0ff43e89c", "output": "output" } ] } }, "name": "Validate and collect all four drafts", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "twitter" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "linkedin" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "instagram" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "facebook" } ], "outputs": [ { "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } }, "nullable": false, "handle": "values" }, { "jsonSchema": { "type": "object", "properties": { "success": { "type": "boolean" }, "requestId": { "type": "string" }, "title": { "type": "string" }, "completedAt": { "type": "string" }, "platforms": { "type": "array", "items": { "type": "string" } }, "drafts": { "type": "object" }, "message": { "type": "string" } }, "required": [ "success", "requestId", "title", "completedAt", "platforms", "drafts", "message" ], "additionalProperties": false }, "nullable": false, "handle": "result" } ], "name": "Validate and collect all four drafts", "moduleId": "n_c712d79e6715fa04", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_b26667e7c3d8800d": { "inputs": { "spreadsheetId": { "kind": "value", "value": "YOUR_SPREADSHEET_ID" }, "range": { "kind": "value", "value": "'Lite Log'!A:G" }, "values": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "values" } ] }, "valueInputOption": { "kind": "value", "value": "RAW" }, "insertDataOption": { "kind": "value", "value": "INSERT_ROWS" } }, "name": "Log one complete draft set", "retry": { "maxRetries": 1, "intervalMs": 1000 }, "kind": "task", "task": { "inputs": [ { "description": "The spreadsheet ID.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The spreadsheet ID." }, "nullable": true, "handle": "spreadsheetId", "value": null }, { "description": "The A1 notation of the range to append values after.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The A1 notation of the range to append values after." }, "nullable": false, "handle": "range" }, { "description": "The data to append.", "jsonSchema": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string", "description": "A union variant." }, { "type": "number", "description": "A union variant." }, { "type": "boolean", "description": "A union variant." }, { "const": null, "description": "A union variant." } ], "description": "The cell value schema." }, "description": "An array item." }, "description": "The data to append." }, "nullable": false, "handle": "values" }, { "description": "The major dimension of the values array.", "jsonSchema": { "type": "string", "enum": [ "ROWS", "COLUMNS" ], "description": "The major dimension of the values array." }, "nullable": true, "handle": "majorDimension", "value": null }, { "description": "How the data should be inserted.", "jsonSchema": { "type": "string", "enum": [ "OVERWRITE", "INSERT_ROWS" ], "description": "How the data should be inserted." }, "nullable": true, "handle": "insertDataOption", "value": null }, { "description": "How the input data should be interpreted.", "jsonSchema": { "type": "string", "enum": [ "RAW", "USER_ENTERED" ], "description": "How the input data should be interpreted." }, "nullable": true, "handle": "valueInputOption", "value": null }, { "description": "Whether to include the appended values in the response.", "jsonSchema": { "type": "boolean", "description": "Whether to include the appended values in the response." }, "nullable": true, "handle": "includeValuesInResponse", "value": null }, { "description": "How values in the response should be rendered.", "jsonSchema": { "type": "string", "enum": [ "FORMATTED_VALUE", "UNFORMATTED_VALUE", "FORMULA" ], "description": "How values in the response should be rendered." }, "nullable": true, "handle": "responseValueRenderOption", "value": null }, { "description": "How dates in the response should be rendered.", "jsonSchema": { "type": "string", "enum": [ "SERIAL_NUMBER", "FORMATTED_STRING" ], "description": "How dates in the response should be rendered." }, "nullable": true, "handle": "responseDateTimeRenderOption", "value": null } ], "outputs": [ { "description": "The unique ID of the spreadsheet.", "jsonSchema": { "type": "string", "description": "The unique ID of the spreadsheet." }, "nullable": false, "handle": "spreadsheetId" }, { "description": "The A1 notation of the range that was updated.", "jsonSchema": { "type": "string", "description": "The A1 notation of the range that was updated." }, "nullable": false, "handle": "updatedRange" }, { "description": "The number of rows that were updated.", "jsonSchema": { "type": "integer", "description": "The number of rows that were updated." }, "nullable": false, "handle": "updatedRows" }, { "description": "The number of columns that were updated.", "jsonSchema": { "type": "integer", "description": "The number of columns that were updated." }, "nullable": false, "handle": "updatedColumns" }, { "description": "The number of cells that were updated.", "jsonSchema": { "type": "integer", "description": "The number of cells that were updated." }, "nullable": false, "handle": "updatedCells" }, { "description": "The values of the cells after the update.", "jsonSchema": { "type": "object", "properties": { "range": { "type": "string", "description": "The A1 notation of the range." }, "majorDimension": { "type": "string", "description": "The major dimension of the values (ROWS or COLUMNS)." }, "values": { "type": "array", "items": { "type": "array", "items": { "anyOf": [ { "type": "string", "description": "A union variant." }, { "type": "number", "description": "A union variant." }, { "type": "boolean", "description": "A union variant." }, { "const": null, "description": "A union variant." } ], "description": "The cell value schema." }, "description": "An array item." }, "description": "The data values in the range." } }, "required": [ "range", "majorDimension", "values" ], "additionalProperties": false, "description": "The values of the cells after the update." }, "nullable": true, "handle": "updatedData" }, { "description": "The A1 notation of the table range that data was appended to.", "jsonSchema": { "type": "string", "description": "The A1 notation of the table range that data was appended to." }, "nullable": false, "handle": "tableRange" } ], "name": "Log one complete draft set", "executor": { "kind": "connector", "action": "googlesheets.spreadsheets_values_append" } } }, "n_cd7b7e07bb4f2106": { "name": "Return the logged platform drafts", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "success" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "requestId" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "title" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "completedAt" }, { "jsonSchema": { "type": "array", "items": { "type": "string" } }, "nullable": false, "handle": "platforms" }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "drafts" }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "message" } ], "outputMappings": { "success": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "success" } ] }, "requestId": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "requestId" } ] }, "title": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "title" } ] }, "completedAt": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "completedAt" } ] }, "platforms": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "platforms" } ] }, "drafts": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "drafts" } ] }, "message": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_16b8aa2d39bdac6b", "output": "result", "field": "message" } ] } } } }, "edges": [ { "source": "n_3623c43a600adc2a", "target": "n_4207cea1ad297db3" }, { "source": "n_ca6d5c35a616e476", "target": "n_4207cea1ad297db3" }, { "source": "n_4207cea1ad297db3", "target": "n_e5ced122ab46bade" }, { "source": "n_e5ced122ab46bade", "target": "n_545def70bbe4c4bd" }, { "source": "n_545def70bbe4c4bd", "target": "n_6e5c65ab77257837" }, { "source": "n_6e5c65ab77257837", "target": "n_938dfaf708d0abd4" }, { "source": "n_938dfaf708d0abd4", "target": "n_6c21161c8da1338d" }, { "source": "n_6c21161c8da1338d", "target": "n_6f7ae5e0ff43e89c" }, { "source": "n_6f7ae5e0ff43e89c", "target": "n_16b8aa2d39bdac6b" }, { "source": "n_16b8aa2d39bdac6b", "target": "n_b26667e7c3d8800d" }, { "source": "n_b26667e7c3d8800d", "target": "n_cd7b7e07bb4f2106" } ] } }, "modules": { "n_c2e8ad6894b4d193": { "name": "Validate the content brief", "imports": [], "source": "import {randomUUID} from 'node:crypto';\n\nexport default function prepareRepurposing({request}) {\n if (!request || typeof request !== 'object' || Array.isArray(request)) throw new Error('Submit a content object.');\n const content=request.content||request.text||'';\n if(typeof content!=='string'||content.trim().length<50) throw new Error('Content must be at least 50 characters.');\n const title=request.title||'Untitled',brandVoice=request.brand_voice||'professional yet approachable';\n if(typeof title!=='string'||typeof brandVoice!=='string') throw new Error('Title and brand_voice must be strings.');\n return {content,title,brandVoice,requestId:randomUUID(),processedAt:new Date().toISOString()};\n}\n" }, "n_e88086b7d592fca1": { "name": "Prepare shared platform prompts", "imports": [], "source": "export default function preparePlatformPrompts({analysis,title,brandVoice,requestId}) {\n if(!analysis||typeof analysis!=='object'||Array.isArray(analysis)) throw new Error('The analysis must be a JSON object.');\n for(const name of ['keyPoints','hashtags','seoKeywords']) if(!Array.isArray(analysis[name])||analysis[name].some(value=>typeof value!=='string'||!value.trim())) throw new Error('The analysis has invalid '+name+'.');\n if(typeof analysis.coreMessage!=='string'||!analysis.coreMessage.trim()) throw new Error('The analysis has no core message.');\n return {title,brandVoice,requestId,keyPointsJson:JSON.stringify(analysis.keyPoints),coreMessage:analysis.coreMessage};\n}\n" }, "n_c712d79e6715fa04": { "name": "Validate and collect all four drafts", "imports": [], "source": "export default function collectPlatformDrafts({requestId,title,twitter,linkedin,instagram,facebook}) {\n for(const [name,value] of Object.entries({twitter,linkedin,instagram,facebook})) if(!value||typeof value!=='object'||Array.isArray(value)) throw new Error(name+' must be a JSON object.');\n if(!Array.isArray(twitter.thread)||twitter.thread.length===0||twitter.thread.some(value=>typeof value!=='string'||!value.trim())) throw new Error('The X draft has no complete thread.');\n for(const [name,value] of [['LinkedIn post',linkedin.post],['Instagram caption',instagram.caption],['Facebook post',facebook.post]]) if(typeof value!=='string'||!value.trim()) throw new Error('The '+name+' is missing.');\n if(!Array.isArray(instagram.hashtags)||instagram.hashtags.some(value=>typeof value!=='string'||!value.trim())) throw new Error('The Instagram hashtags are invalid.');\n const completedAt=new Date().toISOString();\n return {values:[[requestId,title,completedAt,JSON.stringify(twitter.thread),linkedin.post,instagram.caption,facebook.post]],result:{success:true,requestId,title,completedAt,platforms:['twitter','linkedin','instagram','facebook'],drafts:{twitter,linkedin,instagram,facebook},message:'4 platform drafts generated and logged to Google Sheets.'}};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }