{
    "nodes": [
        {
            "parameters": {
                "content": "## Upload PDF and Extract Text",
                "height": 319,
                "width": 461,
                "color": 4
            },
            "id": "77d8c73c-1cdd-4795-841c-29c3b85040e0",
            "name": "Sticky Note",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                1160,
                340
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "content": "## Create Blog Post",
                "height": 452,
                "width": 649,
                "color": 5
            },
            "id": "62dc4474-1803-4b6e-8fe5-530e9baf80f7",
            "name": "Sticky Note1",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                1660,
                340
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "path": "pdf",
                "formTitle": "PDF2Blog",
                "formDescription": "Transform PDFs into captivating blog posts",
                "formFields": {
                    "values": [
                        {
                            "fieldLabel": "Upload PDF File",
                            "fieldType": "file",
                            "multipleFiles": false,
                            "acceptFileTypes": ".pdf",
                            "requiredField": true
                        }
                    ]
                },
                "options": []
            },
            "id": "b8da4206-f1b5-4a8f-b056-70c7558c825d",
            "name": "Upload PDF",
            "type": "n8n-nodes-base.formTrigger",
            "position": [
                1240,
                440
            ],
            "webhookId": "6c4a4180-7206-469f-a645-f41824ccbf42",
            "typeVersion": 2.1
        },
        {
            "parameters": {
                "operation": "pdf",
                "binaryPropertyName": "Upload_PDF_File",
                "options": []
            },
            "id": "ef70bbe2-d66c-4c91-96cf-2d0500522e70",
            "name": "Extract Text",
            "type": "n8n-nodes-base.extractFromFile",
            "position": [
                1440,
                440
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "options": {
                    "responseFormat": "text"
                }
            },
            "id": "5de90f20-e0b3-4098-b5ae-c3bf5d724fcc",
            "name": "gpt-4o-mini",
            "type": "@n8n\/n8n-nodes-langchain.lmChatOpenAi",
            "position": [
                1860,
                600
            ],
            "typeVersion": 1,
            "credentials": []
        },
        {
            "parameters": {
                "url": "=https:\/\/image.pollinations.ai\/prompt\/{{ $('Get Blog Post').item.json.title }} and avoid adding text and keep the image vibrant.",
                "options": []
            },
            "id": "b6e33883-a13f-4bc8-bedc-18d93294ae75",
            "name": "pollinations.ai",
            "type": "n8n-nodes-base.httpRequest",
            "position": [
                1540,
                1500
            ],
            "typeVersion": 4.2
        },
        {
            "parameters": {
                "title": "={{ $('Get Blog Post').item.json.title }}",
                "additionalFields": {
                    "content": "={{ $('Get Blog Post').item.json.content }}",
                    "status": "draft"
                }
            },
            "id": "d928d841-8098-406e-ad66-cf7ca653a2c4",
            "name": "Create Wordpress Post",
            "type": "n8n-nodes-base.wordpress",
            "position": [
                1240,
                1500
            ],
            "typeVersion": 1,
            "alwaysOutputData": true,
            "credentials": [],
            "onError": "continueRegularOutput"
        },
        {
            "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": "350cf732-037b-4e60-820e-4e38aecf7e57",
            "name": "Upload Image to Wordpress",
            "type": "n8n-nodes-base.httpRequest",
            "position": [
                1900,
                1320
            ],
            "typeVersion": 4.2,
            "alwaysOutputData": true,
            "credentials": [],
            "onError": "continueRegularOutput"
        },
        {
            "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": "0f85ff07-13fb-40d5-8eee-7946f7064874",
            "name": "Set Image on Wordpress Post",
            "type": "n8n-nodes-base.httpRequest",
            "position": [
                2120,
                1320
            ],
            "typeVersion": 4.2,
            "alwaysOutputData": true,
            "credentials": [],
            "onError": "continueRegularOutput"
        },
        {
            "parameters": {
                "content": "## Create Wordpress Post and Add New Image\nhttps:\/\/docs.n8n.io\/integrations\/builtin\/credentials\/wordpress\/",
                "height": 521,
                "width": 1146,
                "color": 6
            },
            "id": "3bdc1e66-251f-4904-bbc2-dd4e667a4b40",
            "name": "Sticky Note2",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                1160,
                1240
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "content": "## Create Post Image\nhttps:\/\/pollinations.ai\/\nhttps:\/\/image.pollinations.ai\/prompt\/[your image description]",
                "height": 340,
                "width": 300,
                "color": 7
            },
            "id": "9d54b59e-5bf3-429b-856a-c3c1dcb25885",
            "name": "Sticky Note4",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                1440,
                1340
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
                "text": "=Error Creating Blog Post",
                "additionalFields": {
                    "appendAttribution": false
                }
            },
            "id": "957b63d2-68af-4c44-b145-3460ed9ea0fc",
            "name": "Send Error Message",
            "type": "n8n-nodes-base.telegram",
            "position": [
                1440,
                960
            ],
            "webhookId": "382a3b43-b83f-47b1-a276-67c6b98a441a",
            "typeVersion": 1.2,
            "credentials": []
        },
        {
            "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": "={{ $json.title }}",
                            "rightValue": ""
                        },
                        {
                            "id": "d9af5bce-f0fb-4c20-8b6a-b01a3bf3e1d1",
                            "operator": {
                                "type": "string",
                                "operation": "notEmpty",
                                "singleValue": true
                            },
                            "leftValue": "={{ $json.content }}",
                            "rightValue": ""
                        }
                    ]
                },
                "options": []
            },
            "id": "ef768593-053c-4a65-8eb9-b489cb115d2b",
            "name": "Is there Title & Content?",
            "type": "n8n-nodes-base.if",
            "position": [
                1240,
                800
            ],
            "typeVersion": 2.2
        },
        {
            "parameters": {
                "mode": "combine",
                "combineBy": "combineByPosition",
                "options": []
            },
            "id": "a6c70ec0-2809-4c38-a2dd-a16e0b44f23e",
            "name": "Merge",
            "type": "n8n-nodes-base.merge",
            "position": [
                2400,
                1480
            ],
            "typeVersion": 3
        },
        {
            "parameters": {
                "html": "={{ $('Get Blog Post').item.json.content }}",
                "destinationKey": "markdown",
                "options": []
            },
            "id": "2562ab36-2fba-424e-8128-387591d2077e",
            "name": "Markdown",
            "type": "n8n-nodes-base.markdown",
            "position": [
                2400,
                1280
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "operation": "sendAndWait",
                "sendTo": "joe@example.com",
                "subject": "=Approval Required for \"{{ $json.title }}\"",
                "message": "={{ $json.content }}",
                "approvalOptions": {
                    "values": {
                        "approvalType": "double"
                    }
                },
                "options": {
                    "limitWaitTime": {
                        "values": {
                            "resumeAmount": 45,
                            "resumeUnit": "minutes"
                        }
                    }
                }
            },
            "id": "1739fe6e-4c0e-45b0-b368-6aab5dd79db9",
            "name": "Human In The Loop Approve Blog Post",
            "type": "n8n-nodes-base.gmail",
            "position": [
                1800,
                960
            ],
            "webhookId": "48f44283-5f68-4d7a-a2d2-a42209d35032",
            "typeVersion": 2.1,
            "credentials": []
        },
        {
            "parameters": {
                "content": "## 💫🤩 New - Human In The Loop",
                "height": 340,
                "width": 400,
                "color": 4
            },
            "id": "ae015937-dffb-4445-a013-b22442850de7",
            "name": "Sticky Note3",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                1660,
                840
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "conditions": {
                    "options": {
                        "version": 2,
                        "leftValue": "",
                        "caseSensitive": true,
                        "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                        {
                            "id": "316594d7-7ff6-4e39-bea3-45a11b9e750f",
                            "operator": {
                                "type": "boolean",
                                "operation": "true",
                                "singleValue": true
                            },
                            "leftValue": "={{ $json.data.approved }}",
                            "rightValue": ""
                        }
                    ]
                },
                "options": []
            },
            "id": "aafee6b1-0273-429a-9002-e0406be6c281",
            "name": "Is Approved?",
            "type": "n8n-nodes-base.if",
            "position": [
                2100,
                960
            ],
            "typeVersion": 2.2
        },
        {
            "parameters": {
                "sendTo": "joe@example.com",
                "subject": "={{ $('Get Blog Post').item.json.title }}",
                "message": "={{ $('Get Blog Post').item.json.content }}",
                "options": []
            },
            "id": "d7aa4ec8-e936-4e05-b94a-da42f6852591",
            "name": "Gmail Final Blog",
            "type": "n8n-nodes-base.gmail",
            "position": [
                2660,
                1480
            ],
            "webhookId": "07692f3b-4e21-42d3-92dd-3dce5df3112f",
            "typeVersion": 2.1,
            "credentials": []
        },
        {
            "parameters": {
                "operation": "sendPhoto",
                "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
                "binaryData": true,
                "additionalFields": {
                    "caption": "={{ $json.markdown.slice(0,400) }} ..."
                }
            },
            "id": "cefad6b9-b061-4363-8221-34e15e262d00",
            "name": "Telegram Partial Blog",
            "type": "n8n-nodes-base.telegram",
            "position": [
                2660,
                1280
            ],
            "webhookId": "77e3b2c9-79b7-4aa1-aa62-24da144c5f45",
            "typeVersion": 1.2,
            "credentials": []
        },
        {
            "parameters": {
                "content": "## 🎯 Description\n\nThis n8n workflow automates the process of transforming PDF documents into engaging, SEO-friendly WordPress blog posts. It incorporates AI-powered text analysis, automatic image generation, and a human review step to ensure quality before publishing.\n\n## 🚀 How It Works\n\n### 🗂️ PDF Upload & Text Extraction  \n- Users upload a PDF document through a form trigger.  \n- The workflow extracts text from the uploaded file, ensuring compatibility with supported formats.\n\n### 🤖 AI-Powered Blog Post Generation  \n- The extracted text is analyzed by an AI model (GPT-based) to create a structured blog post.  \n- The AI generates:  \n  - A captivating SEO-friendly title.  \n  - Well-formatted HTML content, including an introduction, chapters with subheadings, and a conclusion.\n\n### 🎨 Image Creation & Integration  \n- An image is generated using **Pollinations.ai** based on the blog post title.  \n- The vibrant image is uploaded to WordPress and set as the featured image for the post.\n\n### 📝 WordPress Draft Creation  \n- A draft blog post is created on WordPress with the AI-generated title, content, and featured image.  \n\n### ✅ Human-in-the-Loop Approval  \n- The draft content is sent via Gmail to a reviewer for manual approval.  \n- If approved, the post is published on WordPress. If not, an error message is sent for troubleshooting.\n\n### 📢 Multi-Channel Notifications  \n- Once published, notifications are sent via Gmail and Telegram to relevant stakeholders.  \n\n## 🔧 Setup Steps\n\n### 🔑 Configure API Credentials  \n1. Set up API connections for:  \n   - OpenAI (for AI content generation).  \n   - WordPress (for post creation and media uploads).  \n   - Gmail (for sending approval emails).  \n   - Telegram (for notifications).  \n\n### ⚙️ Customize Workflow Parameters  \n2. Adjust the AI prompt to match your desired blog structure and tone.  \n3. Modify the image generation parameters to align with your branding needs.\n\n### 🧪 Test & Deploy  \n3. Test the workflow with sample PDFs to ensure:  \n   - Accurate text extraction.  \n   - Proper formatting of generated content.  \n   - Seamless approval and publishing processes.  \n\n\nThis workflow streamlines content creation while maintaining quality control through human oversight, making it an ideal solution for efficient blog management! 🎉\n",
                "height": 1420,
                "width": 680,
                "color": 7
            },
            "id": "503ab66d-6924-4be4-8275-3bfa3b3bf69f",
            "name": "Sticky Note5",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                440,
                340
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "content": "# 📄✨ Easy WordPress Content Creation from PDF Document + Human in the Loop with Gmail Approval",
                "height": 1700,
                "width": 2520
            },
            "id": "8ea57c7f-256b-4a89-b62f-3a6390fec719",
            "name": "Sticky Note6",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                380,
                240
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "jsCode": "\/\/ Get the HTML content from the previous node\nconst htmlContent = $input.first().json.text;\n\n\/\/ Use regex to extract the text between the first h1 tags\nconst titleRegex = \/<h1>(.*?)<\\\/h1>\/s;\nconst match = htmlContent.match(titleRegex);\n\n\/\/ Extract the title or set to empty string if not found\nconst title = match ? match[1] : '';\n\n\/\/ Return the extracted title\nreturn [{\n  json: {\n    title: title,\n    content: htmlContent\n  }\n}];"
            },
            "id": "8cf6bd65-b025-45df-b556-a5fac970aa9b",
            "name": "Get Blog Post",
            "type": "n8n-nodes-base.code",
            "position": [
                2100,
                440
            ],
            "typeVersion": 2
        },
        {
            "parameters": {
                "promptType": "define",
                "text": "={{ $json.text }}",
                "messages": {
                    "messageValues": [
                        {
                            "message": "=Analyze the provided PDF article and create a compelling blog post. 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- 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    - Conclusion (200-250 words)   \n  * Key takeaways   \n  * Final thoughts\/implications  \n\n## Formatting Guidelines \n- Use proper HTML tags throughout \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. \nOnly return the bolg post and avoid any preamble or further explanation."
                        }
                    ]
                }
            },
            "id": "5e221628-d3b1-4242-bfa4-6a40599fa87b",
            "name": "Write Blog Post",
            "type": "@n8n\/n8n-nodes-langchain.chainLlm",
            "position": [
                1760,
                440
            ],
            "typeVersion": 1.5
        },
        {
            "parameters": {
                "operation": "binaryToPropery",
                "options": []
            },
            "id": "58ff967f-e327-4719-8a95-bfe9df02d185",
            "name": "Get Base64",
            "type": "n8n-nodes-base.extractFromFile",
            "position": [
                1900,
                1700
            ],
            "typeVersion": 1
        },
        {
            "parameters": {
                "method": "POST",
                "url": "https:\/\/api.imgbb.com\/1\/upload",
                "sendQuery": true,
                "queryParameters": {
                    "parameters": [
                        {
                            "name": "expiration",
                            "value": "600"
                        },
                        {
                            "name": "key",
                            "value": "[your-imbgg-api-key-here]"
                        }
                    ]
                },
                "sendBody": true,
                "contentType": "multipart-form-data",
                "bodyParameters": {
                    "parameters": [
                        {
                            "name": "image",
                            "value": "={{ $json.data }}"
                        },
                        {
                            "name": "name",
                            "value": "="
                        }
                    ]
                },
                "options": {
                    "redirect": {
                        "redirect": []
                    }
                }
            },
            "id": "a09a8b8b-ca30-4bbe-b3c9-a989e95d0fca",
            "name": "Save Image to imgbb.com",
            "type": "n8n-nodes-base.httpRequest",
            "position": [
                2120,
                1700
            ],
            "typeVersion": 4.2
        },
        {
            "parameters": {
                "content": "## Save Image to imgbb\nhttps:\/\/api.imgbb.com\/",
                "height": 300,
                "width": 560,
                "color": 7
            },
            "id": "116a8bee-77b5-44c8-a9fd-df3776ddccd1",
            "name": "Sticky Note7",
            "type": "n8n-nodes-base.stickyNote",
            "position": [
                1800,
                1600
            ],
            "typeVersion": 1
        }
    ],
    "connections": {
        "Upload PDF": {
            "main": [
                [
                    {
                        "node": "Extract Text",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Extract Text": {
            "main": [
                [
                    {
                        "node": "Write Blog Post",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "gpt-4o-mini": {
            "ai_languageModel": [
                [
                    {
                        "node": "Write Blog Post",
                        "type": "ai_languageModel",
                        "index": 0
                    }
                ]
            ]
        },
        "pollinations.ai": {
            "main": [
                [
                    {
                        "node": "Upload Image to Wordpress",
                        "type": "main",
                        "index": 0
                    },
                    {
                        "node": "Merge",
                        "type": "main",
                        "index": 1
                    },
                    {
                        "node": "Get Base64",
                        "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": "Markdown",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Is there Title & Content?": {
            "main": [
                [
                    {
                        "node": "Human In The Loop Approve Blog Post",
                        "type": "main",
                        "index": 0
                    }
                ],
                [
                    {
                        "node": "Send Error Message",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Merge": {
            "main": [
                [
                    {
                        "node": "Telegram Partial Blog",
                        "type": "main",
                        "index": 0
                    },
                    {
                        "node": "Gmail Final Blog",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Markdown": {
            "main": [
                [
                    {
                        "node": "Merge",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Human In The Loop Approve Blog Post": {
            "main": [
                [
                    {
                        "node": "Is Approved?",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Is Approved?": {
            "main": [
                [
                    {
                        "node": "Create Wordpress Post",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Telegram Partial Blog": {
            "main": [
                []
            ]
        },
        "Get Blog Post": {
            "main": [
                [
                    {
                        "node": "Is there Title & Content?",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Write Blog Post": {
            "main": [
                [
                    {
                        "node": "Get Blog Post",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Get Base64": {
            "main": [
                [
                    {
                        "node": "Save Image to imgbb.com",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    },
    "pinData": [],
    "meta": {
        "instanceId": "88cd139ad10e992513feddb2d78e170d08572f9ca1452143215d522d5bdc729e",
        "templateCredsSetupCompleted": true
    }
}