See llms.txt for all machine-readable content.

Back to Templates

Create LinkedIn posts from articles with OpenAI, Pexels and Google Sheets

Created by

Created by: Khadija Naeem || khadijanaeem
Khadija Naeem

Last update

Last update a day ago

Categories

Share


Quick overview

This workflow runs on a daily schedule, reads a “TO DO” topic from Google Sheets, uses Tavily and OpenAI to generate a LinkedIn post, finds and selects a matching image from Pexels, uploads the image to LinkedIn, publishes the post, and writes the generated content back to Google Sheets.

How it works

  1. Runs on a schedule and fetches the first Google Sheets row where the Status column is set to “TO DO”.
  2. Searches the web for the row’s Topic using the Tavily Search API and collects content from the top three results.
  3. Uses OpenAI (GPT-4) to synthesize the three article excerpts into a single LinkedIn post and outputs JSON containing the post text, an image search query, and image alt text.
  4. Uses OpenAI to refine the post into a 2–5 keyword visual search query and then searches Pexels for 10 landscape images.
  5. Uses OpenAI (GPT-4o) to review the 10 Pexels image URLs and select the best match, then extracts the chosen image URL.
  6. Downloads the selected image, uploads it to LinkedIn via the LinkedIn REST image upload endpoint, and publishes the LinkedIn post with the uploaded image.
  7. Updates the matching row in Google Sheets with the generated content output.

Setup

  1. Connect Google Sheets OAuth credentials and ensure your spreadsheet has at least Topic and Status columns, with rows marked “TO DO” to be picked up.
  2. Add an OpenAI API credential (GPT-4 and GPT-4o access) for post generation and image selection.
  3. Add API keys for Tavily Search and Pexels and replace the hard-coded Authorization headers in the HTTP Request nodes.
  4. Create a LinkedIn app/access token with permission to upload images and post, then set your person URN (YOUR_PERSON_ID), access token (YOUR_ACCESS_TOKEN), and desired visibility.
  5. (Optional) Connect Google Drive OAuth credentials and set the target folder ID if you want to save the downloaded image to Google Drive.