Quick overview
This workflow captures LinkedIn post topics from incoming Gmail messages into Google Sheets, then runs daily cleanup and AI generation with Google Gemini to publish a post to a LinkedIn organization page, updating the sheet and sending Gmail notifications.
How it works
- Triggers every minute on new unread Gmail messages matching the configured search query.
- Extracts comma-separated topics from the email text, normalizes them, finds the next blank rows in Google Sheets, writes the topics into the sheet, and emails a formatted confirmation summary.
- Runs daily on a schedule, loads all rows from Google Sheets, identifies and deletes invalid/empty rows with leftover metadata to keep the sheet consistent.
- Filters the sheet to find topics whose REFINED status is not TRUE and marks those rows as refined in Google Sheets.
- Retrieves the first Google Sheets row where POSTED? is No and REFINED is true, and stops with a Gmail alert if no topics are available.
- Uses Google Gemini (via an AI agent prompt) to generate a formatted LinkedIn post from the selected topic and publishes it to the configured LinkedIn organization page.
- Updates the same Google Sheets row with POSTED?=Yes plus the current date and time, then sends a Gmail notification confirming the post was published.
Setup
- Connect credentials for Gmail OAuth2, Google Sheets OAuth2, LinkedIn OAuth2, and a Google Gemini (PaLM/Google AI) API key.
- Update all Gmail nodes with your recipient address, sender name, and any Gmail Trigger search query you want to use (for example, to filter topic-submission emails).
- Set your Google Sheets document and sheet, and ensure the sheet has the columns TOPICS, REFINED, POSTED?, DATE, and TIME (with row_number available for matching).
- Update the LinkedIn organization ID and ensure the authenticated LinkedIn account has permission to post as that organization.
- Review the daily schedule time and timezone-dependent date/time formatting and adjust them to match your posting schedule.
Additional info
This workflow is created by Huzaifa Jamil. For any Query and Curiosity email here [email protected]