AI NÊN SỬ DỤNG WORKFLOW NÀY?

  • BLOGGERS & CONTENT CREATORS: Tạo bài viết nhanh chóng với nhiều cấp độ đọc
  • GIÁO DỤC & TRUYỀN THÔNG: Chuyển đổi nội dung phức tạp thành ngôn ngữ dễ hiểu hơn
  • MARKETERS & SEO EXPERTS: Tự động tối ưu bài viết theo đối tượng mục tiêu

WORKFLOW GIẢI QUYẾT VẤN ĐỀ GÌ?

  • Viết bài thủ công tốn thời gian và khó tối ưu cho từng đối tượng
  • Tạo nội dung phù hợp với nhiều cấp độ đọc (Lớp 2, 5, 9) giúp mở rộng phạm vi độc giả
  • Quản lý hình ảnh nổi bật & đăng bài tự động lên WordPress

CÁCH HOẠT ĐỘNG CỦA WORKFLOW

1. TẠO VÀ XỬ LÝ NỘI DUNG

  • Người dùng nhập chủ đề blog → AI tạo bài viết với định dạng HTML chuẩn
  • Tách & kiểm tra tiêu đề, nội dung
  • Lưu bản nháp vào Google Drive để sao lưu

2. CHUYỂN ĐỔI NỘI DUNG THÀNH NHIỀU CẤP ĐỘ ĐỌC

  • Lớp 9: Ngôn ngữ nâng cao, có phép ẩn dụ
  • Lớp 5: Đơn giản hơn, có ví dụ vui nhộn
  • Lớp 2: Ngôn ngữ cơ bản, dễ hiểu, thân thiện với trẻ em

3. ĐĂNG BÀI LÊN WORDPRESS

  • Đăng bản Lớp 9 lên WordPress ở dạng bản nháp
  • Tạo hình ảnh nổi bật tự động bằng Pollinations.ai
  • Upload và đặt hình ảnh làm featured image
  • Gửi thông báo qua Telegram về trạng thái đăng bài

CÀI ĐẶT & TRIỂN KHAI (ƯỚC TÍNH: 20-30 PHÚT)

1. CẤU HÌNH API

  • WordPress: Kết nối API để đăng bài tự động
  • OpenAI: Tạo nội dung và chuyển đổi cấp độ đọc
  • Google Drive: Lưu bản nháp & quản lý nội dung
  • Telegram Bot: Nhận thông báo về trạng thái đăng bài

2. TUỲ CHỈNH NỘI DUNG

  • Điều chỉnh prompt AI để phù hợp với blog của bạn
  • Tùy chỉnh cài đặt tạo hình ảnh cho bài viết
  • Định dạng bài đăng trên WordPress theo yêu cầu

3. KIỂM TRA & TRIỂN KHAI

  • Chạy thử workflow với một chủ đề mẫu
  • Kiểm tra các phiên bản bài viết (Lớp 2, 5, 9)
  • Kiểm tra bản nháp trên WordPress
  • Xác nhận thông báo trên Telegram

ỨNG DỤNG MỞ RỘNG

Workflow này có thể mở rộng để:

  • Đăng tự động sau khi kiểm duyệt
  • Tạo video hoặc infographic từ bài viết
  • Tích hợp thêm SEO & tối ưu hóa nội dung

Code Json:

