The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Horror Story - Template Selection",
"nodes": [
{
"parameters": {},
"name": "Manual Trigger",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
240,
300
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "template_path",
"value": "templates/horror_story_prompt_template.json"
}
]
},
"options": {}
},
"name": "Set: Template Selection",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
460,
300
],
"notes": "\uc5ec\uae30\uc11c \ud15c\ud50c\ub9bf\uc744 \uc120\ud0dd\ud558\uc138\uc694:\n- templates/horror_story_prompt_template.json (\uae30\ubcf8)\n- templates/sample.json\n- templates/horror_story_prompt_short.json (\uc9e7\uc740 \ubc84\uc804)\n- templates/horror_story_prompt_psychological.json (\uc2ec\ub9ac \ud638\ub7ec)"
},
{
"parameters": {
"command": "=cd /Users/vinyl/vinylstudio/n8n-test && poetry run python3 -c \"from horror_story_generator import generate_horror_story; generate_horror_story(template_path='{{ $json.template_path }}')\"",
"options": {
"timeout": 180000
}
},
"name": "Execute: Generate with Template",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
680,
300
]
},
{
"parameters": {
"jsCode": "// Execute Command \ub178\ub4dc\uc758 \ucd9c\ub825\uc5d0\uc11c \ud30c\uc77c \uacbd\ub85c \ucd94\ucd9c\nconst stdout = $input.item.json.stdout;\n\n// \uc815\uaddc\uc2dd\uc73c\ub85c \ud30c\uc77c \uacbd\ub85c \ucd94\ucd9c\nconst mdPathMatch = stdout.match(/\uc800\uc7a5 \uc704\uce58: (.+\\.md)/);\n\nif (mdPathMatch) {\n const mdPath = mdPathMatch[1];\n const absoluteMdPath = mdPath.startsWith('/') ? mdPath : `/Users/vinyl/vinylstudio/n8n-test/${mdPath}`;\n const metadataPath = absoluteMdPath.replace('.md', '_metadata.json');\n \n return {\n json: {\n md_file_path: absoluteMdPath,\n metadata_file_path: metadataPath,\n template_used: $('Set: Template Selection').item.json.template_path,\n full_output: stdout,\n exit_code: $input.item.json.exitCode\n }\n };\n} else {\n throw new Error('\ud30c\uc77c \uacbd\ub85c\ub97c \ucc3e\uc744 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4');\n}"
},
"name": "Extract File Paths",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
900,
300
]
},
{
"parameters": {
"filePath": "={{ $json.metadata_file_path }}",
"options": {}
},
"name": "Read: Metadata JSON",
"type": "n8n-nodes-base.readBinaryFile",
"typeVersion": 1,
"position": [
1120,
300
]
},
{
"parameters": {
"jsCode": "// \uba54\ud0c0\ub370\uc774\ud130 JSON \ud30c\uc2f1\nconst metadataContent = $input.item.binary.data;\nconst metadataText = Buffer.from(metadataContent.data, 'base64').toString('utf-8');\nconst metadata = JSON.parse(metadataText);\n\n// \uac04\ub2e8\ud55c \uc644\uacb0\uc131 \uac80\uc99d\nconst wordCount = metadata.word_count || 0;\nconst outputTokens = metadata.usage?.output_tokens || 0;\nconst maxTokens = 8192;\n\n// \uac80\uc99d \ub85c\uc9c1\nconst isComplete = wordCount >= 1000 && outputTokens < maxTokens;\n\nreturn {\n json: {\n template_used: $('Extract File Paths').item.json.template_used,\n title: metadata.title,\n word_count: wordCount,\n output_tokens: outputTokens,\n tags: metadata.tags,\n is_complete: isComplete,\n validation_message: isComplete ? 'Generation successful' : 'Output may be incomplete',\n metadata: metadata\n }\n};"
},
"name": "Validate Output",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1340,
300
]
}
],
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Set: Template Selection",
"type": "main",
"index": 0
}
]
]
},
"Set: Template Selection": {
"main": [
[
{
"node": "Execute: Generate with Template",
"type": "main",
"index": 0
}
]
]
},
"Execute: Generate with Template": {
"main": [
[
{
"node": "Extract File Paths",
"type": "main",
"index": 0
}
]
]
},
"Extract File Paths": {
"main": [
[
{
"node": "Read: Metadata JSON",
"type": "main",
"index": 0
}
]
]
},
"Read: Metadata JSON": {
"main": [
[
{
"node": "Validate Output",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2026-01-02T00:00:00.000Z",
"versionId": "1"
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Horror Story - Template Selection. Uses executeCommand, readBinaryFile. Event-driven trigger; 6 nodes.
Source: https://github.com/VinylStage/horror-story-generator/blob/7cba6a81f30d8d5523fe5418d3034ab077fe1fb2/docs/archive/n8n_workflows/02_template_selection.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Product - Google Search Console API Examples. Uses httpRequest. Event-driven trigger; 36 nodes.
This workflow contains community nodes that are only compatible with the self-hosted version of n8n.
Metavoir Creative Intake To Review Brief. Event-driven trigger; 21 nodes.
Retry on fail except for known error Template. Uses stopAndError, noOp, stickyNote, manualTrigger. Event-driven trigger; 19 nodes.