AutomationFlowsAI & RAG › Track Competitor Risk From Gmail and Webhooks with Groq, Slack and Sheets

Track Competitor Risk From Gmail and Webhooks with Groq, Slack and Sheets

ByWeblineIndia @weblineindia on n8n.io

This workflow monitors Gmail and a webhook for sales notes, uses Groq (Llama 3.3) to extract competitor intelligence, then routes confirmed competitor signals to Salesforce, Slack, and Google Sheets for real-time alerting and logging. Triggers when a new Gmail message arrives or…

Event trigger★★★★☆ complexityAI-powered28 nodesGmail TriggerGroq ChatAgentSlackOutput Parser StructuredGoogle SheetsSalesforce
AI & RAG Trigger: Event Nodes: 28 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #17686 — we link there as the canonical source.

This workflow follows the Agent → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "pG7TdXDDXOMf3Yoj",
  "name": "Real-Time Competitor Intelligence Tracker",
  "tags": [],
  "nodes": [
    {
      "id": "458f6558-9601-4c30-9793-4005f743899f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3248,
        448
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 464,
        "content": "## Real-time Alerting & Reporting\nnotifies stakeholders and stores insights:\n- supports crm updates (e.g., salesforce)\n- sends alerts via slack\n- logs events in google sheets\n\n\nenables real-time visibility into competitor activity"
      },
      "typeVersion": 1
    },
    {
      "id": "06798ac6-0beb-46ff-93b5-bcf6edc0c45c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2688,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 432,
        "content": "## Competitor intelligence pipeline\nprocesses confirmed competitor signals:\n- splits records per competitor\n- prioritizes based on risk and deal stage\n- formats data for crm updates\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a405737d-90e1-4daa-a4c7-6e8f4cbcad46",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        464
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 752,
        "content": "## Data Enrichment & Scoring\nenhances ai output with additional context:\n- adds source information (email/webhook)\n- attaches contact and account details\n- refines risk scoring"
      },
      "typeVersion": 1
    },
    {
      "id": "a377dce1-aa0e-4b66-8c48-c58f935e3260",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        464
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 752,
        "content": "## AI-driven Insight Engine\nuses ai model to analyze incoming data and extract insights:\n- detects competitor mentions\n- determines deal stage\n- analyzes sentiment\n- assigns risk level and score"
      },
      "typeVersion": 1
    },
    {
      "id": "339d6398-597a-413d-b77e-c302b51f6a03",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        464
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 736,
        "content": "## Data Input & Cleaning\ncollects incoming data from multiple sources:\n- gmail (new email events)\n- webhook (crm, notes, external tools)\n\nnormalizes raw input into a consistent structure"
      },
      "typeVersion": 1
    },
    {
      "id": "305aeb3c-5edb-490b-bf80-516958d71ad9",
      "name": "Priority Router & Stage Mapper",
      "type": "n8n-nodes-base.code",
      "position": [
        3008,
        736
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// === PRIORITY ROUTING & SALESFORCE STAGE MAPPING ===\nconst item = $input.item.json;\n\n// Determine Salesforce stage\nlet sfStage = 'Qualification';\nif (item.risk_level === 'high' && item.sentiment === 'negative') {\n  sfStage = 'Closed Lost';\n} else if (item.urgency === 'critical') {\n  sfStage = 'Closed Lost';\n} else if (item.risk_level === 'high') {\n  sfStage = 'Needs Analysis';\n} else if (item.sentiment === 'negative') {\n  sfStage = 'At Risk';\n} else if (item.deal_stage === 'negotiation') {\n  sfStage = 'Value Proposition';\n} else if (item.deal_stage === 'demo') {\n  sfStage = 'Needs Analysis';\n}\n\n// Determine alert priority\nlet alertPriority = 'standard';\nif (item.urgency === 'critical' || item.risk_score >= 8) {\n  alertPriority = 'critical';\n} else if (item.urgency === 'high' || item.risk_score >= 5) {\n  alertPriority = 'high';\n}\n\n\nreturn {\n  json: {\n    ...item,\n    sf_stage: sfStage,\n    alert_priority: alertPriority,\n    processed_at: new Date().toISOString()\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "abfee4e6-f7b7-4920-adb4-0e6656dedb55",
      "name": "Gmail - New Email Received",
      "type": "n8n-nodes-base.gmailTrigger",
      "onError": "continueErrorOutput",
      "position": [
        768,
        960
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "retryOnFail": false,
      "typeVersion": 1.3
    },
    {
      "id": "4893e0ef-1879-4b7a-9f94-6d6bd3f6765b",
      "name": "Validate - AI Output",
      "type": "n8n-nodes-base.if",
      "position": [
        1872,
        848
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "afc898e9-f42a-471b-bb37-9ee5dc044965",
              "operator": {
                "type": "object",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": ""
            },
            {
              "id": "7906fdf5-bced-46da-a21d-cac9d471c1d8",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ typeof $json.output.risk_level !== 'undefined' }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.3
    },
    {
      "id": "07fd71d8-9746-4fdd-aee8-3d8849e44872",
      "name": "Log - Invalid AI Output",
      "type": "n8n-nodes-base.set",
      "position": [
        3024,
        1216
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "inv1",
              "name": "status",
              "type": "string",
              "value": "invalid_ai_output"
            },
            {
              "id": "inv2",
              "name": "reason",
              "type": "string",
              "value": "AI returned malformed or empty output"
            },
            {
              "id": "inv3",
              "name": "logged_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "09c1939c-631a-42bf-9281-0d0e86faf367",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        1520,
        1072
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "1010580c-cea1-47ec-84c2-1c7b86682de8",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1520,
        848
      ],
      "parameters": {
        "text": "=You are a B2B sales intelligence analyst. Analyze this business communication and extract competitor intelligence.\n\nCRITICAL RULES:\n- Only list REAL named competitor companies explicitly mentioned. NEVER hallucinate competitor names.\n- If NO competitor is explicitly mentioned, return empty array for competitors.\n- Base ALL output strictly on the provided text \u2014 do not infer or assume.\n- deal_stage must be one of: lead | demo | negotiation | closed_won | closed_lost | unknown\n- sentiment must be one of: positive | negative | neutral\n- risk_level must be one of: low | medium | high\n- urgency must be one of: low | medium | high | critical\n- Set urgency=critical if risk_level=high AND sentiment=negative AND deal_stage=negotiation or closed_lost\n\nTEXT TO ANALYZE:\n{{ $json.raw_content }}\n\nACCOUNT: {{ $json.account_name }}\nSOURCE: {{ $json.source }}\n\nReturn ONLY a valid JSON object with NO markdown, NO explanation:\n{\n  \"competitors\": [],\n  \"context\": \"\",\n  \"deal_stage\": \"\",\n  \"sentiment\": \"\",\n  \"risk_level\": \"\",\n  \"urgency\": \"\",\n  \"insight\": \"\",\n  \"recommended_action\": \"\"\n}",
        "options": {
          "batching": {
            "batchSize": 1,
            "delayBetweenBatches": 1000
          }
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "fa28dbc6-35b2-4bd9-9c83-47581227b702",
      "name": "Log - No Competitor Detected",
      "type": "n8n-nodes-base.set",
      "position": [
        3024,
        1024
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "n1",
              "name": "status",
              "type": "string",
              "value": "skipped"
            },
            {
              "id": "n2",
              "name": "reason",
              "type": "string",
              "value": "No competitor names detected in content"
            },
            {
              "id": "n3",
              "name": "processed_at",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "27b2f8f5-4d9b-466c-b984-c8a94a73f136",
      "name": "Notify - Slack Competitor Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        3552,
        720
      ],
      "parameters": {
        "text": "=:rotating_light: *Competitor Detected!*\n\n*Competitor:* {{ $json.Competitor }}\n*Deal Stage:* {{ $json[\"Deal Stage\"] }}\n*Sentiment:* {{ $json.Sentiment }}\n*Risk Level:* {{ $json[\"Risk Level\"] }} (Score: {{ $('Split - One Row Per Competitor').item.json.risk_score }}/7)\n*Source:* {{ $('Split - One Row Per Competitor').item.json.source }}\n*Account:* {{ $('Split - One Row Per Competitor').item.json.account_name }}\n*Insight:* {{ $('Split - One Row Per Competitor').item.json.insight }}\n*Context:* {{ $('Split - One Row Per Competitor').item.json.context }}\n*Detected:* ",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0AP6AD7069",
          "cachedResultName": "all-group-d"
        },
        "otherOptions": {
          "mrkdwn": true,
          "includeLinkToWorkflow": false
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "5a8fc6d8-f9ea-49cc-8c9a-f120a9d5d532",
      "name": "Split - One Row Per Competitor",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2784,
        736
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {
          "destinationFieldName": "competitor"
        },
        "fieldToSplitOut": "competitors"
      },
      "typeVersion": 1
    },
    {
      "id": "b80b5876-6754-4abd-af2c-b9bce352c379",
      "name": "Gate - Competitors Detected?",
      "type": "n8n-nodes-base.if",
      "position": [
        2432,
        752
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7d139a57-8fcd-480b-b8b0-28e6d8dff00a",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.competitors.length }}",
              "rightValue": 0
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.3
    },
    {
      "id": "ac2f066f-33a4-494c-8cb6-c78ba42896fc",
      "name": "Enrich - Add Source Context and Risk Score",
      "type": "n8n-nodes-base.set",
      "position": [
        2208,
        752
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e1",
              "name": "competitors",
              "type": "array",
              "value": "={{ $json.output.competitors }}"
            },
            {
              "id": "e2",
              "name": "context",
              "type": "string",
              "value": "={{ $json.output.context }}"
            },
            {
              "id": "e3",
              "name": "deal_stage",
              "type": "string",
              "value": "={{ $json.output.deal_stage }}"
            },
            {
              "id": "e4",
              "name": "sentiment",
              "type": "string",
              "value": "={{ $json.output.sentiment }}"
            },
            {
              "id": "e5",
              "name": "risk_level",
              "type": "string",
              "value": "={{ $json.output.risk_level }}"
            },
            {
              "id": "e6",
              "name": "insight",
              "type": "string",
              "value": "={{ $json.output.insight }}"
            },
            {
              "id": "e7",
              "name": "source",
              "type": "string",
              "value": "={{ $(\"Merge - All Normalized Events\").item.json.source }}"
            },
            {
              "id": "e8",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $(\"Merge - All Normalized Events\").item.json.timestamp }}"
            },
            {
              "id": "e9",
              "name": "account_name",
              "type": "string",
              "value": "={{ $(\"Merge - All Normalized Events\").item.json.account_name }}"
            },
            {
              "id": "e10",
              "name": "risk_score",
              "type": "number",
              "value": "={{ ($json.risk_level === \"high\" ? 3 : ($json.risk_level === \"medium\" ? 2 : 1)) + ($json.deal_stage === \"negotiation\" || $json.deal_stage === \"closed\" ? 2 : ($json.deal_stage === \"demo\" ? 1 : 0)) + ($json.sentiment === \"negative\" ? 2 : ($json.sentiment === \"neutral\" ? 1 : 0)) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "39de760b-cae6-448f-9b5d-ac8be8358d0b",
      "name": "Competitor Intelligence Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1696,
        1072
      ],
      "parameters": {
        "jsonSchemaExample": "{ \"competitors\": [\"Salesforce\", \"HubSpot\"], \"context\": \"Prospect received competing proposals with discount offers\", \"deal_stage\": \"negotiation\", \"sentiment\": \"negative\", \"risk_level\": \"high\", \"insight\": \"Competitor offering aggressive pricing discount at negotiation stage\" }"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1bcc81c9-3d59-489b-8d7a-692e83bd3413",
      "name": "Deduplicate - Webhook Events",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        992,
        752
      ],
      "parameters": {
        "compare": "selectedFields",
        "options": {},
        "fieldsToCompare": "unique_id"
      },
      "typeVersion": 1.1
    },
    {
      "id": "5b80f795-1e7e-4b85-99e9-4814cac0397e",
      "name": "Normalize - Webhook Data",
      "type": "n8n-nodes-base.set",
      "position": [
        768,
        752
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b1",
              "name": "source",
              "type": "string",
              "value": "={{ $json.body.source || \"webhook\" }}"
            },
            {
              "id": "b2",
              "name": "unique_id",
              "type": "string",
              "value": "={{ $json.body.opportunity_id || $execution.id }}"
            },
            {
              "id": "b3",
              "name": "raw_content",
              "type": "string",
              "value": "={{ \"Account: \" + ($json.body.account_name || \"\") + \"\\nDeal Stage: \" + ($json.body.deal_stage || \"\") + \"\\nNote: \" + ($json.body.content || \"\") }}"
            },
            {
              "id": "b4",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "b5",
              "name": "account_name",
              "type": "string",
              "value": "={{ $json.body.account_name || \"\" }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d56e5c9b-a9b7-42ce-b238-e2f406dd7676",
      "name": "Merge - All Normalized Events",
      "type": "n8n-nodes-base.merge",
      "position": [
        1296,
        848
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "c1c8f9b1-76d0-4182-b0d4-9ac42ee5bc7d",
      "name": "Normalize - Email Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1008,
        944
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "source",
              "type": "string",
              "value": "email"
            },
            {
              "id": "a2",
              "name": "unique_id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "a3",
              "name": "raw_content",
              "type": "string",
              "value": "={{ \"Subject: \" + ($json.subject || \"\") + \"\\nFrom: \" + ($json.from || \"\") + \"\\nBody: \" + ($json.text || $json.snippet || \"\") }}"
            },
            {
              "id": "a4",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $json.date || $now.toISO() }}"
            },
            {
              "id": "a5",
              "name": "account_name",
              "type": "string",
              "value": "={{ $json.From }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4028e09e-019c-4ea6-aae9-7b47ee75fb1f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        464
      ],
      "parameters": {
        "width": 608,
        "height": 736,
        "content": "## Overview\nThis workflow is a real-time competitor intelligence tracker for B2B sales teams. It captures data from emails and webhooks, uses AI to extract competitor insights like deal stage, sentiment, and risk level, and enriches the data with scoring and context. Based on this, it triggers actions such as Slack alerts, Google Sheets logging, and CRM updates. This helps teams respond faster to competitive threats and make informed decisions.\n\n## How to Setup\n- Configure Gmail credentials for incoming emails\n- Add Groq API credentials\n- Set up webhook endpoint for CRM/internal notes\n- Connect Google Sheets (for logging)\n- Add Salesforce credentials & create custom oppertunity"
      },
      "typeVersion": 1
    },
    {
      "id": "1734d999-2ccc-4267-8bf4-99858c6a0c82",
      "name": "Store - Google Sheets Intelligence Log",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueErrorOutput",
      "position": [
        3760,
        720
      ],
      "parameters": {
        "columns": {
          "value": {
            "Source": "={{ $json.source }}",
            "Account": "={{ $json.account_name }}",
            "Context": "={{ $json.context }}",
            "Insight": "={{ $json.insight }}",
            "Sentiment": "={{ $json.sentiment }}",
            "Competitor": "=",
            "Deal Stage": "={{ $json.deal_stage }}",
            "Risk Level": "={{ $json.risk_level }}"
          },
          "schema": [
            {
              "id": "Sr.",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sr.",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Competitor",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Competitor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Deal Stage",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Deal Stage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Risk Level",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Risk Level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Account",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Account",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Insight",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Insight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Context",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Context",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Detected",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Detected",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo/edit#gid=0",
          "cachedResultName": "Competitor"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo/edit?usp=drivesdk",
          "cachedResultName": "Competitor Insight"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a5ffc019-a3ea-474f-a95f-c94f7725e278",
      "name": "Log No Competitor Outputs",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueErrorOutput",
      "position": [
        3248,
        1024
      ],
      "parameters": {
        "columns": {
          "value": {
            "Source": "={{ $json.source }}",
            "Account": "={{ $json.account_name }}",
            "Context": "={{ $json.context }}",
            "Insight": "={{ $json.insight }}",
            "Sentiment": "={{ $json.sentiment }}",
            "Competitor": "={{ $json.competitor }}",
            "Deal Stage": "={{ $json.deal_stage }}",
            "Risk Level": "={{ $json.risk_level }}"
          },
          "schema": [
            {
              "id": "Sr.",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sr.",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Competitor",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Competitor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Deal Stage",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Deal Stage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Risk Level",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Risk Level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Account",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Account",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Insight",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Insight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Context",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Context",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Detected",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Detected",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo/edit#gid=0",
          "cachedResultName": "Competitor"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo/edit?usp=drivesdk",
          "cachedResultName": "Competitor Insight"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": false
    },
    {
      "id": "0a0b1b99-d86c-4ff7-b0f0-0eaad883688b",
      "name": "Log Invalid AI Outputs",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueErrorOutput",
      "position": [
        3248,
        1216
      ],
      "parameters": {
        "columns": {
          "value": {
            "Source": "={{ $json.source }}",
            "Account": "={{ $json.account_name }}",
            "Context": "={{ $json.context }}",
            "Insight": "={{ $json.insight }}",
            "Sentiment": "={{ $json.sentiment }}",
            "Competitor": "={{ $json.competitor }}",
            "Deal Stage": "={{ $json.deal_stage }}",
            "Risk Level": "={{ $json.risk_level }}"
          },
          "schema": [
            {
              "id": "Sr.",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sr.",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Competitor",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Competitor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Deal Stage",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Deal Stage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sentiment",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Risk Level",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Risk Level",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Account",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Account",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Insight",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Insight",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Context",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Context",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Detected",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Detected",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo/edit#gid=0",
          "cachedResultName": "Competitor"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1qDLpfQZE4k1V__CXkDHAlOnqHwbU8GTMoIHH5bA-jGo/edit?usp=drivesdk",
          "cachedResultName": "Competitor Insight"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "3643931e-83fc-448b-a43f-76740ba0d205",
      "name": "Slack -  Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        4064,
        1408
      ],
      "parameters": {
        "text": "=*Workflow Error \u2014 Competitor Intel Tracker*\n\n*Node:* {{ $json.node?.name || 'Excel' }}\n*Error:* {{ $json.error?.message || $json.message || $json.error || 'Unknown error' }}\n*Execution ID:* {{ $execution.id }}\n*Time:* {{ $now.toISO() }}\n\nPlease check n8n execution logs for details.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0AQDPFPX3P",
          "cachedResultName": "urgent"
        },
        "otherOptions": {
          "mrkdwn": true,
          "includeLinkToWorkflow": false
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "d4d2fd5a-c19c-4f7d-ac00-302d45e281e5",
      "name": "Webhook - Notes and CRM Events",
      "type": "n8n-nodes-base.webhook",
      "position": [
        560,
        752
      ],
      "parameters": {
        "path": "competitor-intel",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "666090d0-f38f-4e5a-a9ab-3959cfa66530",
      "name": "Salesforce - Create Opportunity",
      "type": "n8n-nodes-base.salesforce",
      "onError": "continueErrorOutput",
      "position": [
        3328,
        736
      ],
      "parameters": {
        "name": "={{ $json.competitor + \" \u2014 \" + $json.context }}",
        "resource": "opportunity",
        "closeDate": "={{ $now.plus({days: 30}).toISO() }}",
        "stageName": "={{ $json.sf_stage }}",
        "additionalFields": {
          "description": "={{ \"[Auto-created by Competitor Intel Tracker]\\n\\nCompetitor: \" + $json.competitor + \"\\nInsight: \" + $json.insight + \"\\nRecommended Action: \" + $json.recommended_action + \"\\nRisk Score: \" + $json.risk_score + \"\\nSource: \" + $json.source + \"\\nExecution ID: \" + $json.execution_id }}"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "265d7bfb-b0ee-48d4-a881-625cd691f561",
  "nodeGroups": [],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Validate - AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Validate - AI Output": {
      "main": [
        [
          {
            "node": "Enrich - Add Source Context and Risk Score",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log - Invalid AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Invalid AI Outputs": {
      "main": [
        [],
        [
          {
            "node": "Slack -  Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize - Email Data": {
      "main": [
        [
          {
            "node": "Merge - All Normalized Events",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Log - Invalid AI Output": {
      "main": [
        [
          {
            "node": "Log Invalid AI Outputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize - Webhook Data": {
      "main": [
        [
          {
            "node": "Deduplicate - Webhook Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log No Competitor Outputs": {
      "main": [
        [],
        [
          {
            "node": "Slack -  Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - New Email Received": {
      "main": [
        [
          {
            "node": "Normalize - Email Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack -  Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate - Webhook Events": {
      "main": [
        [
          {
            "node": "Merge - All Normalized Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gate - Competitors Detected?": {
      "main": [
        [
          {
            "node": "Split - One Row Per Competitor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log - No Competitor Detected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log - No Competitor Detected": {
      "main": [
        [
          {
            "node": "Log No Competitor Outputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge - All Normalized Events": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitor Intelligence Schema": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Priority Router & Stage Mapper": {
      "main": [
        [
          {
            "node": "Salesforce - Create Opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split - One Row Per Competitor": {
      "main": [
        [
          {
            "node": "Priority Router & Stage Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Notes and CRM Events": {
      "main": [
        [
          {
            "node": "Normalize - Webhook Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify - Slack Competitor Alert": {
      "main": [
        [
          {
            "node": "Store - Google Sheets Intelligence Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Salesforce - Create Opportunity": {
      "main": [
        [
          {
            "node": "Notify - Slack Competitor Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack -  Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store - Google Sheets Intelligence Log": {
      "main": [
        [],
        [
          {
            "node": "Slack -  Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich - Add Source Context and Risk Score": {
      "main": [
        [
          {
            "node": "Gate - Competitors Detected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow monitors Gmail and a webhook for sales notes, uses Groq (Llama 3.3) to extract competitor intelligence, then routes confirmed competitor signals to Salesforce, Slack, and Google Sheets for real-time alerting and logging. Triggers when a new Gmail message arrives or…

Source: https://n8n.io/workflows/17686/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Portfolio 1: Invoice manager. Uses gmailTrigger, googleDrive, agent, lmChatOpenAi. Event-driven trigger; 54 nodes.

Gmail Trigger, Google Drive, Agent +7
AI & RAG

CV → Match → Screen → Decide, all automated

HTTP Request, Information Extractor, Google Sheets +7
AI & RAG

This workflow intelligently analyzes incoming Gmail emails, classifies intent using GPT-4, and sends real-time Slack notifications while logging structured data into Google Sheets. It provides a smart

Gmail Trigger, Slack, Output Parser Structured +4
AI & RAG

This workflow automates invoice processing directly from your email inbox.

Gmail Trigger, HTTP Request, Agent +5
AI & RAG

This workflow captures incoming leads from Gmail, validates and stores them in Supabase, then uses AI to score and classify each lead. Based on the classification, leads are automatically routed to th

Supabase, Groq Chat, Slack +4