{
  "id": 9018,
  "name": "Automated blog post generator with GPT-4, DALL-E, and Wikipedia for WordPress",
  "description": "# WordPress AI Content Creator\n\n## Overview\nTransform a few keywords into professionally written, SEO-optimized WordPress blog posts with custom featured images. This workflow leverages AI to research topics, structure content, write engaging articles, and publish them directly to your WordPress site as drafts ready for review.\n\n## What This Workflow Does\n\n### Core Features\n- **Keyword-to-Article Generation**: Converts simple keywords into comprehensive, well-structured articles\n- **Intelligent Content Planning**: Uses AI to create logical chapter structures and content flow\n- **Wikipedia Integration**: Researches factual information to ensure content accuracy and depth\n- **Multi-Chapter Writing**: Generates coherent, contextually-aware content across multiple sections\n- **Custom Image Creation**: Generates relevant featured images using DALL-E based on article content\n- **SEO Optimization**: Creates titles, subtitles, and content optimized for search engines\n- **WordPress Integration**: Automatically publishes articles as drafts with proper formatting and featured images\n\n### Business Value\n- **Content Scale**: Produce high-quality blog posts in minutes instead of hours\n- **Research Efficiency**: Automatically incorporates factual information from reliable sources\n- **Consistency**: Maintains professional tone and structure across all generated content\n- **SEO Benefits**: Creates search-engine friendly content with proper HTML formatting\n- **Cost Savings**: Reduces need for external content creation services\n\n## Prerequisites\n\n### Required Accounts & Credentials\n1. **WordPress Site** with REST API enabled\n2. **OpenAI API** access (GPT-4 and DALL-E models)\n3. **WordPress Application Password** or JWT authentication\n4. **Public-facing n8n instance** for form access (or n8n Cloud)\n\n### Technical Requirements\n- WordPress REST API v2 enabled (standard on most WordPress sites)\n- WordPress user account with publishing permissions\n- n8n instance with LangChain nodes package installed\n\n## Setup Instructions\n\n### Step 1: WordPress Configuration\n1. **Enable REST API** (usually enabled by default):\n   - Check that `yoursite.com/wp-json/wp/v2/` returns JSON data\n   - If not, contact hosting provider or install REST API plugin\n\n2. **Create Application Password**:\n   - In WordPress Admin: Users &gt; Profile\n   - Scroll to \"Application Passwords\"\n   - Add new password with name \"n8n Integration\"\n   - Copy the generated password (save securely)\n\n3. **Get WordPress Site URL**:\n   - Note your full WordPress site URL (e.g., `https://yourdomain.com`)\n\n### Step 2: OpenAI Configuration\n1. **Obtain OpenAI API Key**:\n   - Visit [OpenAI Platform](https://platform.openai.com/)\n   - Create API key with access to:\n     - GPT-4 models (for content generation)\n     - DALL-E (for image creation)\n\n2. **Add OpenAI Credentials in n8n**:\n   - Navigate to Settings &gt; Credentials\n   - Add \"OpenAI API\" credential\n   - Enter your API key\n\n### Step 3: WordPress Credentials in n8n\n1. **Add WordPress API Credentials**:\n   - In n8n: Settings &gt; Credentials &gt; \"WordPress API\"\n   - **URL**: Your WordPress site URL\n   - **Username**: Your WordPress username\n   - **Password**: Application password from Step 1\n\n### Step 4: Update Workflow Settings\n1. **Configure Settings Node**:\n   - Open the \"Settings\" node\n   - Replace `wordpress_url` value with your actual WordPress URL\n   - Keep other settings as default or customize as needed\n\n2. **Update Credential References**:\n   - Ensure all WordPress nodes reference your WordPress credentials\n   - Verify OpenAI nodes use your OpenAI credentials\n\n### Step 5: Deploy Form (Production Use)\n1. **Activate Workflow**:\n   - Toggle workflow to \"Active\" status\n   - Note the webhook URL from Form Trigger node\n\n2. **Test Form Access**:\n   - Copy the form URL\n   - Test form submission with sample data\n   - Verify workflow execution completes successfully\n\n## Configuration Details\n\n### Form Customization\nThe form accepts three key inputs:\n- **Keywords**: Comma-separated topics for article generation\n- **Number of Chapters**: 1-10 chapters for content structure\n- **Max Word Count**: Total article length control\n\nYou can modify form fields by editing the \"Form\" trigger node:\n- Add additional input fields (category, author, publish date)\n- Change field types (dropdown, checkboxes, file upload)\n- Modify validation rules and requirements\n\n### AI Content Parameters\n\n#### Article Structure Generation\nThe \"Create post title and structure\" node uses these parameters:\n- **Model**: GPT-4-1106-preview for enhanced reasoning\n- **Max Tokens**: 2048 for comprehensive structure planning\n- **JSON Output**: Structured data for subsequent processing\n\n#### Chapter Writing\nThe \"Create chapters text\" node configuration:\n- **Model**: GPT-4-0125-preview for consistent writing quality\n- **Context Awareness**: Each chapter knows about preceding/following content\n- **Word Count Distribution**: Automatically calculates per-chapter length\n- **Coherence Checking**: Ensures smooth transitions between sections\n\n### Image Generation Settings\nDALL-E parameters in \"Generate featured image\":\n- **Size**: 1792x1024 (optimized for WordPress featured images)\n- **Style**: Natural (photographic look)\n- **Quality**: HD (higher quality output)\n- **Prompt Enhancement**: Adds photography keywords for better results\n\n## Usage Instructions\n\n### Basic Workflow\n1. **Access the Form**:\n   - Navigate to the form URL provided by the Form Trigger\n   - Enter your desired keywords (e.g., \"artificial intelligence, machine learning, automation\")\n   - Select number of chapters (3-5 recommended for most topics)\n   - Set word count (1000-2000 words typical)\n\n2. **Submit and Wait**:\n   - Click submit to trigger the workflow\n   - Processing takes 2-5 minutes depending on article length\n   - Monitor n8n execution log for progress\n\n3. **Review Generated Content**:\n   - Check WordPress admin for new draft post\n   - Review article structure and content quality\n   - Verify featured image is properly attached\n   - Edit as needed before publishing\n\n### Advanced Usage\n\n#### Custom Prompts\nModify AI prompts to change:\n- **Writing Style**: Formal, casual, technical, conversational\n- **Target Audience**: Beginners, experts, general public\n- **Content Focus**: How-to guides, opinion pieces, news analysis\n- **SEO Strategy**: Keyword density, meta descriptions, heading structure\n\n#### Bulk Content Creation\nFor multiple articles:\n1. Create separate form submissions for each topic\n2. Schedule workflow executions with different keywords\n3. Use CSV upload to process multiple keyword sets\n4. Implement queue system for high-volume processing\n\n## Expected Outputs\n\n### Article Structure\nGenerated articles include:\n- **SEO-Optimized Title**: Compelling, keyword-rich headline\n- **Descriptive Subtitle**: Supporting context for the main title\n- **Introduction**: ~60 words introducing the topic\n- **Chapter Sections**: Logical flow with HTML formatting\n- **Conclusions**: ~60 words summarizing key points\n- **Featured Image**: Custom DALL-E generated visual\n\n### Content Quality Features\n- **Factual Accuracy**: Wikipedia integration ensures reliable information\n- **Proper HTML Formatting**: Bold, italic, and list elements for readability\n- **Logical Flow**: Chapters build upon each other coherently\n- **SEO Elements**: Optimized for search engine visibility\n- **Professional Tone**: Consistent, engaging writing style\n\n### WordPress Integration\n- **Draft Status**: Articles saved as drafts for review\n- **Featured Image**: Automatically uploaded and assigned\n- **Proper Formatting**: HTML preserved in WordPress editor\n- **Metadata**: Title and content properly structured\n\n## Troubleshooting\n\n### Common Issues\n\n#### \"No Article Structure Generated\"\n**Cause**: AI couldn't create valid structure from keywords\n**Solutions**:\n- Use more specific, descriptive keywords\n- Reduce number of chapters requested\n- Check OpenAI API quotas and usage\n- Verify keywords are in English (default language)\n\n#### \"Chapter Content Missing\"\n**Cause**: Individual chapter generation failed\n**Solutions**:\n- Increase max tokens in chapter generation node\n- Simplify chapter prompts\n- Check for API rate limiting\n- Verify internet connectivity for Wikipedia tool\n\n#### \"WordPress Publication Failed\"\n**Cause**: Authentication or permission issues\n**Solutions**:\n- Verify WordPress credentials are correct\n- Check WordPress user has publishing permissions\n- Ensure WordPress REST API is accessible\n- Test WordPress URL accessibility\n\n#### \"Featured Image Not Attached\"\n**Cause**: Image generation or upload failure\n**Solutions**:\n- Check DALL-E API access and quotas\n- Verify image upload permissions in WordPress\n- Review image file size and format compatibility\n- Test manual image upload to WordPress\n\n### Performance Optimization\n\n#### Large Articles (2000+ words)\n- Increase timeout values in HTTP request nodes\n- Consider splitting very long articles into multiple posts\n- Implement progress tracking for user feedback\n- Add retry mechanisms for failed API calls\n\n#### High-Volume Usage\n- Implement queue system for multiple simultaneous requests\n- Add rate limiting to respect OpenAI API limits\n- Consider batch processing for efficiency\n- Monitor and optimize token usage\n\n## Customization Examples\n\n### Different Content Types\n\n#### Product Reviews\nModify prompts to include:\n- Pros and cons sections\n- Feature comparisons\n- Rating systems\n- Purchase recommendations\n\n#### Technical Tutorials\nAdjust structure for:\n- Step-by-step instructions\n- Code examples\n- Prerequisites sections\n- Troubleshooting guides\n\n#### News Articles\nConfigure for:\n- Who, what, when, where, why structure\n- Quote integration\n- Fact checking emphasis\n- Timeline organization\n\n### Alternative Platforms\n\n#### Replace WordPress with Other CMS\n- **Ghost**: Use Ghost API for publishing\n- **Webflow**: Integrate with Webflow CMS\n- **Strapi**: Connect to headless CMS\n- **Medium**: Publish to Medium platform\n\n#### Different AI Models\n- **Claude**: Replace OpenAI with Anthropic's Claude\n- **Gemini**: Use Google's Gemini for content generation\n- **Local Models**: Integrate with self-hosted AI models\n- **Multiple Models**: Use different models for different tasks\n\n### Enhanced Features\n\n#### SEO Optimization\nAdd nodes for:\n- **Meta Description Generation**: AI-created descriptions\n- **Tag Suggestions**: Relevant WordPress tags\n- **Internal Linking**: Suggest related content links\n- **Schema Markup**: Add structured data\n\n#### Content Enhancement\nInclude additional processing:\n- **Plagiarism Checking**: Verify content originality\n- **Readability Analysis**: Assess content accessibility\n- **Fact Verification**: Multiple source confirmation\n- **Image Optimization**: Compress and optimize images\n\n## Security Considerations\n\n### API Security\n- Store all credentials securely in n8n credential system\n- Use environment variables for sensitive configuration\n- Regularly rotate API keys and passwords\n- Monitor API usage for unusual activity\n\n### Content Moderation\n- Review generated content before publishing\n- Implement content filtering for inappropriate material\n- Consider legal implications of auto-generated content\n- Maintain editorial oversight and fact-checking\n\n### WordPress Security\n- Use application passwords instead of main account password\n- Limit WordPress user permissions to minimum required\n- Keep WordPress and plugins updated\n- Monitor for unauthorized access attempts\n\n## Legal and Ethical Considerations\n\n### Content Ownership\n- Understand OpenAI's terms regarding generated content\n- Consider copyright implications for Wikipedia-sourced information\n- Implement proper attribution where required\n- Review content licensing requirements\n\n### Disclosure Requirements\n- Consider disclosing AI-generated content to readers\n- Follow platform-specific guidelines for automated content\n- Ensure compliance with advertising and content standards\n- Respect intellectual property rights\n\n## Support and Maintenance\n\n### Regular Maintenance\n- Monitor OpenAI API usage and costs\n- Update AI prompts based on output quality\n- Review and update Wikipedia search strategies\n- Optimize workflow performance based on usage patterns\n\n### Quality Assurance\n- Regularly review generated content quality\n- Implement feedback loops for improvement\n- Test workflow with diverse keyword sets\n- Monitor WordPress site performance impact\n\n### Updates and Improvements\n- Stay updated with OpenAI model improvements\n- Monitor n8n platform updates for new features\n- Engage with community for workflow enhancements\n- Document custom modifications for future reference\n\n## Cost Optimization\n\n### OpenAI Usage\n- Monitor token consumption patterns\n- Optimize prompts for efficiency\n- Consider using different models for different tasks\n- Implement usage limits and budgets\n\n### Alternative Approaches\n- Use local AI models for cost reduction\n- Implement caching for repeated topics\n- Batch similar requests for efficiency\n- Consider hybrid human-AI content creation\n\n## License and Attribution\n\nThis workflow template is provided under MIT license. Attribution to original creator appreciated when sharing or modifying. Generated content is subject to OpenAI's usage policies and terms of service.",
  "categories": [
    {
      "id": 31,
      "name": "Content Creation"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 1384,
  "createdAt": "2025-09-27T18:47:21.742Z",
  "workflow": {
    "id": "mKGMYXJottl0PDtM",
    "meta": {
      "instanceId": "cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7"
    },
    "name": "Write a WordPress post with AI (starting from a few keywords)",
    "tags": [],
    "nodes": [
      {
        "id": "a4f19a81-6101-48c2-9560-9cf231bc240b",
        "name": "Form",
        "type": "n8n-nodes-base.formTrigger",
        "position": [
          -580,
          320
        ],
        "webhookId": "4b937814-e829-4df7-aaba-31192babf7e1",
        "parameters": {
          "path": "create-wordpress-post",
          "formTitle": "Create a WordPress post with AI",
          "formFields": {
            "values": [
              {
                "fieldLabel": "Keywords (comma-separated)",
                "requiredField": true
              },
              {
                "fieldType": "dropdown",
                "fieldLabel": "Number of chapters",
                "fieldOptions": {
                  "values": [
                    {
                      "option": "1"
                    },
                    {
                      "option": "2"
                    },
                    {
                      "option": "3"
                    },
                    {
                      "option": "4"
                    },
                    {
                      "option": "5"
                    },
                    {
                      "option": "6"
                    },
                    {
                      "option": "7"
                    },
                    {
                      "option": "8"
                    },
                    {
                      "option": "9"
                    },
                    {
                      "option": "10"
                    }
                  ]
                },
                "requiredField": true
              },
              {
                "fieldType": "number",
                "fieldLabel": "Max words count",
                "requiredField": true
              }
            ]
          },
          "responseMode": "responseNode",
          "formDescription": "Fill this form with the required information to create a draft post on WordPress"
        },
        "typeVersion": 2
      },
      {
        "id": "e4cf75f7-00e7-473a-a944-af635581715f",
        "name": "Sticky Note2",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          209.98769233621147,
          140
        ],
        "parameters": {
          "color": 4,
          "width": 301.3874093724939,
          "height": 371.765663140765,
          "content": "## Data check"
        },
        "typeVersion": 1
      },
      {
        "id": "e949a487-6701-4650-b9be-08146b4e93ad",
        "name": "Sticky Note3",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          225.20535922952297,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 272.8190508599808,
          "height": 80,
          "content": "Checks that the data returned by OpenAI is correct"
        },
        "typeVersion": 1
      },
      {
        "id": "662fe28b-c0b7-4aef-b99c-a8c4c641251c",
        "name": "Sticky Note5",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1580,
          140
        ],
        "parameters": {
          "color": 5,
          "width": 282.3398199598652,
          "height": 371.7656631407652,
          "content": "## Draft on WordPress"
        },
        "typeVersion": 1
      },
      {
        "id": "85996d51-ab98-41f5-b525-d926f04f50a8",
        "name": "Sticky Note9",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1595,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 254.77269221373095,
          "height": 80,
          "content": "The article is posted as a draft on WordPress"
        },
        "typeVersion": 1
      },
      {
        "id": "46f67505-f2dc-4110-b1d4-a27d7814cb52",
        "name": "Sticky Note10",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1881,
          140
        ],
        "parameters": {
          "color": 3,
          "width": 557.7592769264069,
          "height": 369.2595606183891,
          "content": "## Featured image"
        },
        "typeVersion": 1
      },
      {
        "id": "a1beeb4f-f171-4c6a-ac19-7086b09757ab",
        "name": "Sticky Note11",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1900,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 517.9195082760601,
          "height": 80,
          "content": "The image is generated with Dall-E, uploaded to WordPress, and then connected to the post as its featured image"
        },
        "typeVersion": 1
      },
      {
        "id": "d1fd737b-7f14-4371-8720-7742f708e641",
        "name": "Sticky Note12",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -117.99507693448459,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 287.370178643191,
          "height": 80,
          "content": "Starting from the given keywords, generates the article title, subtitle, chapters, and image prompt"
        },
        "typeVersion": 1
      },
      {
        "id": "ccaaf851-613b-4d0c-8b3d-99a35ec9cdad",
        "name": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -129.93405171072595,
          142
        ],
        "parameters": {
          "color": 6,
          "width": 319.697690939268,
          "height": 370.512611879577,
          "content": "## Article structure"
        },
        "typeVersion": 1
      },
      {
        "id": "69bebd7b-8ad5-4b0d-a8df-1b2e6d4be96e",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -640,
          140
        ],
        "parameters": {
          "color": 7,
          "width": 239.97343293577688,
          "height": 370.512611879577,
          "content": "## User form"
        },
        "typeVersion": 1
      },
      {
        "id": "2037f81b-189c-4dc4-a4dc-179e4283544c",
        "name": "Sticky Note13",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -623,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 199.7721486302032,
          "height": 80,
          "content": "The user triggers the post creation"
        },
        "typeVersion": 1
      },
      {
        "id": "e8d7f711-185d-499b-ba58-de52ac6a4e58",
        "name": "Sticky Note4",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          2461,
          140
        ],
        "parameters": {
          "color": 7,
          "width": 219.70753707029849,
          "height": 370.512611879577,
          "content": "## User feedback"
        },
        "typeVersion": 1
      },
      {
        "id": "d89bebca-3607-4c66-a13d-07c32262e01a",
        "name": "Sticky Note14",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          2481,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 183.38125554060056,
          "height": 80,
          "content": "Final confirmation to the user"
        },
        "typeVersion": 1
      },
      {
        "id": "7df452e2-52f3-4efe-94a4-7d4eab0670c8",
        "name": "Sticky Note6",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          534.9876923362115,
          530.9889231025903
        ],
        "parameters": {
          "color": 7,
          "width": 281.2716777103785,
          "height": 288.4116890365125,
          "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nUser is notified to try again since some data is missing"
        },
        "typeVersion": 1
      },
      {
        "id": "f881bcd9-c7d2-4a1c-bc1a-beb515d52ade",
        "name": "Sticky Note7",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -128.98646156983267,
          532.991384635348
        ],
        "parameters": {
          "color": 7,
          "width": 319.8306137081817,
          "height": 275.3956890735875,
          "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nWikipedia is used to write the article"
        },
        "typeVersion": 1
      },
      {
        "id": "1b788b37-b8b5-47f6-8198-547dac8c76d6",
        "name": "Settings",
        "type": "n8n-nodes-base.set",
        "position": [
          -320,
          320
        ],
        "parameters": {
          "options": {},
          "assignments": {
            "assignments": [
              {
                "id": "3a433b0f-9957-4b64-ad81-359ab5e521d5",
                "name": "wordpress_url",
                "type": "string",
                "value": "https://you-wordpress-url-here.com/"
              },
              {
                "id": "ec5430e3-92c5-46e4-8c2c-c87291680892",
                "name": "keywords",
                "type": "string",
                "value": "={{ $json['Keywords (comma-separated)'] }}"
              },
              {
                "id": "5defb0a2-d921-4909-b10d-da59e1768496",
                "name": "chapters",
                "type": "number",
                "value": "={{ $json['Number of chapters'] }}"
              },
              {
                "id": "230ebd0b-73c2-4265-9b3c-57af7fbc48c8",
                "name": "words",
                "type": "number",
                "value": "={{ $json['Max words count'] }}"
              }
            ]
          }
        },
        "typeVersion": 3.3
      },
      {
        "id": "af29ed91-84b5-43f8-b1ce-1c8dc35c2c1b",
        "name": "Sticky Note8",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -377,
          140
        ],
        "parameters": {
          "color": 2,
          "width": 226.71615243495023,
          "height": 370.512611879577,
          "content": "## Settings"
        },
        "typeVersion": 1
      },
      {
        "id": "a6fe2238-22ba-4c54-adef-663bd3955dcc",
        "name": "Sticky Note15",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -360,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 179.37633247508526,
          "height": 80,
          "content": "Set the URL of your WordPress here"
        },
        "typeVersion": 1
      },
      {
        "id": "358ac79f-be7d-44eb-a353-b2ad4ac8d582",
        "name": "Check data consistency",
        "type": "n8n-nodes-base.if",
        "position": [
          300,
          320
        ],
        "parameters": {
          "options": {},
          "conditions": {
            "options": {
              "leftValue": "",
              "caseSensitive": true,
              "typeValidation": "strict"
            },
            "combinator": "and",
            "conditions": [
              {
                "id": "9c8c53ea-6079-48da-9d6e-dd527167b123",
                "operator": {
                  "type": "string",
                  "operation": "notEmpty",
                  "singleValue": true
                },
                "leftValue": "={{ $json.message.content.title }}",
                "rightValue": ""
              },
              {
                "id": "a7fabfe1-3539-453a-93d9-8d6d395c3de4",
                "operator": {
                  "type": "array",
                  "operation": "lengthGte",
                  "rightType": "number"
                },
                "leftValue": "={{ $json.message.content.chapters }}",
                "rightValue": "={{ 1 }}"
              },
              {
                "id": "a687081e-24e2-423c-a2da-b7c18baf0715",
                "operator": {
                  "type": "string",
                  "operation": "notEmpty",
                  "singleValue": true
                },
                "leftValue": "={{ $json.message.content.subtitle }}",
                "rightValue": ""
              },
              {
                "id": "0a435a69-3699-4b98-b46f-40954c7a7816",
                "operator": {
                  "type": "string",
                  "operation": "notEmpty",
                  "singleValue": true
                },
                "leftValue": "={{ $json.message.content.introduction }}",
                "rightValue": ""
              },
              {
                "id": "1a440144-21f3-42bd-9222-774bd564f3ef",
                "operator": {
                  "type": "string",
                  "operation": "notEmpty",
                  "singleValue": true
                },
                "leftValue": "={{ $json.message.content.conclusions }}",
                "rightValue": ""
              },
              {
                "id": "834ce92d-b1e9-48ef-ae63-1d0841c900b5",
                "operator": {
                  "type": "string",
                  "operation": "notEmpty",
                  "singleValue": true
                },
                "leftValue": "={{ $json.message.content.imagePrompt }}",
                "rightValue": ""
              }
            ]
          }
        },
        "typeVersion": 2
      },
      {
        "id": "479f474a-1687-4588-8485-d793afc6757d",
        "name": "Split out chapters",
        "type": "n8n-nodes-base.splitOut",
        "position": [
          600,
          320
        ],
        "parameters": {
          "options": {},
          "fieldToSplitOut": "message.content.chapters"
        },
        "typeVersion": 1
      },
      {
        "id": "bde7b7db-45c6-4ab3-a705-358000cefbec",
        "name": "Merge chapters title and text",
        "type": "n8n-nodes-base.merge",
        "position": [
          1220,
          460
        ],
        "parameters": {
          "mode": "combine",
          "options": {},
          "combinationMode": "mergeByPosition"
        },
        "typeVersion": 2.1
      },
      {
        "id": "0079022b-eaa2-481b-8c78-f8623a63645b",
        "name": "Final article text",
        "type": "n8n-nodes-base.code",
        "position": [
          1400,
          320
        ],
        "parameters": {
          "jsCode": "let article = \"\";\n\n// Introduction\narticle += $('Create post title and structure').first().json.message.content.introduction;\narticle += \"<br><br>\";\n\nfor (const item of $input.all()) {\n article += \"<strong>\" + item.json.title + \"</strong>\";\n article += \"<br><br>\";\n article += item.json.message.content;\n article += \"<br><br>\";\n}\n\n// Conclusions\narticle += \"<strong>Conclusions</strong>\";\narticle += \"<br><br>\";\narticle += $('Create post title and structure').first().json.message.content.conclusions;\n\n\nreturn [\n {\n \"article\": article\n }\n];"
        },
        "typeVersion": 1
      },
      {
        "id": "d892f00a-90fd-4bbb-bac6-4684d7d0c638",
        "name": "Post on Wordpress",
        "type": "n8n-nodes-base.wordpress",
        "position": [
          1680,
          320
        ],
        "parameters": {
          "title": "={{ $('Create post title and structure').all()[0].json.message.content.title }}",
          "additionalFields": {
            "status": "draft",
            "content": "={{ $json.article }}"
          }
        },
        "credentials": {
          "wordpressApi": {
            "id": "credential-id",
            "name": "wordpressApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "a609d80d-f586-4e5f-a72d-01257f676574",
        "name": "Upload media",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          2120,
          320
        ],
        "parameters": {
          "url": "https://wp-demo.mondo.surf/wp-json/wp/v2/media",
          "method": "POST",
          "options": {},
          "sendBody": true,
          "contentType": "binaryData",
          "sendHeaders": true,
          "authentication": "predefinedCredentialType",
          "headerParameters": {
            "parameters": [
              {
                "name": "Content-Disposition",
                "value": "attachment; filename=\"example.jpg\""
              }
            ]
          },
          "inputDataFieldName": "data",
          "nodeCredentialType": "wordpressApi"
        },
        "credentials": {
          "wordpressApi": {
            "id": "credential-id",
            "name": "wordpressApi Credential"
          }
        },
        "typeVersion": 4.1
      },
      {
        "id": "bdb2ef52-0201-4fe1-a7a6-59e34e21bf5e",
        "name": "Set image ID for the post",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          2280,
          320
        ],
        "parameters": {
          "url": "=https://wp-demo.mondo.surf/wp-json/wp/v2/posts/{{ $('Post on Wordpress').item.json.id }}",
          "method": "POST",
          "options": {},
          "sendQuery": true,
          "authentication": "predefinedCredentialType",
          "queryParameters": {
            "parameters": [
              {
                "name": "featured_media",
                "value": "={{ $json.id }}"
              }
            ]
          },
          "nodeCredentialType": "wordpressApi"
        },
        "credentials": {
          "wordpressApi": {
            "id": "credential-id",
            "name": "wordpressApi Credential"
          }
        },
        "typeVersion": 4.1
      },
      {
        "id": "a721762f-168d-4c87-ab6d-0d31deecd9a5",
        "name": "Respond: Success",
        "type": "n8n-nodes-base.respondToWebhook",
        "position": [
          2520,
          320
        ],
        "parameters": {
          "options": {},
          "respondWith": "json",
          "responseBody": "={\n \"formSubmittedText\": \"The article {{ $json.title.rendered }} was correctly created as a draft on WordPress!\"\n}"
        },
        "typeVersion": 1
      },
      {
        "id": "51b79bc2-035d-4db8-87bb-db6c889b164e",
        "name": "Respond: Error",
        "type": "n8n-nodes-base.respondToWebhook",
        "position": [
          620,
          580
        ],
        "parameters": {
          "options": {},
          "respondWith": "json",
          "responseBody": "={\n 'formSubmittedText': 'There was a problem creating the article, please refresh the form and try again!'\n}\n\n"
        },
        "typeVersion": 1
      },
      {
        "id": "d8748498-0800-4208-b993-f233d14da7b6",
        "name": "Sticky Note16",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          533.7711864406776,
          140
        ],
        "parameters": {
          "color": 2,
          "width": 225.47038972308582,
          "height": 370.512611879577,
          "content": "## Chapters split"
        },
        "typeVersion": 1
      },
      {
        "id": "4115de31-d4e9-4d77-a055-3dead31c4dc5",
        "name": "Sticky Note17",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          550.7711864406779,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 185.6051460344073,
          "height": 80,
          "content": "Splits out chapter contents from the previous node"
        },
        "typeVersion": 1
      },
      {
        "id": "aff8edf6-4e1e-4522-86f7-f0ce88cd0cd4",
        "name": "Sticky Note18",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          792,
          198
        ],
        "parameters": {
          "color": 7,
          "width": 287.370178643191,
          "height": 80,
          "content": "Writes the text for each chapter"
        },
        "typeVersion": 1
      },
      {
        "id": "e45715a8-b1ca-4499-a16a-854f8bd4f370",
        "name": "Sticky Note19",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          780,
          140
        ],
        "parameters": {
          "color": 6,
          "width": 333.40108076977657,
          "height": 370.512611879577,
          "content": "## Chapters text"
        },
        "typeVersion": 1
      },
      {
        "id": "5c4cd7a1-7dc9-4159-9bd2-dbe5f8feb663",
        "name": "Sticky Note21",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1138.423429009716,
          140
        ],
        "parameters": {
          "color": 4,
          "width": 420.4253447940705,
          "height": 514.2177254645992,
          "content": "## Content preparation"
        },
        "typeVersion": 1
      },
      {
        "id": "7a6d3f7d-0436-4844-b09a-37e805b95a2f",
        "name": "Sticky Note22",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1160,
          200
        ],
        "parameters": {
          "color": 7,
          "width": 368.1523541074699,
          "height": 80,
          "content": "Merges the content and prepare it before sending it to WordPress"
        },
        "typeVersion": 1
      },
      {
        "id": "903b695d-015a-4956-9c63-45802dfb9fdb",
        "name": "Generate featured image",
        "type": "@n8n/n8n-nodes-langchain.openAi",
        "position": [
          1940,
          320
        ],
        "parameters": {
          "prompt": "=Generate a photographic image to be used as the cover image for the article titled: {{ $('Create post title and structure').all()[0].json.message.content.title }}. This is the prompt for the image: {{ $('Create post title and structure').all()[0].json.message.content.imagePrompt }}, photography, realistic, sigma 85mm f/1.4",
          "options": {
            "size": "1792x1024",
            "style": "natural",
            "quality": "hd"
          },
          "resource": "image"
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "faa847cb-9702-4207-aa1e-6d9f62493527",
        "name": "Wikipedia",
        "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
        "position": [
          -20,
          620
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "9d09c92e-11c0-4ea9-81d6-13bc9266741a",
        "name": "Create post title and structure",
        "type": "@n8n/n8n-nodes-langchain.openAi",
        "position": [
          -100,
          320
        ],
        "parameters": {
          "modelId": {
            "__rl": true,
            "mode": "list",
            "value": "gpt-4-1106-preview",
            "cachedResultName": "GPT-4-1106-PREVIEW"
          },
          "options": {
            "maxTokens": 2048
          },
          "messages": {
            "values": [
              {
                "content": "=Write the title, the subtitle, the chapters details, the introduction, the conclusions, and an image prompt for a SEO-friendly article about these topics:\n{{ $json.keywords }}.\n\nInstructions:\n- Place the article title in a JSON field called `title`\n- Place the subtitle in a JSON field called `subtitle`\n- Place the introduction in a JSON field called `introduction`\n- In the introduction introduce the topic that is then explored in depth in the rest of the text\n- The introduction should be around 60 words\n- Place the conclusions in a JSON field called `conclusions`\n- The conclusions should be around 60 words\n- Use the conclusions to sum all said in the article and offer a conclusion to the reader\n- The image prompt will be used to produce a photographic cover image for the article and should depict the topics discussed in the article\n- Place the image prompt in a JSON field called `imagePrompt`\n- There should be {{ $json.chapters.toString() }} chapters.\n- For each chapter provide a title and an exaustive prompt that will be used to write the chapter text.\n- Place the chapters in an array field called `chapters`\n- For each chapter provide the fields `title` and `prompt`\n- The chapters should follow a logical flow and not repeat the same concepts.\n- The chapters should be one related to the other and not isolated blocks of text. The text should be fluent and folow a linear logic.\n- Don't start the chapters with \"Chapter 1\", \"Chapter 2\", \"Chapter 3\"... just write the title of the chapter\n- For the title and the capthers' titles don't use colons (`:`)\n- For the text, use HTML for formatting, but limited to bold, italic and lists.\n- Don't use markdown for formatting.\n- Always search on Wikipedia for useful information or verify the accuracy of what you write.\n- Never mention it if you don't find information on Wikipedia or the web\n- Go deep in the topic you treat, don't just throw some superficial info"
              }
            ]
          },
          "jsonOutput": true
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "2ecd3a50-a34f-4ab9-ad31-e4e6608708fb",
        "name": "Create chapters text",
        "type": "@n8n/n8n-nodes-langchain.openAi",
        "position": [
          820,
          320
        ],
        "parameters": {
          "modelId": {
            "__rl": true,
            "mode": "list",
            "value": "gpt-4-0125-preview",
            "cachedResultName": "GPT-4-0125-PREVIEW"
          },
          "options": {
            "maxTokens": 2048
          },
          "messages": {
            "values": [
              {
                "content": "=Write a chapter for the article: {{ $('Create post title and structure').item.json.message.content.title }}, {{ $('Create post title and structure').item.json.message.content.subtitle }}, that talks about {{ $('Settings').item.json[\"keywords\"] }}\n\nThis is the prompt for the chapter titled {{ $json.title }}: {{ $json.prompt }}.\n\nGuidelines:\n- Just return the plain text for each chapter (no JSON structure).\n- Don't use markdown for formatting.\n- Use HTML for formatting, but limited to bold, italic and lists.\n- Don't add internal titles or headings.\n- The length of each chapther should be around {{ Math.round(($('Settings').item.json.words - 120)/ $('Settings').item.json.chapters) }} words long\n- Go deep in the topic you treat, don't just throw some superficial info\n{{ $itemIndex > 0 ? \"- The previous chapter talks about \" + $input.all()[$itemIndex-1].json.title : \"\" }}\n{{ $itemIndex > 0 ? \"- The promt for the previous chapter is \" + $input.all()[$itemIndex-1].json.prompt : \"\" }}\n{{ $itemIndex < $input.all().length ? \"- The following chapter will talk about \" + $input.all()[$itemIndex+1].json.title: \"\" }}\n{{ $itemIndex < $input.all().length ? \"- The prompt for the following chapter is \" + $input.all()[$itemIndex+1].json.prompt : \"\" }}\n- Consider the previous and following chapters what writing the text for this chapter. The text must be coherent with the previous and following chapters.\n- This chapter should not repeat the concepts already exposed in the previous chapter.\n- This chapter is a part of a larger article so don't include an introduction or conclusions. This chapter should merge with the rest of the article.\n"
              }
            ]
          }
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1
      }
    ],
    "active": true,
    "pinData": {},
    "settings": {
      "callerPolicy": "workflowsFromSameOwner",
      "executionOrder": "v1",
      "saveManualExecutions": true,
      "saveDataSuccessExecution": "all"
    },
    "versionId": "64d94f1e-51c8-40f7-a6b3-80fc43d9e71a",
    "connections": {
      "Form": {
        "main": [
          [
            {
              "node": "Settings",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Settings": {
        "main": [
          [
            {
              "node": "Create post title and structure",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Wikipedia": {
        "ai_tool": [
          [
            {
              "node": "Create post title and structure",
              "type": "ai_tool",
              "index": 0
            }
          ]
        ]
      },
      "Upload media": {
        "main": [
          [
            {
              "node": "Set image ID for the post",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Post on Wordpress": {
        "main": [
          [
            {
              "node": "Generate featured image",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Final article text": {
        "main": [
          [
            {
              "node": "Post on Wordpress",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Split out chapters": {
        "main": [
          [
            {
              "node": "Merge chapters title and text",
              "type": "main",
              "index": 1
            },
            {
              "node": "Create chapters text",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Create chapters text": {
        "main": [
          [
            {
              "node": "Merge chapters title and text",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Check data consistency": {
        "main": [
          [
            {
              "node": "Split out chapters",
              "type": "main",
              "index": 0
            }
          ],
          [
            {
              "node": "Respond: Error",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Generate featured image": {
        "main": [
          [
            {
              "node": "Upload media",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Set image ID for the post": {
        "main": [
          [
            {
              "node": "Respond: Success",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Merge chapters title and text": {
        "main": [
          [
            {
              "node": "Final article text",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Create post title and structure": {
        "main": [
          [
            {
              "node": "Check data consistency",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 37,
    "nodeTypes": {
      "n8n-nodes-base.if": {
        "count": 1
      },
      "n8n-nodes-base.set": {
        "count": 1
      },
      "n8n-nodes-base.code": {
        "count": 1
      },
      "n8n-nodes-base.merge": {
        "count": 1
      },
      "n8n-nodes-base.splitOut": {
        "count": 1
      },
      "n8n-nodes-base.wordpress": {
        "count": 1
      },
      "n8n-nodes-base.stickyNote": {
        "count": 22
      },
      "n8n-nodes-base.formTrigger": {
        "count": 1
      },
      "n8n-nodes-base.httpRequest": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.openAi": {
        "count": 3
      },
      "n8n-nodes-base.respondToWebhook": {
        "count": 2
      },
      "@n8n/n8n-nodes-langchain.toolWikipedia": {
        "count": 1
      }
    }
  },
  "nodes": [
    "Form",
    "Sticky Note2",
    "Sticky Note3",
    "Sticky Note5",
    "Sticky Note9",
    "Sticky Note10",
    "Sticky Note11",
    "Sticky Note12",
    "Sticky Note",
    "Sticky Note1",
    "Sticky Note13",
    "Sticky Note4",
    "Sticky Note14",
    "Sticky Note6",
    "Sticky Note7",
    "Settings",
    "Sticky Note8",
    "Sticky Note15",
    "Check data consistency",
    "Split out chapters",
    "Merge chapters title and text",
    "Final article text",
    "Post on Wordpress",
    "Upload media",
    "Set image ID for the post",
    "Respond: Success",
    "Respond: Error",
    "Sticky Note16",
    "Sticky Note17",
    "Sticky Note18",
    "Sticky Note19",
    "Sticky Note21",
    "Sticky Note22",
    "Generate featured image",
    "Wikipedia",
    "Create post title and structure",
    "Create chapters text"
  ],
  "nodeTypes": [
    "n8n-nodes-base.splitOut",
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.code",
    "n8n-nodes-base.wordpress",
    "n8n-nodes-base.stickyNote",
    "@n8n/n8n-nodes-langchain.openAi",
    "@n8n/n8n-nodes-langchain.toolWikipedia",
    "n8n-nodes-base.if",
    "n8n-nodes-base.merge",
    "n8n-nodes-base.formTrigger",
    "n8n-nodes-base.set",
    "n8n-nodes-base.respondToWebhook"
  ]
}