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
- Runs on a schedule and fetches the first Google Sheets row where the Status column is set to “TO DO”.
- Searches the web for the row’s Topic using the Tavily Search API and collects content from the top three results.
- 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.
- Uses OpenAI to refine the post into a 2–5 keyword visual search query and then searches Pexels for 10 landscape images.
- Uses OpenAI (GPT-4o) to review the 10 Pexels image URLs and select the best match, then extracts the chosen image URL.
- Downloads the selected image, uploads it to LinkedIn via the LinkedIn REST image upload endpoint, and publishes the LinkedIn post with the uploaded image.
- Updates the matching row in Google Sheets with the generated content output.
Setup
- 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.
- Add an OpenAI API credential (GPT-4 and GPT-4o access) for post generation and image selection.
- Add API keys for Tavily Search and Pexels and replace the hard-coded Authorization headers in the HTTP Request nodes.
- 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.
- (Optional) Connect Google Drive OAuth credentials and set the target folder ID if you want to save the downloaded image to Google Drive.