From 155e2702a9839b8ad8ca37a7dbed48dae5fd1668 Mon Sep 17 00:00:00 2001 From: nusquama Date: Wed, 12 Nov 2025 16:15:00 +0100 Subject: [PATCH] creation --- .../readme-10338.md | 304 ++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 workflows/Automate FAQ Generation from Stack Overflow to Notion using GPT-4o-mini with Slack Alerts-10338/readme-10338.md diff --git a/workflows/Automate FAQ Generation from Stack Overflow to Notion using GPT-4o-mini with Slack Alerts-10338/readme-10338.md b/workflows/Automate FAQ Generation from Stack Overflow to Notion using GPT-4o-mini with Slack Alerts-10338/readme-10338.md new file mode 100644 index 000000000..cd20a350f --- /dev/null +++ b/workflows/Automate FAQ Generation from Stack Overflow to Notion using GPT-4o-mini with Slack Alerts-10338/readme-10338.md @@ -0,0 +1,304 @@ +Automate FAQ Generation from Stack Overflow to Notion using GPT-4o-mini with Slack Alerts + +https://n8nworkflows.xyz/workflows/automate-faq-generation-from-stack-overflow-to-notion-using-gpt-4o-mini-with-slack-alerts-10338 + + +# Automate FAQ Generation from Stack Overflow to Notion using GPT-4o-mini with Slack Alerts + +### 1. Workflow Overview + +This workflow automates the generation of internal FAQ entries from new Stack Overflow questions tagged with specific technologies, using GPT-4o-mini for AI classification and content generation. It integrates several services to monitor, process, store, and notify teams about relevant FAQs. + +**Target use cases:** +- Automatically capturing relevant technical questions from Stack Overflow. +- Classifying questions by topic category (e.g., Frontend, Backend). +- Generating structured FAQ entries for internal knowledge bases. +- Logging FAQs for analytics and backup. +- Sending real-time notifications and error alerts to Slack. + +The workflow logic is divided into the following blocks: + +- **1.1 Input Reception & Filtering:** Monitors Stack Overflow RSS feeds for new questions and filters them before AI processing. +- **1.2 AI Processing:** Classifies question topics and generates detailed FAQ entries using OpenAI GPT-4o-mini. +- **1.3 Data Formatting & Integration:** Structures AI outputs and merges them with Notion data preparing for downstream nodes. +- **1.4 Knowledge Base Logging:** Saves the FAQ entries into Notion and logs them in Google Sheets. +- **1.5 Team Notification:** Sends Slack notifications to update the team about new FAQs. +- **1.6 Error Monitoring:** Catches errors during processing and sends alerts to Slack for rapid troubleshooting. + +--- + +### 2. Block-by-Block Analysis + +#### 1.1 Input Reception & Filtering + +- **Overview:** + Watches the Stack Overflow RSS feed for newly posted questions tagged with specific keywords (e.g., javascript). Filters out irrelevant or duplicate questions before AI processing. + +- **Nodes Involved:** + - RSS Feed - Stack Overflow Monitor + - Filter Questions + +- **Node Details:** + + 1. **RSS Feed - Stack Overflow Monitor** + - Type: RSS Feed Trigger + - Role: Polls Stack Overflow RSS feed every minute for new questions tagged (default: javascript). + - Config: Feed URL set to Stack Overflow’s RSS for a specific tag, poll interval every minute. + - Inputs: None (trigger node) + - Outputs: Emits new question items with metadata (title, link, summary). + - Edge Cases: No new questions; malformed RSS feed; network timeouts. + - Notes: Adjust feed URL to monitor other tags or multiple tags if needed. + + 2. **Filter Questions** + - Type: IF node + - Role: Filters out questions without a non-empty title string. + - Config: Condition checks if the question title field is not empty. + - Inputs: RSS feed output. + - Outputs: Passes only relevant questions to next node. + - Edge Cases: Empty or null titles; filtering criteria might exclude valid questions if poorly configured. + +#### 1.2 AI Processing + +- **Overview:** + Uses OpenAI GPT-4o-mini to classify the topic of each question and then generate a structured FAQ entry. + +- **Nodes Involved:** + - OpenAI - Topic Classifier + - OpenAI - FAQ Generator + +- **Node Details:** + + 1. **OpenAI - Topic Classifier** + - Type: OpenAI Node (LangChain integration) + - Role: Classifies question topic into categories like Frontend, Backend, DevOps, etc. + - Config: Uses GPT-4o-mini, max tokens 200, temperature 0 for deterministic classification. + - Prompt: Includes question title and summary, expects JSON output with `topic_category`. + - Inputs: Filtered question data from Filter Questions node. + - Outputs: JSON with classified topic. + - Edge Cases: API rate limits, malformed outputs, authentication errors. + + 2. **OpenAI - FAQ Generator** + - Type: OpenAI Node (LangChain integration) + - Role: Generates a detailed FAQ entry based on question content and topic classification. + - Config: GPT-4o-mini, max tokens 1000, temperature 0.7 for creative yet relevant output. + - Prompt: Converts Stack Overflow question data and topic category into a JSON structure with fields like `faq_title`, `summary`, `answer_insights`, `product_guidance`, and `tags`. + - Inputs: Output from Topic Classifier node. + - Outputs: Structured FAQ JSON. + - Edge Cases: API errors, incomplete or invalid JSON responses. + +#### 1.3 Data Formatting & Integration + +- **Overview:** + Formats the AI-generated JSON into structured fields, then merges it with Notion response data to enable comprehensive Slack notifications. + +- **Nodes Involved:** + - Format AI Response + - Notion - Create FAQ Entry + - Merge Data + +- **Node Details:** + + 1. **Format AI Response** + - Type: Set Node + - Role: Extracts and assigns FAQ JSON fields from AI response to named variables for downstream use. + - Config: Maps AI JSON keys (`faq_title`, `summary`, etc.) to workflow variables with friendly names. + - Inputs: FAQ Generator output. + - Outputs: Formatted data for Notion and Google Sheets. + - Edge Cases: Missing or malformed AI fields. + + 2. **Notion - Create FAQ Entry** + - Type: Notion Node + - Role: Creates a new page in the Notion database with FAQ details, including title and rich text blocks. + - Config: Title set from "FAQ Title" variable; content blocks include "Summary" and "Answer Insights". Requires Notion API credentials and correct database/page ID. + - Inputs: Formatted AI response from Set node. + - Outputs: Notion page creation response including URL. + - Edge Cases: API authentication errors, invalid page IDs, rate limits. + + 3. **Merge Data** + - Type: Merge Node + - Role: Combines AI-generated FAQ data and Notion creation response for consolidated output. + - Config: Merge mode “combine” by position. + - Inputs: Outputs from OpenAI - FAQ Generator and Notion - Create FAQ Entry nodes. + - Outputs: Merged data passed to Slack notification. + - Edge Cases: Data mismatch if inputs are out of sync. + +#### 1.4 Knowledge Base Logging + +- **Overview:** + Logs each FAQ entry into a Google Sheet for backup, reporting, or analytics purposes. + +- **Nodes Involved:** + - FAQ Logging to Google Sheets + +- **Node Details:** + + 1. **FAQ Logging to Google Sheets** + - Type: Google Sheets Node + - Role: Appends or updates a row with FAQ data in a specified Google Sheet and sheet tab. + - Config: Document ID and Sheet Name must be set; uses OAuth2 credentials for authentication. + - Inputs: Formatted AI response (from “Format AI Response” node). + - Outputs: Confirmation or updated sheet data. + - Edge Cases: Authentication failures, quota limits, invalid document or sheet names. + +#### 1.5 Team Notification + +- **Overview:** + Sends a formatted notification message to a Slack channel when a new FAQ entry is created. + +- **Nodes Involved:** + - Slack - Notify Team + +- **Node Details:** + + 1. **Slack - Notify Team** + - Type: Slack Node + - Role: Posts a message summarizing the new FAQ entry including title, summary, category, tags, and links to Notion and original Stack Overflow question. + - Config: Message text uses multiple expressions to include dynamic content from merged data nodes; channel ID must be specified; uses Slack OAuth2 credentials. + - Inputs: Merged data from “Merge Data” node. + - Outputs: Slack message post confirmation. + - Edge Cases: Invalid channel ID, permission errors, rate limits. + +#### 1.6 Error Monitoring + +- **Overview:** + Listens for errors from critical nodes and sends immediate alerts to a Slack channel for rapid debugging. + +- **Nodes Involved:** + - Error Trigger + - Slack - Error Alert + +- **Node Details:** + + 1. **Error Trigger** + - Type: Error Trigger Node + - Role: Captures any errors occurring in the workflow execution. + - Inputs: Monitors all nodes implicitly. + - Outputs: Emits error information on failure. + - Edge Cases: None (designed for error capture). + + 2. **Slack - Error Alert** + - Type: Slack Node + - Role: Sends an error alert message describing the node that failed, the error message, and timestamp. + - Config: Channel ID specified; uses Slack OAuth2 credentials. + - Inputs: Error data from Error Trigger node. + - Outputs: Slack message confirmation. + - Edge Cases: Slack API failures; missing error details. + +--- + +### 3. Summary Table + +| Node Name | Node Type | Functional Role | Input Node(s) | Output Node(s) | Sticky Note | +|-----------------------------|---------------------------------|------------------------------------------------|---------------------------------|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------| +| Sticky Note - Workflow Overview | Sticky Note | Provides workflow purpose and setup instructions | None | None | ## 🧩 Automate FAQ Generation from Stack Overflow ... (full overview content) | +| Sticky Note - RSS Setup | Sticky Note | Explains RSS feed monitoring and filtering | None | None | ## 📡 Stack Overflow Feed & Filter ... | +| Sticky Note - AI Setup | Sticky Note | Describes data preparation and AI integration | None | None | ## 🧱 Data Preparation & Integration ... | +| Sticky Note - Formatting | Sticky Note | Details AI classification and FAQ generation | None | None | ## 🧠 AI Understanding & FAQ Generation ... | +| Sticky Note - Notion Setup | Sticky Note | Guides Notion FAQ storage | None | None | ## 🗂️ Knowledge Base Logging ... | +| Sticky Note - Slack Setup | Sticky Note | Describes Slack team notifications | None | None | ## 💬 Team Notifications ... | +| Sticky Note2 | Sticky Note | Describes error monitoring and alerting | None | None | ## 🚨 Error Monitoring ... | +| Sticky Note | Sticky Note | Notes about credentials and security | None | None | ## 🔐 Credentials & Security ... | +| RSS Feed - Stack Overflow Monitor | RSS Feed Trigger | Triggers on new Stack Overflow questions | None | Filter Questions | | +| Filter Questions | IF | Filters questions with valid titles | RSS Feed - Stack Overflow Monitor | OpenAI - Topic Classifier | | +| OpenAI - Topic Classifier | OpenAI (LangChain) | Classifies question topic | Filter Questions | OpenAI - FAQ Generator | Classifies question topic (Frontend, Backend, DevOps, etc.) before FAQ generation. | +| OpenAI - FAQ Generator | OpenAI (LangChain) | Generates structured FAQ entries | OpenAI - Topic Classifier | Merge Data, Format AI Response | Uses GPT-4o-mini to analyze Stack Overflow content and generate structured FAQ entries with product-specific guidance | +| Format AI Response | Set | Extracts and formats AI response fields | OpenAI - FAQ Generator | Notion - Create FAQ Entry, FAQ Logging to Google Sheets | | +| Notion - Create FAQ Entry | Notion | Creates new FAQ page in Notion knowledge base | Format AI Response | Merge Data | Creates a new page in Notion Knowledge Base database with all FAQ fields populated | +| Merge Data | Merge | Combines AI and Notion data for Slack notification | OpenAI - FAQ Generator, Notion - Create FAQ Entry | Slack - Notify Team | Combines OpenAI output with Notion response for Slack notification | +| FAQ Logging to Google Sheets | Google Sheets | Logs FAQ entries into Google Sheets | Format AI Response | None | | +| Slack - Notify Team | Slack | Sends notification to Slack channel about new FAQ | Merge Data | None | Sends formatted notification to #product-faqs channel with FAQ summary, category, and links | +| Error Trigger | Error Trigger | Captures workflow errors | None | Slack - Error Alert | | +| Slack - Error Alert | Slack | Sends Slack alert on workflow errors | Error Trigger | None | Sends an error alert message if Topic Classifier, FAQ Generator, or Notion fails | + +--- + +### 4. Reproducing the Workflow from Scratch + +1. **Create "RSS Feed - Stack Overflow Monitor" node** + - Type: RSS Feed Trigger + - Configure feed URL to: `https://stackoverflow.com/feeds/tag?tagnames=javascript&sort=active` (modify tags as needed) + - Set polling interval to every minute (or desired frequency). + +2. **Create "Filter Questions" node** + - Type: IF + - Connect input from RSS Feed node. + - Condition: Check that `{{$json.title}}` is not empty. + - Output "true" branch connects to next AI node. + +3. **Create "OpenAI - Topic Classifier" node** + - Type: OpenAI (LangChain) + - Connect input from Filter Questions node. + - Credentials: Set OpenAI API key with GPT-4o-mini access. + - Model: GPT-4o-mini, max tokens 200, temperature 0. + - Prompt: Classify the question topic into predefined categories (Frontend, Backend, etc.) and return JSON with `topic_category`. + - Output: JSON with classification. + +4. **Create "OpenAI - FAQ Generator" node** + - Type: OpenAI (LangChain) + - Connect input from Topic Classifier node. + - Credentials: Same OpenAI API credentials. + - Model: GPT-4o-mini, max tokens 1000, temperature 0.7. + - Prompt: Generate comprehensive FAQ JSON entry including title, summary, insights, product guidance, and tags based on question content and topic. + +5. **Create "Format AI Response" node** + - Type: Set Node + - Connect input from FAQ Generator node. + - Map AI JSON response fields (`faq_title`, `summary`, `answer_insights`, `product_guidance`, `tags`) to workflow variables named respectively ("FAQ Title", "Summary", etc.). + +6. **Create "Notion - Create FAQ Entry" node** + - Type: Notion + - Connect input from Format AI Response node. + - Credentials: Link Notion API credentials with access to your FAQ database. + - Configure page creation: + - Title: Use "FAQ Title" variable. + - Content blocks: Insert "Summary" and "Answer Insights" as text blocks. + - Set the database or page ID for the FAQ knowledge base. + +7. **Create "Merge Data" node** + - Type: Merge + - Connect two inputs: + - Input 1: OpenAI - FAQ Generator output + - Input 2: Notion - Create FAQ Entry output + - Mode: Combine by position. + +8. **Create "FAQ Logging to Google Sheets" node** + - Type: Google Sheets + - Connect input from Format AI Response node. + - Credentials: OAuth2 credentials for Google Sheets + - Operation: Append or update row in specified document and sheet. + - Map FAQ fields to corresponding columns in the sheet. + +9. **Create "Slack - Notify Team" node** + - Type: Slack + - Connect input from Merge Data node. + - Credentials: OAuth2 Slack credentials with permission to post messages. + - Configure message text with variables for FAQ title, summary, category (from Topic Classifier), tags, Notion URL, and original Stack Overflow link. + - Set target Slack channel by ID. + +10. **Create "Error Trigger" node** + - Type: Error Trigger + - No inputs, monitors entire workflow for errors. + +11. **Create "Slack - Error Alert" node** + - Type: Slack + - Connect input from Error Trigger node. + - Credentials: Slack OAuth2 credentials. + - Configure message text to include the node name, error message, and timestamp. + - Set target Slack channel for error alerts. + +--- + +### 5. General Notes & Resources + +| Note Content | Context or Link | +|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| +| Use OAuth2 authentication for Slack and Google Sheets; use API keys for OpenAI and Notion. | Credentials & Security sticky note advises environment variable usage for IDs and tokens to avoid exposure risks. | +| Run the workflow once manually after setup to verify all connections and node configurations are working. | Workflow Overview sticky note recommends this as a setup step. | +| Keep OpenAI prompts concise and focused to improve classification and FAQ generation accuracy and efficiency. | Formatting sticky note highlights prompt optimization best practices. | +| Adjust Stack Overflow RSS tag query to monitor different or multiple technology tags as needed. | RSS Setup sticky note explains tag query and filter rules customization. | +| Slack messages include links to Notion FAQ entries and original Stack Overflow questions for easy access. | Slack Setup sticky note explains notification message formatting. | +| Error alerts enable quick debugging by providing detailed error info directly in Slack. | Error Monitoring sticky note emphasizes the importance of this feature for workflow reliability. | + +--- + +**Disclaimer:** The provided text originates exclusively from an automated workflow created with n8n, an integration and automation tool. This processing strictly adheres to current content policies and contains no illegal, offensive, or protected elements. All data handled is legal and public. \ No newline at end of file