基于Web数据的AI图表生成与WordPress上传
中级
这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 Code、HttpRequest、ManualTrigger、Agent、OpenAi 等节点。 基于Web数据的AI驱动图表生成,使用GPT-4o并上传至WordPress
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (15 个)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "52254486b159b349334953c1738da94e90477c7604aa8db2062d11afc0120739",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "502f1b86-95d7-49c1-9503-2a38e37ff9ba",
"name": "当由另一个工作流执行时",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
992,
-224
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "prompt"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "88196843-a411-4ef0-ba4e-df54fc8f924f",
"name": "QuickChart 对象模式",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1920,
-16
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"slug\": {\n \"type\": \"string\",\n \"description\": \"Proposed image filename or identifier (e.g., 'ev-sales-2024')\"\n },\n \"width\": {\n \"type\": \"string\",\n \"description\": \"Pixel width of the image canvas (e.g., '500')\"\n },\n \"height\": {\n \"type\": \"string\",\n \"description\": \"Pixel height of the image canvas (e.g., '300')\"\n },\n \"devicePixelRatio\": {\n \"type\": \"number\",\n \"description\": \"Device pixel ratio (e.g., 2)\"\n },\n \"format\": {\n \"type\": \"string\",\n \"enum\": [\"png\", \"jpeg\", \"webp\", \"svg\", \"pdf\"],\n \"description\": \"Output format of the image\"\n },\n \"backgroundColor\": {\n \"type\": \"string\",\n \"description\": \"Canvas background color in hex or named CSS color, make it white #FFFFFF by default\"\n },\n \"version\": {\n \"type\": \"string\",\n \"description\": \"Chart.js version (e.g., '3.9.1')\"\n },\n \"chart\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\"line\", \"bar\", \"doughnut\", \"pie\", \"polarArea\"]\n },\n \"data\": {\n \"type\": \"object\",\n \"properties\": {\n \"labels\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" },\n \"minItems\": 1\n },\n \"datasets\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"label\": { \"type\": \"string\" },\n \"data\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"number\" },\n \"minItems\": 1\n },\n \"backgroundColor\": {\n \"type\": [\"string\", \"array\"],\n \"items\": { \"type\": \"string\" }\n },\n \"borderColor\": {\n \"type\": [\"string\", \"array\"],\n \"items\": { \"type\": \"string\" }\n },\n \"fill\": { \"type\": [\"boolean\", \"string\"] },\n \"borderWidth\": { \"type\": \"number\" }\n },\n \"required\": [\"label\", \"data\"]\n },\n \"minItems\": 1\n }\n },\n \"required\": [\"labels\", \"datasets\"]\n },\n \"options\": {\n \"type\": \"object\",\n \"description\": \"Chart.js configuration options including title, plugins, scales, etc.\"\n }\n },\n \"required\": [\"type\", \"data\"]\n }\n },\n \"required\": [\"slug\", \"chart\"],\n \"default\": {\n \"format\": \"png\",\n \"backgroundColor\": \"white\"\n }\n}\n"
},
"typeVersion": 1.2
},
{
"id": "9a398d7a-0435-44d2-9cbb-e5156fbad68f",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1664,
-16
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "k5QLUV8boAepwce0",
"name": "OpenAi account - default project"
}
},
"typeVersion": 1.2
},
{
"id": "0afadfd3-348a-4df7-958b-c14eca32b316",
"name": "上传图片2",
"type": "n8n-nodes-base.httpRequest",
"position": [
2272,
-224
],
"parameters": {
"url": "https://your.wordpress.com/wp-json/wp/v2/media",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "binaryData",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Disposition",
"value": "=attachment; filename=\"chart-{{ $json.output.slug }}.png\""
}
]
},
"inputDataFieldName": "data",
"nodeCredentialType": "wordpressApi"
},
"credentials": {
"wordpressApi": {
"id": "G1G8jDdEoWAVytQb",
"name": "Wordpress - author@email.com"
}
},
"retryOnFail": true,
"typeVersion": 4.2,
"waitBetweenTries": 5000
},
{
"id": "bb57c519-8dff-4bf5-8db6-a1c17c9bfb78",
"name": "生成图表 AI 代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1664,
-224
],
"parameters": {
"text": "={{ $json.message.content }}",
"options": {
"systemMessage": "You are a Chart.js configuration agent. Your task is to transform a user-provided data table into a valid QuickChart JSON object compatible with line, bar, pie, doughnut, or polarArea charts.\n\nInstructions:\n1. Read and interpret the markdown table input provided by the data agent.\n2. Based on structure, choose the most appropriate chart type from:\n - \"line\", \"bar\" → for time series or value comparison\n - \"pie\", \"doughnut\", \"polarArea\" → for proportion-based data\n3. Construct a valid Chart.js object following QuickChart format.\n4. Always include:\n - `type`\n - `data.labels`\n - `data.datasets` (with `label`, `data`, `backgroundColor`)\n - `options.plugins.title.text` with a suitable chart title\n\nOutput only valid JSON matching the schema:\n- No code blocks\n- No markdown\n- No explanations"
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "e6235b7c-6b11-4cba-bc0c-9e22db2e8220",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
992,
-32
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9570f247-b9f1-49b2-b104-6adcbe32e450",
"name": "向模型发送消息",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1248,
-224
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-search-preview",
"cachedResultName": "GPT-4O-SEARCH-PREVIEW"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "You are a data aggregation AI agent with access to real-time web search. Your goal is to collect relevant, structured, and up-to-date data from trusted sources based on the user's query.\n\nInstructions:\n1. Search the web for reliable, factual, and recent data related to the query.\n2. Extract the data into a clean, readable table format (markdown table).\n3. The table should contain categories (e.g. country, platform, year) as rows or columns depending on structure.\n4. Include source URLs for each data group, appended below the table.\n\nRules:\n- Do not interpret or visualize the data.\n- Do not generate charts.\n- Do not summarize or paraphrase data.\n- Return only the data table and source list in markdown format."
},
{
"content": "={{ $json.prompt }}"
}
]
}
},
"credentials": {
"openAiApi": {
"id": "k5QLUV8boAepwce0",
"name": "OpenAi account - default project"
}
},
"typeVersion": 1.8
},
{
"id": "5002b0f9-036d-4416-b36a-818c699e0b71",
"name": "思考1",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1792,
-16
],
"parameters": {},
"typeVersion": 1
},
{
"id": "7612a971-459f-4106-8b0d-eda11b23f46a",
"name": "创建 QuickChart",
"type": "n8n-nodes-base.httpRequest",
"position": [
2032,
-224
],
"parameters": {
"url": "=https://quickchart.io/chart",
"method": "POST",
"options": {},
"jsonBody": "={{ $json.output }}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "b654b232-2e12-4864-a829-752b77abc3c4",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
2496,
-224
],
"parameters": {
"jsCode": "return {\n \"research\" : $('Message a model').first().json,\n \"graph_data\" : $('Generate Chart AI agent').first().json.output,\n \"graph_image\" : $('Upload image2').first().json,\n \"result_image_url\" : $('Upload image2').first().json.guid.raw\n}"
},
"typeVersion": 2
},
{
"id": "6e184446-0d1c-43fa-8bc0-862bca3b17a2",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1216,
-320
],
"parameters": {
"color": 5,
"width": 336,
"height": 448,
"content": "## 搜索网络"
},
"typeVersion": 1
},
{
"id": "abca6241-a82c-4a6f-b604-fecdb4268533",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1568,
-320
],
"parameters": {
"color": 4,
"width": 624,
"height": 448,
"content": "## 生成图表"
},
"typeVersion": 1
},
{
"id": "acfa1a4d-d900-445b-a1a1-90147ee441d9",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
2208,
-320
],
"parameters": {
"color": 6,
"width": 224,
"height": 448,
"content": "## 上传图表图片到 WP"
},
"typeVersion": 1
},
{
"id": "5a9349d9-6d61-4aac-9ead-a3bb44506d5d",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1568,
144
],
"parameters": {
"color": 7,
"width": 864,
"height": 576,
"content": "## 将表格转换为 chart.js"
},
"typeVersion": 1
},
{
"id": "3e89f9d7-d068-49c2-a22c-3424fa2de70e",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
144
],
"parameters": {
"color": 7,
"width": 592,
"height": 576,
"content": "## 搜索网络并生成表格"
},
"typeVersion": 1
}
],
"pinData": {
"When clicking ‘Execute workflow’": [
{
"prompt": "Generate a graph of apple's market share in the mobile phone market in q1 2025"
}
]
},
"connections": {
"Think1": {
"ai_tool": [
[
{
"node": "Generate Chart AI agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Upload image2": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "Generate Chart AI agent",
"type": "main",
"index": 0
}
]
]
},
"Create QuickChart": {
"main": [
[
{
"node": "Upload image2",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Generate Chart AI agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Generate Chart AI agent": {
"main": [
[
{
"node": "Create QuickChart",
"type": "main",
"index": 0
}
]
]
},
"QuickChart Object Schema": {
"ai_outputParser": [
[
{
"node": "Generate Chart AI agent",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
内容生成器 v3
AI驱动博客自动化:使用GPT-4生成并发布SEO文章至WordPress和Twitter
If
Set
Code
+25
144 节点Jay Emp0
Content Creation
使用 OpenAI、ElevenLabs 和 Fal.ai 自动化病毒式内容创作,适用于视频、播客和 ASMR
使用 OpenAI、ElevenLabs 和 Fal.ai 自动化病毒式内容创作,适用于视频、播客和 ASMR
Set
Code
Wait
+16
97 节点Adam Crafts
Content Creation
💥 使用NanoBanana、Seedream 4、ChatGPT Image和Veo 3自动化视频广告 - VIDE
使用AI(NanoBanana、Seedream、GPT-4o、Veo 3)自动化和发布视频广告活动
Set
Code
Wait
+16
63 节点Dr. Firas
Content Creation
使用AI、Hedra和ElevenLabs生成病毒式婴儿名人播客
使用AI、Hedra和ElevenLabs生成病毒式婴儿名人播客
Code
Wait
Merge
+11
35 节点LeeWei
Content Creation
Gemini_NanoBanana_模板
使用 Fal.ai 模型(nano-banana、WAN2.2、Veo3)从 Google Sheets 生成 UGC 广告
If
Set
Code
+13
36 节点Jaruphat J.
Content Creation
基于 YouTube 视频的自主博客发布
使用 ChatGPT、Sheets、Apify、Pexels 和 WordPress 从 YouTube 视频自主发布博客
If
Set
Code
+18
80 节点Oriol Seguí
Content Creation
工作流信息
难度等级
中级
节点数量15
分类2
节点类型10
作者
Jay Emp0
@jay-emp0AI and Automation developer. Im implementing n8n and ai tools to automate marketing and sales in companies
外部链接
在 n8n.io 上查看 →
分享此工作流