n8n Website Automation: Auto-Publish Pages to HTMLPub
This n8n website automation workflow accepts a topic via webhook, generates a complete HTML page with OpenAI, and publishes it to HTMLPub. The live URL comes back in the response.
Four nodes. No code required.
The Workflow
Node 1: Webhook Trigger
Node type: Webhook
HTTP Method: POST
Path: /publish-page
Expected request body:
{
"topic": "Your page topic or description",
"style": "Optional style notes (e.g. minimal, dark, bold)"
}
Node 2: Generate HTML with OpenAI
Node type: OpenAI
Operation: Message a Model
Model: gpt-4o
System prompt:
You are a web developer. Generate a complete, single-file HTML page with inline CSS and JavaScript. The page should be clean, mobile-responsive, and ready to publish immediately. Return only the HTML code. No explanation, no markdown fencing — just the raw HTML.
User message:
Build a page about: {{ $json.body.topic }}
Style notes: {{ $json.body.style }}
Node 3: Publish to HTMLPub
Node type: HTTP Request
Method: POST
URL: https://api.htmlpub.com/v1/pages
Headers:
Authorization: Bearer YOUR_HTMLPUB_API_KEY
Content-Type: application/json
Body (JSON):
{
"title": "{{ $('Webhook').item.json.body.topic }}",
"html": "{{ $('Generate HTML').item.json.choices[0].message.content }}",
"status": "published"
}
Replace YOUR_HTMLPUB_API_KEY with your key from the HTMLPub dashboard under Settings > API.
Node 4: Respond to Webhook
Node type: Respond to Webhook
Response body:
{
"url": "{{ $json.url }}",
"id": "{{ $json.id }}"
}
What Happens When You Run It
Send a POST to your webhook URL:
{
"topic": "Free trial landing page for a time-tracking app targeting freelancers",
"style": "Clean, minimal, conversion-focused with a single CTA"
}
Within 15-20 seconds, you get back:
{
"url": "https://pages.htmlpub.com/your-page-slug",
"id": "abc123"
}
The page is live.
One Variation: Batch Page Generator
Replace the Webhook Trigger with a Google Sheets node set to read rows. Pull a column of topics and run the workflow for each row in sequence. Useful for generating multiple landing page variants, a batch of location-specific pages, or a set of SEO pages from a keyword list.
Connect a Wait node between pages if you're generating large batches, to avoid hitting OpenAI rate limits.
For the full HTMLPub API reference, see Automate Web Publishing with AI + the HTMLPub API. If you want a simpler setup without n8n, the Claude MCP connector does the same thing inside a Claude conversation.