8
n8n 中文网amn8n.com

生成并上传WordPress(或Woocommerce)文章的音频摘要

中级

这是一个Sales, Design, AI, Marketing领域的自动化工作流,包含 7 个节点。主要使用 Set, Wordpress, HttpRequest, ManualTrigger, ChainLlm 等节点,结合人工智能技术实现智能自动化。 生成并上传WordPress(或Woocommerce)文章的音频摘要

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "c911aed9995230b93fd0d9bc41c258d697c2fe97a3bab8c02baf85963eeda618",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "468084ed-ce7d-45c5-bf27-ea9c91d5898a",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fbde6cfe-9fac-46d2-958a-f42c9ef383a3",
      "name": "获取 WordPress 文章",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        440,
        0
      ],
      "parameters": {
        "postId": "1032",
        "options": {},
        "operation": "get"
      },
      "credentials": {
        "wordpressApi": {
          "id": "T0ygUN7hNFQVztP2",
          "name": "Wordpress account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "54241e39-7a5f-45f4-9dab-72b5424f4061",
      "name": "生成摘要或转录",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        680,
        0
      ],
      "parameters": {
        "text": "={{ $json.content }}",
        "messages": {
          "messageValues": [
            {
              "message": "Summarize or transcribe this article, depending on the workflow setting."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.5
    },
    {
      "id": "49cfaab6-a0c1-4319-904d-c1e0a2c6aa91",
      "name": "生成语音",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "url": "https://api.elevenlabs.io/v1/text-to-speech/voice_id",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $json.text }}"
            },
            {
              "name": "model_id",
              "value": "eleven_multilingual_v2"
            },
            {
              "name": "output_format",
              "value": "mp3_44100_128"
            }
          ]
        },
        "genericAuthType": "httpCustomAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "id": "wUJksQ68RUH0XuTO",
          "name": "Custom Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "899abf3f-4ab6-48bd-90ba-0502cb23348e",
      "name": "上传 MP3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2060,
        0
      ],
      "parameters": {
        "url": "={{ $('settings').item.json['site_url'] }}wp-json/wp/v2/media",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Disposition",
              "value": "=attachment; filename=\"{{ $('Retrieve WordPress Article').item.json.slug }}.mp3\""
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "wordpressApi"
      },
      "credentials": {
        "wordpressApi": {
          "id": "T0ygUN7hNFQVztP2",
          "name": "Wordpress account 2"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "590297c9-1f66-4071-8b47-230b08c379d4",
      "name": "更新 WordPress 文章",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        2300,
        0
      ],
      "parameters": {
        "postId": "={{ $('Retrieve WordPress Article').item.json.id }}",
        "operation": "update",
        "updateFields": {
          "content": "=<!-- wp:audio {\"id\":{{ $json.id }}} -->\n<figure class=\"wp-block-audio\"><audio controls src=\"{{ $json.guid.rendered }}\"></audio><figcaption class=\"wp-element-caption\">🗣️ Listen to the summary or transcription. 👆</figcaption></figure>\n<!-- /wp:audio --><br>{{ $('Retrieve WordPress Article').item.json.content.rendered }}"
        }
      },
      "credentials": {
        "wordpressApi": {
          "id": "T0ygUN7hNFQVztP2",
          "name": "Wordpress account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5297d517-5dd9-4d4d-b201-0822af030c95",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -340
      ],
      "parameters": {
        "color": 6,
        "width": 660,
        "height": 1000,
        "content": "## 🎙️ 通过 API 使用 Eleven Labs 生成文本转语音"
      },
      "typeVersion": 1
    },
    {
      "id": "8fecbb98-8120-4d94-82ce-15efa063394b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -340
      ],
      "parameters": {
        "width": 460,
        "height": 280,
        "content": "# 修改此提示词"
      },
      "typeVersion": 1
    },
    {
      "id": "06e66119-2b95-416b-8167-41dccbbd8612",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        640,
        220
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yekgKa01FVKc8Etr",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "47821853-b8f5-45f3-8e37-66365ba62422",
      "name": "设置",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "10c07d50-1310-4dd7-a143-b0c0e5cf1b70",
              "name": "site_url",
              "type": "string",
              "value": "https://mydomain.com/"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "pinData": {},
  "connections": {
    "settings": {
      "main": [
        [
          {
            "node": "Retrieve WordPress Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload MP3": {
      "main": [
        [
          {
            "node": "Update WordPress Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Speech": {
      "main": [
        [
          {
            "node": "Upload MP3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Summary or Transcription",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve WordPress Article": {
      "main": [
        [
          {
            "node": "Generate Summary or Transcription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Summary or Transcription": {
      "main": [
        [
          {
            "node": "Generate Speech",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 销售, 设计, 人工智能, 营销

需要付费吗?

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

工作流信息
难度等级
中级
节点数量7
分类4
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
phil

phil

@phil

Accélérateur de Chiffre d'Affaires : Automatisez votre entreprise pour la rendre plus visible sur Google, pour trouver de nouveaux Clients, pour gagner du temps

外部链接
在 n8n.io 查看

分享此工作流