πŸ“± Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search

⚑ 957 views Β· πŸ“± Social Media & Email Marketing

πŸ’‘ Pro Tip β€” If you’re pulling LinkedIn data through HTTP requests or dealing with API restrictions, there’s a community node called ScraperNode that handles this natively. It has dedicated scrapers for profiles, companies, jobs, and people search β€” you just pass a URL and get structured data back.

View All Scrapers

Description

Automates the process of generating, storing, and publishing engaging LinkedIn posts derived from books (PDFs) using AI and vector search.


🧠 Overview

This workflow:

  1. Watches a Google Drive folder for new or updated book PDFs.
  2. Extracts and embeds the content using OpenAI.
  3. Stores the data in a Pinecone vector database.
  4. Uses a LangChain agent to generate post ideas.
  5. Creates concise LinkedIn posts with hook, insight, CTA.
  6. Updates a Google Sheet and posts to LinkedIn.

πŸ›  Workflow Breakdown

πŸ“₯ 1. Google Drive Trigger

πŸ“„ 2. Extract and Embed Content

🧠 3. Post Idea Generation (LangChain Agent)

✍️ 4. Post Creation

πŸ“Š 5. Google Sheet Integration

πŸ” 6. Scheduled Publishing


βš™οΈ Setup Guide

πŸ“‚ Google Drive

πŸ“Š Google Sheets

🧠 Pinecone

πŸ”‘ API Credentials Required


πŸ” Flow Summary

graph TD
  A[Google Drive Trigger] --> B[Download PDF]
  B --> C[Extract Text]
  C --> D[Text Splitter]
  D --> E[Create Embeddings]
  E --> F[Pinecone Vector Store]
  F --> G[LangChain Agent]
  G --> H[Structured Output (5 Post Ideas)]
  H --> I[Split Ideas]
  I --> J[Format as LinkedIn Post (GPT)]
  J --> K[Store in Google Sheet]
  L[Schedule Trigger] --> M[Get Unpublished Post]
  M --> N[Post to LinkedIn]
  N --> O[Mark as Published]

πŸ§ͺ Prompt Example (Used in LangChain Agent)

You are a content strategist. Search the Pinecone vector DB containing a book. Generate 5 unique LinkedIn post ideas with:
- A Hook (curiosity driven)
- Insight (summary < 100 words)
- CTA ("Agree or disagree?", etc.)

Respond in structured JSON:
[
  { "Hook": "...", "Insight": "...", "CTA": "..." },
  ...
]

βœ… Output Sample

{
  "Hook": "Why your lab's results might be invalid 😱",
  "Insight": "ISO/IEC 17025 stresses that labs must plan and address risks to impartiality and validity.",
  "CTA": "Does your lab audit for these risks?"
}

πŸ“† Schedule Control


πŸ“ Notes

πŸ”— Nodes Used

Google Sheets, Google Drive, LinkedIn, Google Drive Trigger, Schedule Trigger, AI Agent

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup