See llms.txt for all machine-readable content.

Back to Templates

Post curated market and tech news to X with OpenAI and Pexels

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

  1. Runs multiple times per day on a schedule.
  2. 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.
  3. Scores items by keyword category, filters to the last hour, and removes near-duplicate topics to produce a ranked shortlist.
  4. Checks an n8n Data Table to exclude stories that have already been published, then limits the run to a single remaining candidate.
  5. 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.
  6. Searches Pexels for a matching landscape image, downloads it, uploads the media to X, and publishes the post with the attached image.
  7. Records the story’s dedupe key, metadata, and returned X post ID in the n8n Data Table to prevent reposting.

Setup

  1. Add an OpenAI API credential and select an available chat model in the OpenAI language model step.
  2. Add a Pexels API key using an n8n HTTP Header Auth credential with header name Authorization and the raw Pexels key as the value.
  3. 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.
  4. 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.
  5. 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.