8
n8n 中文网amn8n.com

博客文章:生态系统趋势

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 If, Code, Wait, HttpRequest, GoogleSheets 等节点。 使用Perplexity、GPT、Leonardo和WordPress自动生成SEO博客文章

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "OcdRRO25OfTnrILJ",
  "meta": {
    "instanceId": "d97a35efa9230ba825e389dcf8247ce5a77a88f4113df9825ba41d6ce9398085",
    "templateId": "4352",
    "templateCredsSetupCompleted": true
  },
  "name": "博客文章:生态系统趋势",
  "tags": [],
  "nodes": [
    {
      "id": "cc9b1e41-aaeb-43fb-a283-e3faf397cc73",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1480,
        610
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 6 * * 1"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "01d0a3b7-66db-4032-b7d7-7a7b273920a7",
      "name": "研究主题 - Perplexity",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1260,
        610
      ],
      "parameters": {
        "url": "https://api.perplexity.ai/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"sonar-pro\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"Eres un asistente experto en generar artículos SEO en español neutro sobre startups tecnológicas. El tono debe ser educativo, práctico, reflexivo e inspirador.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Redacta un artículo basado en la tendencia más relevante del ecosistema de startups tecnológicas hispanohablantes del día.\\n\\nDevuelve la respuesta estrictamente en formato JSON con esta estructura:\\n{\\n  \\\"title\\\": \\\"[título atractivo en una sola línea]\\\",\\n  \\\"content\\\": \\\"[cuerpo del artículo en HTML limpio, sin caracteres escapados, sin markdown, sin saltos \\\\n, y sin comentarios externos. Usar solo etiquetas estándar de HTML como <p>, <h2>, <ul>, <li>, <strong> y <em>. No uses etiquetas personalizadas ni scripts.]\\\"\\n}\\n\\nEl artículo debe:\\n- Tener entre 1000 y 1500 palabras.\\n- Incluir subtítulos usando <h2>.\\n- Iniciar con un gancho atractivo de máximo 3 frases dentro de <p>.\\n- Incluir al menos 2 datos estadísticos actuales con fuente (en texto).\\n- Ofrecer mínimo 3 consejos útiles, en formato de lista con <ul> y <li>.\\n- Terminar con una reflexión motivadora e invitación a sumarse a la comunidad (sin enlaces).\\n- Usar naturalmente palabras clave como: startups tecnológicas, innovación, emprendimiento, inversión, comunidad.\\n\\nNo agregues ningún texto ni explicación fuera del objeto JSON.\"\n    }\n  ]\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "perplexityApi"
      },
      "credentials": {
        "perplexityApi": {
          "id": "mq8RUNimEAzTbApC",
          "name": "Perplexity account"
        },
        "httpHeaderAuth": {
          "id": "nXLy55sVzgMHDbHR",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f70d8187-0f57-4680-8155-420d060536f0",
      "name": "在 Wordpress 中创建文章",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        860,
        760
      ],
      "parameters": {
        "url": "https://cristiantala.com/wp-json/wp/v2/posts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"title\": \"{{ $('Get Title, Content, and Image FileName').item.json.title }}\",\n  \"content\": \"{{ $('Get Title, Content, and Image FileName').item.json.content }}\",\n  \"status\": \"publish\",\n  \"categories\": [\n    916\n  ],\n  \"featured_media\": {{ $('Upload Image to Wordpress').item.json.id }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "atshoATHWCYP6uAv",
          "name": "WP CTala"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "b306aff7-c8b0-4bf7-9eb1-d8eeee45da6e",
      "name": "向模型发送消息",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -820,
        610
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Generate a single-line English description of an editorial-style image to visually represent the following article.\n\nThe image must follow these rules:\n- Cinematic, editorial look (not cartoonish or abstract).\n- No visible text or logos.\n- Must work for a blog post featured image in Google News and Discover (ideal size: 1200x628 px).\n- The article title is: \"{{ $json.title }}\"\n- Article content: {{ $json.content }}.\n\nOutput just the English prompt, without quotes or formatting."
            },
            {
              "role": "system",
              "content": "You are an expert in crafting AI image generation prompts for editorial and news images. You help generate cinematic, editorial-style prompts for blog images that perform well in Google News and Google Discover. Avoid any text or logos in the result."
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "gaxCelkF84KGUr4n",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "e3786cd7-baac-4e9e-bd45-63ec3b5cfd5e",
      "name": "上传图片到Wordpress",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        420,
        760
      ],
      "parameters": {
        "url": "https://cristiantala.com/wp-json/wp/v2/media",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Disposition",
              "value": "=attachment; filename=\"{{ $('Get Title, Content, and Image FileName').item.json.image_filename }}\""
            },
            {
              "name": "Content-Type",
              "value": "image/jpeg"
            }
          ]
        },
        "inputDataFieldName": "data"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "atshoATHWCYP6uAv",
          "name": "WP CTala"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "bd779c40-a90d-4412-935a-7adc30e431fc",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        -20,
        560
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "132de601-8ca1-46b4-9ae3-67baa33f28ad",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.generations_by_pk.status }}",
              "rightValue": "COMPLETE"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "24b8ff73-0eff-41ce-b99b-27d4210838ac",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        200,
        560
      ],
      "webhookId": "d14af83a-15dc-4387-adf9-0f8b785faa0c",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "072b61c5-7494-42cd-808f-bb311605f4a3",
      "name": "获取 Leonardo 图片状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -240,
        610
      ],
      "parameters": {
        "url": "=https://cloud.leonardo.ai/api/rest/v1/generations/{{ $json.sdGenerationJob.generationId }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "LjE8BhoG7Ai8SXvB",
          "name": "Bearer LeonardoAI"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "da14ecc4-ca0f-445e-9c87-0148a602bfc2",
      "name": "获取 Leonardo 图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        200,
        760
      ],
      "parameters": {
        "url": "={{ $json.generations_by_pk.generated_images[0].url }}",
        "options": {}
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "02b052f2-0771-42b3-b4e8-526375654118",
      "name": "为图片添加 ALT",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        760
      ],
      "parameters": {
        "url": "=https://cristiantala.com/wp-json/wp/v2/media/{{ $json.id }}",
        "method": "PUT",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "alt_text",
              "value": "={{ $('Message a model').item.json.message.content }}"
            }
          ]
        },
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "atshoATHWCYP6uAv",
          "name": "WP CTala"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "07078bdd-6d8e-485e-9581-e359361feba9",
      "name": "Wordpress 发布:初创公司和科技",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1080,
        760
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $json.guid.raw }}",
            "Tipo": "Post WP",
            "Topic": "={{ $json.title.rendered }}",
            "Status": "Posted",
            "URL Imagen": "={{ $('Upload Image to Wordpress').item.json.guid.rendered }}",
            "Contenido AI": "={{ $json.content.raw }}",
            "Fecha del Posteo": "={{ $json.date }}"
          },
          "schema": [
            {
              "id": "Topic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Topic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Tipo",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Tipo",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Contenido AI",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Contenido AI",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Fecha del Posteo",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Fecha del Posteo",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL Imagen",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL Imagen",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Topic"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1s3HKV8M3U8NvOp1CxERz8tnC9ibYmnB4Pztgv1ZjkOQ/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1s3HKV8M3U8NvOp1CxERz8tnC9ibYmnB4Pztgv1ZjkOQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1s3HKV8M3U8NvOp1CxERz8tnC9ibYmnB4Pztgv1ZjkOQ/edit?usp=drivesdk",
          "cachedResultName": "Publicaciones RRSS"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "qz04WB2vwS3Lcxwc",
          "name": "IAM - Google Sheets"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "ce87f8ee-3d53-462c-9df5-921fdc42d17c",
      "name": "Leonardo:创建文章图片",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -460,
        610
      ],
      "parameters": {
        "url": "https://cloud.leonardo.ai/api/rest/v1/generations",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"prompt\": \"{{ $json.message.content }}\",\n  \"modelId\": \"6bef9f1b-29cb-40c7-b9df-32b51c1f67d3\",\n  \"width\": 1280,\n  \"height\": 720,\n  \"sd_version\": \"v2\",\n  \"num_images\": 1,\n  \"promptMagic\": true,\n  \"promptMagicStrength\": 0.5,\n  \"public\": false,\n  \"scheduler\": \"LEONARDO\",\n  \"guidance_scale\": 7\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "LjE8BhoG7Ai8SXvB",
          "name": "Bearer LeonardoAI"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "c8e83410-b334-4c2e-8095-0d424dd8455f",
      "name": "获取标题、内容和图片文件名",
      "type": "n8n-nodes-base.code",
      "position": [
        -1040,
        610
      ],
      "parameters": {
        "jsCode": "const data = JSON.parse($input.first().json.choices[0].message.content);\n\n// Función para generar slug SEO-friendly\nfunction toSlug(text) {\n  return text\n    .toLowerCase()\n    .normalize(\"NFD\")                   // elimina acentos\n    .replace(/[\\u0300-\\u036f]/g, \"\")   // elimina diacríticos\n    .replace(/[^a-z0-9\\s-]/g, \"\")      // elimina caracteres especiales\n    .replace(/\\s+/g, \"-\")              // reemplaza espacios por guiones\n    .replace(/-+/g, \"-\")               // evita guiones dobles\n    .replace(/^-|-$/g, \"\");            // quita guiones iniciales y finales\n}\n\nconst imageName = toSlug(data.title) + \".jpg\";\n\nreturn [\n  {\n    json: {\n      title: data.title,\n      content: data.content,\n      image_filename: imageName\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "611ebda2-da9a-4104-9888-5934afbfbe3d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1100,
        800
      ],
      "parameters": {
        "height": 260,
        "content": "## 节点\"获取标题、内容和图片文件名\"的问题"
      },
      "typeVersion": 1
    },
    {
      "id": "0f807531-ad62-40a8-8778-a4f7dcfc3c63",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        960
      ],
      "parameters": {
        "content": "## 图片 ALT 文本"
      },
      "typeVersion": 1
    },
    {
      "id": "23f62c23-08c5-4da9-8579-a4b1077b43e1",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        980
      ],
      "parameters": {
        "width": 540,
        "height": 120,
        "content": "## 使用 LeonardoAI 生成图片"
      },
      "typeVersion": 1
    },
    {
      "id": "56512471-538c-478f-9406-685f8501a8aa",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        840
      ],
      "parameters": {
        "height": 200,
        "content": "## 图片提示"
      },
      "typeVersion": 1
    },
    {
      "id": "24dd4040-a12b-4edc-a36f-668b1e4b6ab4",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        560
      ],
      "parameters": {
        "content": "## 发布"
      },
      "typeVersion": 1
    },
    {
      "id": "4dee076b-728a-42eb-b1ba-a8adfae043b5",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        960
      ],
      "parameters": {
        "content": "## 日志"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5ff0e3cd-00ad-4e8f-99a4-cd67ae531778",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Leonardo Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get Leonardo Image Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Leonardo: Create Post Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Research Topic- Perplexity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Leonardo Image": {
      "main": [
        [
          {
            "node": "Upload Image to Wordpress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agregar ALT a la Imagen": {
      "main": [
        [
          {
            "node": "Crear Post en Wordpress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crear Post en Wordpress": {
      "main": [
        [
          {
            "node": "Publicaciones Wordpress Startups y Tecnología",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Leonardo Image Status": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image to Wordpress": {
      "main": [
        [
          {
            "node": "Agregar ALT a la Imagen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Topic- Perplexity": {
      "main": [
        [
          {
            "node": "Get Title, Content, and Image FileName",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Leonardo: Create Post Image": {
      "main": [
        [
          {
            "node": "Get Leonardo Image Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Title, Content, and Image FileName": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
外部链接
在 n8n.io 查看

分享此工作流