{
  "nodes": [
    {
      "parameters": {
        "options": {
          "responseFormat": "json_object"
        }
      },
      "id": "9df33245-102c-45e3-a99b-86be656d12e4",
      "name": "gpt-4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1100,
        580
      ],
      "typeVersion": 1,
      "credentials": {
        "openAiApi": {
          "id": "g2zXjjjhrsvqSL44",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n    \"title\": \"title\",\n    \"content\": \"content\"\n}"
      },
      "id": "5c0cacb0-82de-42b0-903d-0b3718085ad8",
      "name": "Structured Output - JSON",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1320,
        580
      ],
      "typeVersion": 1.2
    },
    {
      "parameters": {
        "jsCode": "try {\n  // Check if input exists and has the expected structure\n  const input = $input.all();\n  if (!input || !input.length) {\n    throw new Error('No input data received');\n  }\n\n  const firstItem = input[0];\n  if (!firstItem || !firstItem.json || !firstItem.json.output || !firstItem.json.output.output) {\n    throw new Error('Invalid input structure: missing required properties');\n  }\n\n  const output = firstItem.json.output.output;\n  \n  // Validate title exists\n  if (!output.title) {\n    throw new Error('Missing title in output');\n  }\n\n  // Validate content exists\n  if (!output.content) {\n    throw new Error('Missing content in output');\n  }\n\n  const title = output.title;\n  const content = output.content.replace(/<h1>.*?<\\/h1>/s, '').trim();\n\n  // Validate final content is not empty after processing\n  if (!content) {\n    throw new Error('Content is empty after processing');\n  }\n\n  // console.log('Successfully processed content');\n\n  // console.log(title)\n  // console.log(content)\n  \n  return { title, content };\n\n} catch (error) {\n  // Log the error for debugging\n  console.error('Error processing content:', error.message);\n  \n  // Return a graceful failure object\n  return {\n    error: true,\n    message: error.message,\n    title: '',\n    content: '',\n    timestamp: new Date().toISOString()\n  };\n}"
      },
      "id": "1ec2e58e-c775-47ab-9544-7c21521741a1",
      "name": "Separate Title & Content",
      "type": "n8n-nodes-base.code",
      "position": [
        1580,
        280
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "model": "gpt-4o-mini-2024-07-18",
        "options": {
          "responseFormat": "json_object"
        }
      },
      "id": "40f0ef7d-3c63-45ed-bbfb-8ed04772d214",
      "name": "gpt-4o-mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2040,
        880
      ],
      "typeVersion": 1,
      "credentials": {
        "openAiApi": {
          "id": "g2zXjjjhrsvqSL44",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "aaf83c73-65f3-4a88-87f3-25b1acaf93ef",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Separate Title & Content').item.json.title }}",
              "rightValue": ""
            },
            {
              "id": "d9af5bce-f0fb-4c20-8b6a-b01a3bf3e1d1",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": ""
            }
          ]
        },
        "options": {}
      },
      "id": "6b7326f8-7b88-4c4a-b5fc-29f68ca1d384",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        2400,
        680
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "agent": "conversationalAgent",
        "promptType": "define",
        "text": "=Rewrite this article at a grade 9 reading level using appropriate metaphors.  Ensure you retain all original content and only use the provided original content for the rewriting.  Do not create a Title.\n\nProvide final response in html format following these guidelines:\n\n## Formatting Guidelines\n- Use proper HTML tags throughout\n- Limit yourself to bold, italics, paragraphs and lists\n- Structure with <p> tags for paragraphs\n- Include appropriate spacing\n- Use <blockquote> for direct quotes\n- Maintain consistent formatting\n- Write in clear, professional tone\n- Break up long paragraphs\n- Use engaging subheadings\n- Include transitional phrases\n\n\n## Original content:  {{ $json.data }}",
        "options": {}
      },
      "id": "58b109b0-270e-4a66-bb55-87a5427609d8",
      "name": "Rewrite for Grade 9 Reading Level",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2040,
        680
      ],
      "typeVersion": 1.6
    },
    {
      "parameters": {
        "agent": "conversationalAgent",
        "promptType": "define",
        "text": "={{ $json.topic }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=Analyze the provided PDF article and create a compelling blog post that will be returned in JSON format with two fields: \"title\" and \"content\". Follow these specifications:\n\n## Title Requirements\n- Create an engaging, SEO-friendly title under 10 words\n- Must not contain a colon\n- Should capture the article's essence\n- Will be formatted as an H1 in the content\n\n## Content Structure\n- Introduction (150-200 words)\n  * Compelling hook\n  * Topic context and importance\n  * Preview of main points\n\n- Main Content (6-8 chapters)\n  * Each chapter requires:\n    - Relevant H2 heading\n    - 300-400 words of unique content\n    - Specific topic focus\n    - Source material quotes/data\n    - Smooth transitions\n\n- Conclusion (200-250 words)\n  * Key takeaways\n  * Final thoughts/implications\n\n## Formatting Guidelines\n- Use proper HTML tags throughout\n- Limit yourself to bold, italics, paragraphs and lists\n- Structure with <p> tags for paragraphs\n- Include appropriate spacing\n- Use <blockquote> for direct quotes\n- Maintain consistent formatting\n- Write in clear, professional tone\n- Break up long paragraphs\n- Use engaging subheadings\n- Include transitional phrases\n\nThe content should be original, avoid direct copying, and maintain a consistent voice throughout. The final JSON response should contain only the title and content fields, with the content including all HTML formatting."
        }
      },
      "id": "aa2eacae-0409-4e18-987e-37605dd2bd89",
      "name": "Create Structured Blog Post",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1120,
        380
      ],
      "retryOnFail": true,
      "typeVersion": 1.6
    },
    {
      "parameters": {
        "model": "=deepseek-reasoner",
        "options": {}
      },
      "id": "b2638528-b0e0-46db-b921-b175ae54c3da",
      "name": "DeepSeek",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1100,
        740
      ],
      "typeVersion": 1.1,
      "credentials": {
        "openAiApi": {
          "id": "g2zXjjjhrsvqSL44",
          "name": "OpenAi account"
        }
      },
      "disabled": true
    },
    {
      "parameters": {
        "operation": "createFromText",
        "content": "={{ $json.data }}",
        "name": "={{$('Separate Title & Content').item.json.title }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "options": {}
      },
      "id": "c588d522-6a21-4aea-a872-f32bea6b1d94",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2040,
        360
      ],
      "typeVersion": 3,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bcOOmn1HApa4ltSq",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3e8d2523-66aa-46fe-adcc-39dc78b9161e",
              "name": "topic",
              "type": "string",
              "value": "=Why Nostr is the and coming decentralized network."
            }
          ]
        },
        "options": {}
      },
      "id": "f2c2a8e3-68d1-482b-b3a9-d62edfd8b327",
      "name": "Set Blog Topic",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        380
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "url": "=https://image.pollinations.ai/prompt/{{ $('Separate Title & Content').item.json.title }} and Avoid adding text and keep the image vibrant.",
        "options": {}
      },
      "id": "2b2718f6-2ca8-4c50-9d0e-2705329ccdcc",
      "name": "pollinations.ai",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2300,
        1040
      ],
      "typeVersion": 4.2
    },
    {
      "parameters": {
        "title": "={{ $('Separate Title & Content').item.json.title }}",
        "additionalFields": {
          "content": "={{ $json.output }}",
          "status": "draft"
        }
      },
      "id": "62145d3b-1994-406e-9b3f-8c8f93b41153",
      "name": "Create WordPress Post",
      "type": "n8n-nodes-base.wordpress",
      "position": [
        2020,
        1040
      ],
      "typeVersion": 1,
      "credentials": {
        "wordpressApi": {
          "id": "UoUOa9xpVxfRGtlh",
          "name": "Tongkhodonhua.com"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://[YOUR-WORDPRESS-SITE.com]/wp-json/wp/v2/media",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "wordpressApi",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Disposition",
              "value": "=attachment; filename=\"cover-image-{{ $('Create WordPress Post').item.json.id }}.jpeg\""
            }
          ]
        },
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "data",
        "options": {}
      },
      "id": "61243361-dd22-4237-910d-726717306f2b",
      "name": "Upload Image to WordPress",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2580,
        1040
      ],
      "typeVersion": 4.2,
      "credentials": {
        "wordpressApi": {
          "id": "UoUOa9xpVxfRGtlh",
          "name": "Tongkhodonhua.com"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https:/[YOUR-WORDPRESS-SITE.com]/wp-json/wp/v2/posts/{{ $('Create WordPress Post').item.json.id }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "wordpressApi",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "featured_media",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "options": {}
      },
      "id": "9576157b-3687-4490-b435-6207f4fbf0de",
      "name": "Set Image on WordPress Post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2780,
        1040
      ],
      "typeVersion": 4.2,
      "credentials": {
        "wordpressApi": {
          "id": "UoUOa9xpVxfRGtlh",
          "name": "Tongkhodonhua.com"
        }
      }
    },
    {
      "parameters": {
        "html": "={{ $json.content }}",
        "options": {}
      },
      "id": "8523d441-a67f-4e34-a5c5-8781400c939e",
      "name": "HTML to Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1780,
        480
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "aaf83c73-65f3-4a88-87f3-25b1acaf93ef",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Separate Title & Content').item.json.title }}",
              "rightValue": ""
            },
            {
              "id": "d9af5bce-f0fb-4c20-8b6a-b01a3bf3e1d1",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Separate Title & Content').item.json.content }}",
              "rightValue": ""
            }
          ]
        },
        "options": {}
      },
      "id": "eb0a1f38-8c6a-4b40-9d5e-13ce1fcd645f",
      "name": "Tiltle & Content Exist?",
      "type": "n8n-nodes-base.if",
      "position": [
        1580,
        480
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "=Error!  Title or Content Missing.  Workflow aborted at {{ $now }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "ada832e8-4699-4c4a-bbd6-80b0f9de4202",
      "name": "Send Error Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1580,
        720
      ],
      "webhookId": "382a3b43-b83f-47b1-a276-67c6b98a441a",
      "typeVersion": 1.2,
      "credentials": {
        "telegramApi": {
          "id": "uMRGqfmRcAcxeJ9A",
          "name": "luyenthiminhhangtuvanbot"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "=Error!  Title or Content Missing.  Workflow aborted at {{ $now }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "6c5f55b9-9fa5-4d86-b5a2-69966a0d5cdb",
      "name": "Send Error Message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2600,
        680
      ],
      "webhookId": "382a3b43-b83f-47b1-a276-67c6b98a441a",
      "typeVersion": 1.2,
      "credentials": {
        "telegramApi": {
          "id": "uMRGqfmRcAcxeJ9A",
          "name": "luyenthiminhhangtuvanbot"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "=Success! Your blog post was created at {{ $now }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "id": "a622ecc7-4c7d-42d5-b00c-eff0f8b42916",
      "name": "Send Success Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2780,
        1280
      ],
      "webhookId": "382a3b43-b83f-47b1-a276-67c6b98a441a",
      "typeVersion": 1.2,
      "credentials": {
        "telegramApi": {
          "id": "uMRGqfmRcAcxeJ9A",
          "name": "luyenthiminhhangtuvanbot"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        540,
        380
      ],
      "id": "b7183418-38b4-4d35-85ce-c6cfc7d67067",
      "name": "Schedule Trigger"
    }
  ],
  "connections": {
    "gpt-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Create Structured Blog Post",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output - JSON": {
      "ai_outputParser": [
        [
          {
            "node": "Create Structured Blog Post",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Separate Title & Content": {
      "main": [
        [
          {
            "node": "Tiltle & Content Exist?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "gpt-4o-mini1": {
      "ai_languageModel": [
        [
          {
            "node": "Rewrite for Grade 9 Reading Level",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Create WordPress Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Error Message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rewrite for Grade 9 Reading Level": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Structured Blog Post": {
      "main": [
        [
          {
            "node": "Separate Title & Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Blog Topic": {
      "main": [
        [
          {
            "node": "Create Structured Blog Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "pollinations.ai": {
      "main": [
        [
          {
            "node": "Upload Image to WordPress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create WordPress Post": {
      "main": [
        [
          {
            "node": "pollinations.ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image to WordPress": {
      "main": [
        [
          {
            "node": "Set Image on WordPress Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Image on WordPress Post": {
      "main": [
        [
          {
            "node": "Send Success Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML to Markdown": {
      "main": [
        [
          {
            "node": "Rewrite for Grade 9 Reading Level",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tiltle & Content Exist?": {
      "main": [
        [
          {
            "node": "HTML to Markdown",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Blog Topic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateId": "2981",
    "templateCredsSetupCompleted": true,
    "instanceId": "3a518cf9c1233b7b7bac22dfea1751b4d34a0a3fbe239239f0d74077e5203687"
  }
}
JSON

💬 Nếu có bất kỳ thắc mắc nào, hãy để lại comment bên dưới để được giải đáp nhanh nhất!

Categorized in:

Templates N8N,