Quick Overview
This workflow runs on a schedule, aggregates nine market and tech RSS feeds, ranks and deduplicates recent stories, uses OpenAI to draft an X post and a Pexels image query, then uploads an image and publishes the post to X while logging published items in an n8n Data Table.
How it works
- Runs multiple times per day on a schedule.
- Reads the latest items from nine RSS feeds (Financial Times, MarketWatch, The Verge AI, Google News RSS search for Reuters, CNBC, Nasdaq, and three Investing.com feeds) and combines them into a single list.
- Scores items by keyword category, filters to the last hour, and removes near-duplicate topics to produce a ranked shortlist.
- Checks an n8n Data Table to exclude stories that have already been published, then limits the run to a single remaining candidate.
- Uses OpenAI to generate a JSON payload containing an X post (or SKIP) and a broad Pexels search query, and validates that the output is valid JSON under 500 characters.
- Searches Pexels for a matching landscape image, downloads it, uploads the media to X, and publishes the post with the attached image.
- Records the story’s dedupe key, metadata, and returned X post ID in the n8n Data Table to prevent reposting.
Setup
- Add an OpenAI API credential and select an available chat model in the OpenAI language model step.
- Add a Pexels API key using an n8n HTTP Header Auth credential with header name Authorization and the raw Pexels key as the value.
- Connect X credentials for both posting (OAuth2) and media upload (OAuth 1.0a for the legacy upload.twitter.com endpoint) and confirm your X plan/app permissions support media uploads.
- Create an n8n Data Table named published_news_log with String columns dedupeKey, title, link, category, and tweetId, and select it in both Data Table steps.
- Review and adjust the schedule/timezone, RSS feed URLs, ranking rules (age window, weights, similarity threshold), and the OpenAI prompt/character limit before enabling active posting.