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": "\u8bd7\u8bcd\u56fe\u50cf\u751f\u6210",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "generate-image",
"responseMode": "responseNode"
},
"id": "image-webhook",
"name": "\u56fe\u50cf\u63a5\u53e3",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
200,
300
]
},
{
"parameters": {
"jsCode": "const requestData = $input.first().json;\nconst { poemTitle = '', poemContent = '', style = 'traditional' } = requestData;\n\nconst imageResponse = {\n success: true,\n imageUrl: `https://picsum.photos/400/300?random=${Date.now()}`,\n poemTitle: poemTitle,\n style: style,\n description: `\u4e3a\u300a${poemTitle}\u300b\u751f\u6210\u7684${style === 'traditional' ? '\u4f20\u7edf' : '\u73b0\u4ee3'}\u98ce\u683c\u914d\u56fe`,\n timestamp: new Date().toISOString(),\n fallback: true,\n message: '\u56fe\u50cf\u751f\u6210\u529f\u80fd\u6b63\u5728\u5f00\u53d1\u4e2d\uff0c\u5f53\u524d\u663e\u793a\u793a\u4f8b\u56fe\u7247'\n};\n\nreturn imageResponse;"
},
"id": "image-generation",
"name": "\u56fe\u50cf\u751f\u6210",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
400,
300
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ $json }}"
},
"id": "image-response",
"name": "\u8fd4\u56de\u56fe\u50cf",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
600,
300
]
}
],
"connections": {
"\u56fe\u50cf\u63a5\u53e3": {
"main": [
[
{
"node": "\u56fe\u50cf\u751f\u6210",
"type": "main",
"index": 0
}
]
]
},
"\u56fe\u50cf\u751f\u6210": {
"main": [
[
{
"node": "\u8fd4\u56de\u56fe\u50cf",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"versionId": "1"
}
About this workflow
诗词图像生成. Uses respondToWebhook. Webhook trigger; 3 nodes.
Source: https://github.com/OmagariHare258/classical-poetry-learning/blob/7ce1335124e2943167578bf58815deefdff9d3dc/n8n-workflows/06-image-generation.json — original creator credit. Request a take-down →