Convert Research Topics to HTML Articles with Perplexity AI in n8n

This n8n workflow automates converting user research topics into fully formatted HTML articles using the Perplexity AI tool. It solves the challenge of manual content creation by delivering structured, SEO-friendly posts effortlessly.
ai_tool
Learn how to Build this Workflow with AI:
Workflow Identifier: 2002
NODES in Use: ai_tool

Press CTRL+F5 if the workflow didn't load.

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Sarah, a content marketer who spends hours each week researching and writing detailed articles based on trending topics her team gathers. She often struggles to keep up with the sheer volume of content needed while maintaining quality and structure. Manually compiling research, formatting articles, and ensuring SEO-friendly content is time-consuming and error-prone, leading to missed deadlines and lost opportunities.

Sarah needs a streamlined solution that can take her raw research topics, gather reliable information, and rapidly output polished, ready-to-publish HTML articles — all without requiring her to code or spend countless hours editing content.

2. What This Automation Does

This Perplexity AI-powered n8n workflow automates the entire content creation process from topic input to fully formatted HTML article output. When triggered, it:

  • Accepts a research topic via a webhook or chat input.
  • Leverages the Perplexity AI tool node to query the latest, relevant data on the given topic.
  • Structures the AI’s response into a detailed article including title, sections, quotes, and hashtags.
  • Converts the structured article data into a clean, single-line HTML document formatted with proper headings, paragraphs, and blockquotes.
  • Delivers the HTML content as a response ready to be embedded or published on blogs, newsletters, or websites.

This workflow reduces content creation time from hours to minutes, eliminates formatting errors, and ensures consistent, professional output without manual intervention.

3. Prerequisites ⚙️

  • n8n account configured and ready to build workflows.
  • Perplexity AI tool node configured with an OpenAI GPT API key (to enable the “ai_tool” node).
  • Webhook URL or other trigger mechanism to input topic data.
  • Basic knowledge of JSON formatting to understand the article schema.

4. Step-by-Step Guide

Step 1: Create the Trigger Webhook Node

Navigate to “Nodes” → “Webhook” → “Create New Webhook”. Configure it to receive HTTP POST requests. Set the path, for example, “pblog”. This webhook will accept incoming topic requests.

After saving, copy the generated webhook URL for use in later testing.

Expected outcome: Your webhook is ready to receive topic data submissions.

Common mistake: Forgetting to set the request method to POST or not saving the webhook node.

Step 2: Add the Perplexity AI Tool Node

Drag the “AI Tool” node onto the canvas. Select the model “gpt-4o-mini-2024-07-18”. In the parameters section, input your OpenAI API credentials in the credentials tab under “OpenAI API”.

Configure the JSON body query to send topic data structured as follows:

{
  "model": "llama-3.1-sonar-small-128k-online",
  "messages": [
    {"role": "system", "content": "Your system prompt here."},
    {"role": "user", "content": "{{ $json.text }}"}
  ],
  "max_tokens": 4000,
  "temperature": 0.2
}

This node will perform the research query and return raw article content in JSON format.

Common mistake: Not providing valid API credentials, resulting in authentication errors.

Step 3: Extract and Structure Article Data

Use a Function or Set node to parse the AI response JSON, ensuring the article object contains mandatory fields: category, title, metadata, content, and hashtags. Your structure should match the workflow’s input schema.

Step 4: Convert Article JSON to HTML

This workflow uses the AI tool node again to convert the structured JSON article to clean HTML. Configure the node to use a prompt like:

=Convert this verbatim into HTML: {{ $json.article.toJsonString() }}

## Formatting Guidelines
- HTML document must be single line document without tabs or line breaks
- Use proper HTML tags throughout
- Use 

for main title,

for sections,

for paragraphs,

for quotes - Maintain professional tone and consistent formatting

Expected outcome: You receive a single-line HTML string with all article parts properly formatted.

Step 5: Return the HTML Response

Use the ‘Respond to Webhook’ node to output the final HTML article. Configure it to respond with the single-line HTML string from the previous node’s output.

5. Customizations ✏️

  • Change AI Model: In the AI Tool node, update the “model” parameter to another version like “gpt-4o” for different text styles.
  • Modify Article Schema: Adjust the JSON article structure in the parsing node to include extra metadata fields such as “readingTime” or “authorBio”.
  • Trigger Variations: Replace the Webhook trigger with a Telegram node to get topics from chat inputs.
  • Output Formats: Extend beyond HTML by adding nodes to also output Markdown or PDF formats.

6. Troubleshooting 🔧

Problem: “Authentication failed for OpenAI API”

Cause: Incorrect or missing API key in credentials.

Solution: Go to the AI Tool node → Credentials → update your OpenAI API key. Test with a simple prompt to confirm connection.

Problem: “Webhook does not receive data”

Cause: Incorrect webhook URL or wrong HTTP method.

Solution: Verify webhook URL is copied correctly and ensure it is set to accept POST requests.

7. Pre-Production Checklist ✅

  • Verify OpenAI API credentials in the AI Tool node.
  • Test webhook by sending sample JSON topic data via POST.
  • Confirm AI response matches expected article schema fields.
  • Preview HTML output for formatting correctness.
  • Back up workflow before production deployment.

8. Deployment Guide

Activate your workflow by toggling it on in n8n. Share the webhook URL with content requesters or integrate into your CMS to automate article creation.

Monitor executions via n8n’s executions dashboard to troubleshoot or optimize performance.

9. FAQs

Can I use other AI models instead of the one configured?

Yes, you can change the model parameter inside the AI Tool node to other supported models like GPT-4o or GPT-3.5 turbo, depending on your access and needs.

Does this consume OpenAI API credits?

Yes, each AI request uses your OpenAI API credits, so monitor usage to avoid unexpected costs.

Is the output safe to publish directly?

The output is generated text and should be reviewed for accuracy and tone before publishing.

10. Conclusion

By following this tutorial, you have built an advanced content automation workflow in n8n using the Perplexity AI tool node to convert research topics into fully formatted HTML articles quickly and efficiently.

This automation saves hours weekly in manual content crafting and formatting, freeing marketers like Sarah to focus on strategy instead of busywork.

Next steps: integrate a webhook to capture topic requests from social media, add more AI enhancements for SEO optimization, or expand output formats to include PDF newsletters.

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free