Skip to main content

Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search

Workflow preview

Workflow preview
100%
Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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 folde...

Best for

  • Social Media automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.googledrivetrigger, n8n-nodes-base.googledrive, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Mohamed Abdelwahab.

Original n8n.io source

1.1 Workflow description

Title
Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search
Workflow name
Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search

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

  • Trigger: Watches a folder for new or updated PDF files.
  • Action: Downloads the updated PDF.

πŸ“„ 2. Extract and Embed Content

  • Extract from File: Parses PDF to extract text.
  • Text Splitter: Breaks text into chunks.
  • Embeddings (OpenAI): Converts chunks into vector embeddings.
  • Pinecone Vector Store: Saves the embeddings with the book name as namespace.

🧠 3. Post Idea Generation (LangChain Agent)

  • Uses a prompt to:
    • Search Pinecone DB
    • Extract insights
    • Format into 5 LinkedIn post ideas with:
      • Hook
      • Insight
      • CTA
  • Memory buffer and structured output parser are used for clean AI interaction.

✍️ 4. Post Creation

  • Each idea is:
    • Split
    • Rewritten with a GPT model prompt to match LinkedIn tone
    • Styled for under 600 characters
    • Includes emojis, hashtags, and tone guidelines

πŸ“Š 5. Google Sheet Integration

  • Saves all generated posts to a Google Sheet.
  • Marks status: "published" or "no".

πŸ” 6. Scheduled Publishing

  • Every day:
    • Pulls an unpublished post
    • Publishes it to LinkedIn
    • Updates the post's status and timestamp in the Google Sheet

βš™οΈ Setup Guide

πŸ“‚ Google Drive

  • Create a folder for book PDFs
  • Connect your Google Drive account to n8n
  • Provide access token with file read permission

πŸ“Š Google Sheets

  • Create a Google Sheet with columns:
    • bookname, hook, insight, cta, postContent, published, date
  • Add credentials in n8n with read/write permission

🧠 Pinecone

  • Set up a Pinecone project and index (linkdenpost)
  • Namespace will be auto-named using the book filename

πŸ”‘ API Credentials Required

  • OpenAI API (for embeddings and post generation)
  • Pinecone API (for vector storage and retrieval)
  • LinkedIn OAuth2 (to publish posts)
  • Google Drive & Sheets credentials

πŸ” 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

  • Uses Schedule Trigger to post daily at a set time.
  • Ensures automation with LinkedIn and accurate Google Sheet syncing.

πŸ“ Notes

  • Posts remain professional and concise for a LinkedIn audience
  • Works with any PDF book
  • Supports multi-book pipelines
  • You can filter and tag books by filename or folder for segmenting post styles

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Google Drive Trigger

Type / Role
n8n-nodes-base.googleDriveTrigger - googleDriveTrigger
Config choices
Version 1

Block 2 - DownLoadPdf

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 3 - Extract from File

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 4 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.2

Block 5 - Embeddings OpenAI

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 6 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 7 - Recursive Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 8 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 9 - LinkedIn Post Idea Generation

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 10 - Embeddings OpenAI1

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 11 - Pinecorn Vector Store-book

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.2

Block 12 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 13 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 14 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 15 - GeneratePostContent

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 16 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 17 - Limit

Type / Role
n8n-nodes-base.limit - limit
Config choices
Version 1

Block 18 - LinkedIn

Type / Role
n8n-nodes-base.linkedIn - linkedIn
Config choices
Version 1

Block 19 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 20 - linkedInPostsContent

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 21 - linkedInPostsContent1

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 22 - linkedInPostsContent2

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.6

Block 23 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search
Complexity advanced
Nodes 28
Categories Social Media, AI RAG
Author Mohamed Abdelwahab
Published 20 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6198/6198.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate LinkedIn posts from books using OpenAI, LangChain & Pinecone vector search do?

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 folde...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Social Media, AI RAG use case.