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": "DEV_RIO_704_Repurpose_Prepare",
"nodes": [
{
"parameters": {},
"id": "b1a10704-0000-4000-8000-000000000001",
"name": "Manual Trigger",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-848,
0
]
},
{
"parameters": {
"jsCode": "// DEV_RIO_704 \u4ed6\u5a92\u4f53\u30ea\u30d1\u30fc\u30d1\u30b9\u3010\u4e0b\u66f8\u304d\u6e96\u5099\u306e\u307f\u30fbdry-run\u3011\u3002\n// DEV_RIO_103 \u306e\u51fa\u529b(note_body/threads_post/theme/qa_status)\u3092\u53d7\u3051\u53d6\u308a\u3001\n// \u4ed6\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u5411\u3051\u306e\u4e0b\u66f8\u304d\u3092\u751f\u6210\u3059\u308b\u3002\u2605\u81ea\u52d5\u6295\u7a3f\u30fb\u81ea\u52d5\u5c55\u958b\u306f\u3057\u306a\u3044\uff08CLAUDE.md\u6e96\u62e0\uff09\u3002\n// qa_status \u304c\u7121\u3044\u624b\u52d5\u30c6\u30b9\u30c8\u6642\u306f 'PASS' \u6271\u3044\u3002\nconst i = $input.first().json;\nreturn [{ json: {\n content_id: i.content_id ?? 'ca-repurpose-001',\n theme: i.theme ?? '\uff08\u30c6\u30fc\u30de\u672a\u8a2d\u5b9a\uff09',\n note_body: i.note_body ?? i.note_draft_body ?? '',\n threads_post: i.threads_post ?? '',\n qa_status: i.qa_status ?? 'PASS',\n action_type: 'prepare_repurpose_drafts'\n} }];"
},
"id": "b1a10704-0000-4000-8000-000000000002",
"name": "Collect Inputs",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-624,
0
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "gate-qa-pass",
"leftValue": "={{ $json.qa_status }}",
"rightValue": "PASS",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "b1a10704-0000-4000-8000-000000000003",
"name": "QA Gate (PASS only)",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
-400,
0
]
},
{
"parameters": {
"jsCode": "// \u30ea\u30d1\u30fc\u30d1\u30b9\u4e0b\u66f8\u304d\u751f\u6210\u30d7\u30ed\u30f3\u30d7\u30c8\u3092 Anthropic body \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u7d44\u307f\u7acb\u3066\u308b\u3002\n// \u5bfe\u8c61\u30d5\u30a9\u30fc\u30de\u30c3\u30c8: instagram_caption / short_video_script / substack_intro\u3002\nconst i = $input.first().json;\nconst excerpt = String(i.note_body || '').slice(0, 600);\nconst prompt = `\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u3001\u4ed6\u5a92\u4f53\u5411\u3051\u306b\u300e\u30ea\u30d1\u30fc\u30d1\u30b9\u300f\u3057\u305f\u4e0b\u66f8\u304d\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u6295\u7a3f\u306f\u305b\u305a\u4e0b\u66f8\u304d\u306e\u307f\u3002\\n\\n\u30c6\u30fc\u30de: ${i.theme}\\n\u5143\u8a18\u4e8b(note)\u629c\u7c8b: ${excerpt}\\n\u5143Threads\u6295\u7a3f: ${i.threads_post}\\n\\n\u6b21\u306e3\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u54041\u6848\u3001\u65e5\u672c\u8a9e\u3067:\\n- instagram_caption: Instagram\u7528\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3(\u7d75\u6587\u5b57\u53ef\u30fb\u30cf\u30c3\u30b7\u30e5\u30bf\u30b03\u301c5)\\n- short_video_script: 60\u79d2\u30b7\u30e7\u30fc\u30c8\u52d5\u753b\u306e\u53f0\u672c(\u30d5\u30c3\u30af\u2192\u672c\u7de83\u70b9\u2192CTA\u306e\u69cb\u6210\u30fb\u30ca\u30ec\u30fc\u30b7\u30e7\u30f3\u6587\u306e\u307f)\\n- substack_intro: Substack\u30cb\u30e5\u30fc\u30b9\u30ec\u30bf\u30fc\u306e\u5c0e\u5165\u6587(3\u301c4\u6587)\\n\\n\u6ce8\u610f: \u8a87\u5f35\u30fb\u865a\u507d\u306e\u6570\u5024\u30fb\u65ad\u5b9a\u7684\u306a\u6210\u679c\u4fdd\u8a3c\u306f\u7981\u6b62\u3002\u5143\u8a18\u4e8b\u306b\u306a\u3044\u4e8b\u5b9f\u3092\u5275\u4f5c\u3057\u306a\u3044\u3002\\n\u51fa\u529b\u306f\u6b21\u306eJSON\u914d\u5217\u306e\u307f\uff08\u524d\u5f8c\u306b\u8aac\u660e\u30fb\u30b3\u30fc\u30c9\u30d6\u30ed\u30c3\u30af\u8a18\u53f7\u3092\u4ed8\u3051\u306a\u3044\uff09:\\n[{\"format\":\"instagram_caption\",\"text\":\"string\"},{\"format\":\"short_video_script\",\"text\":\"string\"},{\"format\":\"substack_intro\",\"text\":\"string\"}]`;\nconst anthropic_body = {\n model: 'claude-haiku-4-5',\n max_tokens: 2048,\n messages: [ { role: 'user', content: prompt } ]\n};\nreturn [{ json: { ...i, anthropic_body } }];"
},
"id": "b1a10704-0000-4000-8000-000000000004",
"name": "Build Repurpose Prompt",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-176,
-112
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.anthropic.com/v1/messages",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "anthropicApi",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "anthropic-version",
"value": "2023-06-01"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ $json.anthropic_body }}",
"options": {
"timeout": 30000
}
},
"id": "b1a10704-0000-4000-8000-000000000005",
"name": "Generate Repurpose Drafts (Claude)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
48,
-112
],
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"continueOnFail": true
},
{
"parameters": {
"jsCode": "// Claude\u5fdc\u7b54\u3092\u30d1\u30fc\u30b9\u3002\u5931\u6557\u6642\u306f\u634f\u9020\u305b\u305a parse_error \u3092\u660e\u793a\u3002\u516c\u958b\u76f4\u524d\u3067\u505c\u6b62\u3002\nconst input = $input.first().json;\nconst ctx = $('Collect Inputs').first().json;\nlet drafts = [];\nlet parse_error = null;\nif (input.error) {\n parse_error = 'anthropic_api_error: ' + JSON.stringify(input.error).slice(0, 300);\n} else {\n try {\n const text = input.content && input.content[0] && input.content[0].text;\n if (!text) throw new Error('no text in response');\n const cleaned = text.trim().replace(/^```json\\s*/i, '').replace(/```\\s*$/, '');\n const match = cleaned.match(/\\[[\\s\\S]*\\]/);\n drafts = JSON.parse(match ? match[0] : cleaned);\n if (!Array.isArray(drafts) || drafts.length === 0) throw new Error('drafts missing/empty');\n drafts = drafts.map(d => ({ format: d.format ?? 'unknown', text: d.text ?? '' }));\n } catch (e) {\n parse_error = 'parse_failed: ' + e.message;\n }\n}\nif (parse_error) drafts = [{ format: 'manual', text: '\uff08AI\u5fdc\u7b54\u306e\u53d6\u5f97/\u89e3\u6790\u306b\u5931\u6557\u3002\u624b\u52d5\u3067\u4e0b\u66f8\u304d\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\uff09' }];\nconst idempotency_key = ['repurpose', ctx.content_id, ctx.action_type].join('|');\nreturn [{ json: {\n content_id: ctx.content_id,\n repurpose_drafts: drafts,\n draft_count: drafts.length,\n idempotency_key,\n state: 'WAITING_APPROVAL',\n published: false,\n draft_error: parse_error,\n note: 'dry-run\u3002\u4ed6\u5a92\u4f53\u30ea\u30d1\u30fc\u30d1\u30b9\u4e0b\u66f8\u304d\u306e\u307f\u751f\u6210\u3002\u2605\u81ea\u52d5\u6295\u7a3f\u30fb\u81ea\u52d5\u5c55\u958b\u306f\u3057\u306a\u3044\u3002\u4eba\u9593\u304c\u5404\u5a92\u4f53\u306b\u624b\u52d5\u3067\u6295\u7a3f\u3059\u308b\uff08CLAUDE.md \u6e96\u62e0\uff09\u3002'\n} }];"
},
"id": "b1a10704-0000-4000-8000-000000000006",
"name": "Stop Before Publish",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
272,
-112
]
},
{
"parameters": {},
"id": "b1a10704-0000-4000-8000-000000000007",
"name": "Result (repurpose drafts only)",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
496,
-112
]
},
{
"parameters": {
"jsCode": "// QA\u30b2\u30fc\u30c8\u4e0d\u901a\u904e\u3002\u30ea\u30d1\u30fc\u30d1\u30b9\u751f\u6210\u3092\u30b9\u30ad\u30c3\u30d7\u3002\nconst i = $input.first().json;\nreturn [{ json: {\n content_id: i.content_id,\n skipped: true,\n qa_status: i.qa_status,\n state: 'SKIPPED_NOT_PASS',\n published: false,\n note: 'qa_status \u304c PASS \u3067\u306f\u306a\u3044\u305f\u3081\u30ea\u30d1\u30fc\u30d1\u30b9\u4e0b\u66f8\u304d\u751f\u6210\u3092\u30b9\u30ad\u30c3\u30d7\u3002'\n} }];"
},
"id": "b1a10704-0000-4000-8000-000000000008",
"name": "Skip (not PASS)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-176,
176
]
}
],
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Collect Inputs",
"type": "main",
"index": 0
}
]
]
},
"Collect Inputs": {
"main": [
[
{
"node": "QA Gate (PASS only)",
"type": "main",
"index": 0
}
]
]
},
"QA Gate (PASS only)": {
"main": [
[
{
"node": "Build Repurpose Prompt",
"type": "main",
"index": 0
}
],
[
{
"node": "Skip (not PASS)",
"type": "main",
"index": 0
}
]
]
},
"Build Repurpose Prompt": {
"main": [
[
{
"node": "Generate Repurpose Drafts (Claude)",
"type": "main",
"index": 0
}
]
]
},
"Generate Repurpose Drafts (Claude)": {
"main": [
[
{
"node": "Stop Before Publish",
"type": "main",
"index": 0
}
]
]
},
"Stop Before Publish": {
"main": [
[
{
"node": "Result (repurpose drafts only)",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"active": false,
"meta": {
"description": "DEV_RIO_704 Repurpose Prepare. dry-run. qa_status=PASS \u306e\u3068\u304d\u306e\u307f note\u8a18\u4e8b\u3092\u4ed6\u5a92\u4f53(Instagram/\u30b7\u30e7\u30fc\u30c8\u52d5\u753b\u53f0\u672c/Substack)\u5411\u3051\u306b\u30ea\u30d1\u30fc\u30d1\u30b9\u3057\u305f\u4e0b\u66f8\u304d\u3092\u751f\u6210\u3057\u516c\u958b\u76f4\u524d\u3067\u505c\u6b62\u3002NEVER publish/auto-distribute/activate\u3002\u4eba\u9593\u304c\u5404\u5a92\u4f53\u3078\u624b\u52d5\u6295\u7a3f\u3002"
},
"tags": [
{
"name": "DEV"
},
{
"name": "RIO"
},
{
"name": "REPURPOSE"
}
]
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
anthropicApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
DEV_RIO_704_Repurpose_Prepare. Uses httpRequest. Event-driven trigger; 8 nodes.
Source: https://gist.github.com/YuuTKD/15109cb775b30fe18b57d46af7f1c5ee — 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.
This workflow listens for an “Approved” label on a Trello card, reads the AI draft bookkeeping JSON from card comments, and posts the corresponding transaction to Xero. It then adds a Xero deep link b
02_LLM_Pipeline v1.0. Uses executeWorkflowTrigger, httpRequest, seaTable. Event-driven trigger; 65 nodes.
This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t
[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.
[](https://youtu.be/c7yCZhmMjtI)