Quick overview
This workflow selects and drafts a LinkedIn post from Supabase-sourced topics or newly uploaded Google Drive files, extracts and cleans source content (PDF/image/URL/text), uses Groq and Google Gemini models plus Pinecone reference patterns to generate and quality-check the draft, and publishes to LinkedIn after Slack approval.
How it works
- Runs daily on a schedule or triggers when a new file is created in a specific Google Drive folder.
- On scheduled runs, reads eligible topics from a Supabase view and uses a Groq-powered AI agent to select a topic (or recommend skipping) before fetching the full topic record from Supabase.
- Routes the selected topic’s source by type and extracts content by downloading and OCR-cleaning images, extracting PDF text, fetching and cleaning URL HTML, or passing through provided text into a single normalized text field.
- Truncates the text and uses a Groq-powered AI agent to extract structured facts, angles, technical details, and privacy flags for the topic.
- Uses a Google Gemini-powered AI agent that can query a Pinecone vector index to produce a strategy contract (angle, format, hook, structure, CTA, length) and logs it to Supabase.
- Generates a draft post with Groq, runs a Groq-based quality checker for factual support, strategy compliance, readability, and privacy, and sends the draft and checks to Slack for Approve/Reject/Regenerate feedback.
- If approved, creates the LinkedIn post and logs it in Supabase; if rejected, archives the topic in Supabase; if no response arrives, sends a Gmail approval link and waits for a webhook decision, and if regeneration is requested, re-runs generation using the reviewer feedback.
Setup
- Create the required Supabase tables/views (
trending_topics_inventory, eligible_trending_topics, strategy_contracts, post_review_log, published_posts) and add Supabase credentials.
- Add Google Drive OAuth credentials, set the folder to watch, and ensure your Supabase topics use
source_type values of File, url, or text with the corresponding reference_source/text fields.
- Add Groq API credentials for topic selection, OCR clean-up, resource analysis, post generation, and quality checking.
- Add Google Gemini credentials for the strategist model and for generating embeddings used by Pinecone.
- Add Pinecone credentials and ensure the
linkedin-reference-content index exists and contains reference post patterns.
- Add Slack, Gmail, and LinkedIn OAuth credentials, then set the Slack review channel and the timeout notification email recipient.