N
n8n Store
Workflow Market
Support Inbox-to-FAQ Backfill (Gmail/Outlook)

Support Inbox-to-FAQ Backfill (Gmail/Outlook)

by rahul080 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.ifn8n-nodes-base.ifn8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.gmailn8n-nodes-base.slackn8n-nodes-base.slackn8n-nodes-base.notionn8n-nodes-base.stickyNoten8n-nodes-base.stickyNote
PriceKostenlos
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "uQWmgAxfU9ZS3EEu",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "Support Inbox-to-FAQ Backfill (Gmail/Outlook)",
  "tags": [],
  "nodes": [
    {
      "id": "bc069f30-5bcf-4e2c-a657-492eacdae39a",
      "name": "Configure GPT-4o Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -144,
        208
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2c8072df-420c-441c-8beb-137df1737650",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 464,
        "content": "## Error Handling & Logging\nRecords any parsing or API errors into a Google Sheet for debugging.  \nEnsures every failed event is logged and traceable.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "337ea8c7-d28c-43a4-a288-d7c48ea8788b",
      "name": "Gmail Polling Trigger – Developer Support Inbox",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -912,
        -16
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "04a188b4-507a-4eb7-8466-5b7703316a61",
      "name": "Validate Email Payload",
      "type": "n8n-nodes-base.if",
      "position": [
        -624,
        -16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e2adb005-2b3c-4d1e-8445-442df1fe925a",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a39d3cf-2b08-4f3d-b9c2-8da386f42283",
      "name": "Analyze & Classify Developer Email (AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -208,
        -32
      ],
      "parameters": {
        "text": "={\n  \"subject\": {{ $json.Subject }} ,\n  \"body\": \"{{$json[\"snippet\"]}}\"\n}\n",
        "options": {
          "systemMessage": "=You are an AI assistant trained to analyze developer support emails and identify recurring questions or issues.\n\nYour task:\n1. Read the email subject and snippet.\n2. Summarize the main problem.\n3. Identify the most likely FAQ category (e.g., API, Authentication, Billing, Setup, Errors, UI).\n4. Suggest a short FAQ title.\n5. Write a 2–3 line clear and helpful answer.\n6. Detect if it matches an existing FAQ type (is_recurring = true/false).\n\nReturn result in **valid JSON** only.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f3a597c5-7f03-437e-b6b9-c9b9d79cff2d",
      "name": "Parse & Clean AI JSON Output",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        -32
      ],
      "parameters": {
        "jsCode": "// Remove Markdown code block and parse JSON\nlet raw = $json.output || \"\";\nraw = raw.replace(/```json|```/g, '').trim();\n\nlet parsed = {};\ntry {\n  parsed = JSON.parse(raw);\n} catch (e) {\n  parsed = { error: \"Failed to parse AI output\", raw_output: raw };\n}\n\nreturn parsed;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a10bfd08-a073-4160-ae69-ebe3ae93c6e2",
      "name": "Save FAQ Entry to Notion Database",
      "type": "n8n-nodes-base.notion",
      "position": [
        1312,
        48
      ],
      "parameters": {
        "title": "={{ $json.problem_summary }}",
        "simple": false,
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "29a802b9-1fa0-804a-b406-e078961e0659",
          "cachedResultUrl": "https://www.notion.so/29a802b91fa0804ab406e078961e0659",
          "cachedResultName": "Release Notes"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Priority|rich_text",
              "textContent": "={{ $json.faq_category }}"
            },
            {
              "key": "FAQ Content|rich_text",
              "textContent": "={{ $json.faq_answer }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "iDjtgSTYG9ECVBtT",
          "name": "Notion account 2"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "06741c0d-d998-41e9-9453-eed31e77a189",
      "name": "Announce New FAQ in Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1568,
        48
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "=🧠 *FAQ Update Logged!*\n• *Title:* {{$json[\"properties\"][\"Name\"][\"title\"][0][\"plain_text\"]}}\n• *Category:* {{$json[\"properties\"][\"Priority\"][\"rich_text\"][0][\"plain_text\"]}}\n• *Summary:* {{$json[\"properties\"][\"FAQ Content\"][\"rich_text\"][0][\"plain_text\"].slice(0, 150)}}...\n\n🔗 *View in Notion:* <{{$json[\"url\"]}}|Open FAQ>\n📅 *Logged On:* {{new Date().toLocaleString()}}\n",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1201a420-9656-47b1-9ef6-65fa62d8e245",
      "name": "Log Workflow Errors to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -464,
        672
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "error_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "error",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "error_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1338537721,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit#gid=1338537721",
          "cachedResultName": "error log sheet"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Uldk_4BxWbdZTDZxFUeohIfeBmGHHqVEl9Ogb0l6R8Y/edit?usp=drivesdk",
          "cachedResultName": "Interviewer Brief Pack "
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "kpPEOLCGn963qpoh",
          "name": "[email protected]"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "625832c2-b6f8-4f12-b246-eb9d8be74531",
      "name": "Configure GPT-4o Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        512,
        -304
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "C3WzT18XqF8OdVM6",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a8b1fec3-a3a5-4da6-82cb-85297ef8a092",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        -816
      ],
      "parameters": {
        "color": 7,
        "height": 496,
        "content": "## Acknowledgment & Feedback Loop\nAutomatically replies to the sender with a polite acknowledgment and  \nAI-generated answer, confirming that their issue was added to the FAQ base.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "65fa6207-1bd4-414b-ab20-46517842d2f4",
      "name": "Analyze Email Sentiment & Urgency (AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        528,
        -512
      ],
      "parameters": {
        "text": "=Analyze this email and determine:\n1. Urgency level (Low/Medium/High/Critical)\n2. Customer sentiment (Positive/Neutral/Frustrated/Angry)\n3. Requires immediate response? (Yes/No)\n\nEmail: {{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.snippet }}\n\nReturn only JSON:\n{\n  \"urgency\": \"High\",\n  \"sentiment\": \"Frustrated\",\n  \"immediate_response_needed\": \"Yes\",\n  \"reason\": \"brief explanation\"\n}",
        "options": {
          "systemMessage": "=You are an expert at analyzing customer support emails. Rate urgency and sentiment accurately and concisely"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "17018fa2-153a-4ca8-8e3b-fc04195a26ce",
      "name": "Parse AI JSON Output – Sentiment Analysis",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        -512
      ],
      "parameters": {
        "jsCode": "// Remove Markdown code block and parse JSON\nlet raw = $json.output || \"\";\nraw = raw.replace(/```json|```/g, '').trim();\n\nlet parsed = {};\ntry {\n  parsed = JSON.parse(raw);\n} catch (e) {\n  parsed = { error: \"Failed to parse AI output\", raw_output: raw };\n}\n\nreturn parsed;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "5d7e3019-0c17-4840-9302-f6c4bbe47432",
      "name": "Filter Critical or High-Urgency Emails",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        -512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "db2ac827-dd91-42cd-a79d-b1a78c104dad",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.urgency }}",
              "rightValue": "High"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7a0f4533-2afc-42f2-926a-298aa2183d3f",
      "name": "Alert Team in Slack – Critical Issue",
      "type": "n8n-nodes-base.slack",
      "position": [
        1424,
        -528
      ],
      "webhookId": "ddaa7632-9e35-4bd3-82d6-572d5cae84cc",
      "parameters": {
        "text": "=🚨 *CRITICAL ISSUE DETECTED*\n   \n   📧 Email: {{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.snippet }}\n   😤 Sentiment: {{ $json.sentiment }}\n   ⚡ Urgency: {{ $json.urgency }}\n   📝 Reason: {{ $json.reason }}\n   \n   👉 *Action Required Immediately*",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09HMPVD466",
          "cachedResultName": "newscctv22"
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "rNqvWj9TfChPVRYY",
          "name": "Slack account vivek"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0edeebbe-2001-4a84-823a-e712757190b8",
      "name": " Send Acknowledgment Email to Sender",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1696,
        -528
      ],
      "webhookId": "0c82c299-6938-42ed-bda6-5007d79af34f",
      "parameters": {
        "sendTo": "={{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.From.match(/<(.+?)>/)?.[1] || $('Gmail Polling Trigger – Developer Support Inbox').item.json.From }}",
        "message": "=Hi there,\n\nThank you for reaching out! We've received your question and added it to our knowledge base.\n\nHere's a quick answer to help you:\n\n📌 Issue: {{ $('Parse & Clean AI JSON Output').item.json.problem_summary }}\n💡 Solution: {{ $('Parse & Clean AI JSON Output').item.json.faq_answer }}\n\nOur team will follow up if additional assistance is needed.\n\nBest regards,\nDeveloper Support Team",
        "options": {},
        "subject": "={{ $('Gmail Polling Trigger – Developer Support Inbox').item.json.snippet }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "aab47485-abe6-4f47-9b71-8a75939ace39",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -960
      ],
      "parameters": {
        "width": 512,
        "height": 624,
        "content": "## How it works\nThis automation streamlines developer support management by turning incoming Gmail emails into structured FAQ entries.  \nIt continuously monitors your support inbox, validates each message, and uses Azure OpenAI GPT-4o to analyze the content.  \nThe AI classifies the issue, summarizes it, and creates a concise FAQ title and answer.  \nThe result is parsed into clean JSON, stored in a Notion database, and shared with your internal team via Slack.  \nCritical or urgent emails are separately analyzed for sentiment and priority — instantly alerting your team if immediate action is required.  \nEach failure or parsing issue is automatically logged in Google Sheets for easy troubleshooting.  \nThe workflow also sends an acknowledgment email back to the original sender, closing the communication loop.\n\n## Setup steps\n1. Connect your credentials:\n   - Gmail (inbox and sender)\n   - Azure OpenAI API\n   - Notion database (“Release Notes”)\n   - Slack workspace\n   - Google Sheets (for error logs)\n2. Replace Notion Database ID and Google Sheet IDs with your own.\n3. Update Slack user/channel in the Slack nodes.\n4. Adjust Gmail trigger polling frequency if needed.\n5. Run once manually to confirm all credentials and data mappings.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b360458f-2d91-4c7c-bcb4-d7a80b5f7ca6",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 384,
        "content": "## Email Intake & Validation\nPolls the Gmail inbox for new support messages.  \nEnsures valid payload (ID, subject, body) before AI processing.  \nInvalid or empty messages are routed to the Google Sheets error log.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "cc440d05-5ed8-4819-b6a6-f06fc6b55c4d",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 576,
        "content": "## AI Analysis & FAQ Generation\nUses GPT-4o to read each email and generate structured FAQ data —  \nincluding summary, category, short solution, and recurrence flag.  \nThe output is cleaned and converted to valid JSON for downstream use.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b738631b-0ab0-4c57-80b4-2d011b01a5ce",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 432,
        "content": "## Knowledge Storage & Team Notification\nSaves the AI-generated FAQ entry to Notion and notifies your team on Slack.  \nEach new FAQ includes title, category, and answer snippet with a Notion link.  \nHelps your team stay aligned on new recurring issues.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d95516c3-0ce4-4515-91f0-7ca19ecc3957",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -768
      ],
      "parameters": {
        "color": 7,
        "width": 1104,
        "height": 608,
        "content": "## Urgency & Sentiment Detection\nAnalyzes the emotional tone and urgency of incoming emails.  \nFlags critical or frustrated messages for instant Slack escalation.  \nEnsures urgent support requests are handled in real time.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7df077a3-0fb2-48e1-9c72-5b88f926f197",
  "connections": {
    "Configure GPT-4o Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze & Classify Developer Email (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Validate Email Payload": {
      "main": [
        [
          {
            "node": "Analyze & Classify Developer Email (AI)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Workflow Errors to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure GPT-4o Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Email Sentiment & Urgency (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Clean AI JSON Output": {
      "main": [
        [
          {
            "node": "Save FAQ Entry to Notion Database",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analyze Email Sentiment & Urgency (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save FAQ Entry to Notion Database": {
      "main": [
        [
          {
            "node": "Announce New FAQ in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Team in Slack – Critical Issue": {
      "main": [
        [
          {
            "node": " Send Acknowledgment Email to Sender",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Email Sentiment & Urgency (AI)": {
      "main": [
        [
          {
            "node": "Parse AI JSON Output – Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Critical or High-Urgency Emails": {
      "main": [
        [
          {
            "node": "Alert Team in Slack – Critical Issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze & Classify Developer Email (AI)": {
      "main": [
        [
          {
            "node": "Parse & Clean AI JSON Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI JSON Output – Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Filter Critical or High-Urgency Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Polling Trigger – Developer Support Inbox": {
      "main": [
        [
          {
            "node": "Validate Email Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流