Quick Overview
This workflow collects a research query from an n8n form, researches it with Perplexity, drafts and formats an SEO blog post using OpenRouter and Google Gemini, then creates a draft in WordPress, uploads and sets a featured image, and sends a Telegram success message.
How it works
- Receives a research query from an n8n form submission.
- Sends the query to the Perplexity API and rewrites citation markers into source-linked text.
- Uses an OpenRouter chat model to draft a long-form, SEO-focused blog post based on the research.
- Generates a JSON title, slug, and meta description via an OpenRouter-powered agent and parses the structured output.
- Sends the blog draft to Google Gemini to convert it into WordPress-compatible HTML with a table of contents, FAQ, and styling rules.
- Aggregates the generated HTML and metadata, cleans the HTML output, and creates a draft post in WordPress.
- Downloads an image from a configured URL, uploads it to the WordPress Media Library, sets it as the post’s featured image, and notifies a Telegram chat.
Setup
- Create credentials for Perplexity API (HTTP Header Auth) and update the request headers/body as needed for your Perplexity account.
- Add an OpenRouter API credential for the two OpenRouter chat model connections used to write the draft and generate title/slug/meta.
- Add a Google Gemini (Google PaLM) API credential for the HTML-generation step.
- Add WordPress API credentials and update the WordPress site base URL used in the media upload and post update HTTP requests.
- Create a Telegram bot credential, set the TELEGRAM_CHAT_ID environment variable, and choose the chat where the success message should be sent.
- Replace the hardcoded image URL (or extend the workflow to generate/select images dynamically) before publishing.