{
  "id": "yM8ncIZBuYV91Wt7",
  "name": "My workflow",
  "tags": [],
  "nodes": [
    {
      "id": "e5eaebfd-ed7f-4c9d-b568-1e910c8acc53",
      "name": "Competitive Analysis (Current Deal)",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        3104,
        720
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemma-4-31b-it",
          "cachedResultName": "models/gemma-4-31b-it"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are analyzing an ACTIVE sales opportunity that is currently IN PROGRESS. Below is the current deal information followed by historical context about this account.\n\n=== CURRENT OPPORTUNITY (IN PROGRESS) ===\nOpportunity Name: {{ $('AI Input Payload').item.json.opportunityName }}\nDeal Value: ${{ $('AI Input Payload').item.json.dealAmount }}\nExpected Close Date: {{ $('AI Input Payload').item.json.CloseDate }}\nCurrent Sales Stage: {{ $('AI Input Payload').item.json.currentStage }}\nPrimary Competitor: {{ $('AI Input Payload').item.json.competitorName }}\n\n=== COMPETITIVE INTELLIGENCE ON {{ $('AI Input Payload').item.json.competitorName }} ===\n{{ $('AI Input Payload').item.json.competitorIntel }}\n\n=== HISTORICAL CONTEXT (Past Deals with This Account) ===\n{{ $json['accountHistory'] }}\nNOTE: The above is HISTORICAL data about past deals with this customer. The current opportunity being analyzed is the one listed at the top.\n\nTASK: Analyze the CURRENT ACTIVE opportunity listed above and provide:\n1) The three most critical competitive factors in THIS CURRENT DEAL\n2) The competitor's likely strategy for THIS SPECIFIC OPPORTUNITY based on the deal characteristics\n3) Potential vulnerabilities in their approach that we can exploit NOW in this active sales cycle\n\nFocus your analysis on winning the current ${{ $('AI Input Payload').item.json.dealAmount }} deal, not on past outcomes."
            }
          ]
        },
        "builtInTools": {}
      },
      "retryOnFail": true,
      "typeVersion": 1.1
    },
    {
      "id": "da0d308c-9d95-4e14-9716-2ad4bd8bdd4f",
      "name": "Counter Strategy Generator",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        3456,
        720
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemma-4-31b-it",
          "cachedResultName": "models/gemma-4-31b-it"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "model",
              "content": "=You are a strategic sales advisor creating an action plan for an ACTIVE sales opportunity that is currently being pursued."
            },
            {
              "content": "=PREVIOUS COMPETITIVE ANALYSIS:\n{{ $json.content.parts[0].text }}\n\nCURRENT OPPORTUNITY DETAILS:\nOpportunity: {{ $('AI Input Payload').item.json.opportunityName }}\nDeal Size: ${{ $('AI Input Payload').item.json.dealAmount }}\nSales Stage: {{ $('AI Input Payload').item.json.currentStage }}\nCompetitor: {{ $('AI Input Payload').item.json.competitorName }}\n\nThis is an ACTIVE deal in the {{ $('AI Input Payload').item.json.currentStage }} stage. The sales rep needs to take action NOW to win against {{ $('AI Input Payload').item.json.competitorName }}.\n\nProvide a comprehensive counter-strategy for winning THIS CURRENT DEAL including:\n1) Specific talking points for the NEXT customer conversation (this week)\n2) Proof points or case studies to reference in upcoming presentations\n3) Objections we should prepare for and how to handle them\n4) Immediate next steps the account executive should take in the next 7 days\n5) Red flags to watch for during this active sales cycle\n\nFormat this as clear, actionable guidance for winning an ACTIVE deal, not for recovering from a loss."
            }
          ]
        },
        "builtInTools": {}
      },
      "retryOnFail": true,
      "typeVersion": 1.1
    },
    {
      "id": "60e98b6e-abb3-46ec-92bf-e2326cfb2684",
      "name": "Competitive Risk Score",
      "type": "n8n-nodes-base.code",
      "position": [
        3920,
        720
      ],
      "parameters": {
        "jsCode": "// Get the input data from previous nodes\nconst dealAmount = $('AI Input Payload').first().json.dealAmount;\nconst currentStage = $('AI Input Payload').first().json.currentStage;\nconst competitorName = $('AI Input Payload').first().json.competitorName;\nconst accountHistory = $('Account History Summary').first().json.summary || \"\";\n\n// Initialize scoring variables\nlet riskScore = 50; // Start at neutral 50\n\n// Adjust based on deal size (larger deals = higher risk)\nif (dealAmount > 1000000) {\n  riskScore += 15;\n} else if (dealAmount > 750000) {\n  riskScore += 10;\n}\n\n// Adjust based on sales stage (later stages = lower risk if we're still in)\nif (currentStage === \"Proposal\" || currentStage === \"Negotiation\") {\n  riskScore -= 10;\n} else if (currentStage === \"Qualification\") {\n  riskScore += 5;\n}\n\n// Adjust based on competitor strength\nconst toughCompetitors = [\"Salesforce\", \"Oracle\", \"Microsoft Dynamics\"];\nif (toughCompetitors.includes(competitorName)) {\n  riskScore += 15;\n}\n\n// Check account history for wins\nif (accountHistory.includes(\"IsWon = true\")) {\n  riskScore -= 20; // Existing customer relationship reduces risk\n}\n\n// Determine risk level category\nlet riskLevel;\nif (riskScore >= 70) {\n  riskLevel = \"HIGH RISK\";\n} else if (riskScore >= 50) {\n  riskLevel = \"MODERATE RISK\";\n} else {\n  riskLevel = \"LOW RISK\";\n}\n\n// Return the enhanced data\nreturn {\n  ...$input.first().json,\n  competitiveRiskScore: riskScore,\n  riskLevel: riskLevel,\n  requiresExecutiveReview: riskScore >= 70\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "ef67ac96-54fe-41ad-8614-ef94b1e53345",
      "name": "Strategy Notes & Status",
      "type": "n8n-nodes-base.set",
      "position": [
        4144,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "610c4978-3034-45b2-82a8-0a8def578151",
              "name": "strategyNotes",
              "type": "string",
              "value": "=Risk Level: {{ $('Competitive Risk Score').item.json.riskLevel }} (Score: {{ $('Competitive Risk Score').item.json.competitiveRiskScore }})\n\nCOMPETITIVE ANALYSIS:\n{{ $('Competitive Analysis (Current Deal)').item.json.content.parts[0].text }}\n\nCOUNTER-STRATEGY & ACTION PLAN:\n{{ $json.content.parts[0].text }}\n\nLast Updated: {{ Date() }}"
            },
            {
              "id": "4e87e785-be17-4e2c-9011-10dc8e9e5982",
              "name": "Risk Level",
              "type": "string",
              "value": "={{ $json.riskLevel }}(Score: {{ $json.competitiveRiskScore }})"
            },
            {
              "id": "7f842aa8-ef2e-434b-b54b-4f0dd0805429",
              "name": "intelligenceStatus",
              "type": "string",
              "value": "Analysis Complete"
            },
            {
              "id": "611a9141-e302-489e-b0ca-2f6ab086db5c",
              "name": "lastAnalyzedDate",
              "type": "string",
              "value": "={{ Date() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5aef241d-dae2-4bf2-98ad-91b11a6b1122",
      "name": "Update Opportunity (Strategy & Status)",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        4480,
        720
      ],
      "parameters": {
        "resource": "opportunity",
        "operation": "update",
        "updateFields": {
          "customFieldsUi": {
            "customFieldsValues": [
              {
                "value": "={{ $json.strategyNotes }}",
                "fieldId": "Competitive_Strategy_Notes__c"
              },
              {
                "value": "={{ $json.intelligenceStatus }}",
                "fieldId": "Competitor_Intelligence_Status__c"
              }
            ]
          }
        },
        "opportunityId": "={{ $('Get Opportunity Details').item.json.Id }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f7832496-9591-486b-ba48-d9e2a2c21349",
      "name": "Send Analysis Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        4704,
        720
      ],
      "parameters": {
        "message": "=Hello, \n\nYour competitive analysis for {{ $('AI Input Payload').item.json.opportunityName }} is now complete.\n\nCompetitor Identified: {{ $('AI Input Payload').item.json.competitorName }} \nDeal Size: ${{ $('AI Input Payload').item.json.dealAmount }} \nRisk Assessment: {{ $('Strategy Notes & Status').item.json['Risk Level'] }}\n\nKey insights and counter-strategies have been added to the opportunity record in Salesforce. Please review the Competitive Strategy Notes field for detailed recommendations. \n\nThis analysis is based on our latest competitive intelligence and historical win/loss data against {{ $('AI Input Payload').item.json.competitorName }}. \n\nBest regards, \nAutomated Competitive Intelligence System",
        "options": {},
        "subject": "=Competitive Intelligence Ready:  {{ $('AI Input Payload').item.json.opportunityName }}",
        "emailType": "text"
      },
      "typeVersion": 2.2
    },
    {
      "id": "6ea98dcb-d764-48c8-8ce7-8e94ca9317e7",
      "name": "Control Execution Cycle",
      "type": "n8n-nodes-base.wait",
      "position": [
        5024,
        816
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "9bd68afc-5b6b-4f14-bb82-d59362aa806f",
      "name": "Opportunity Created",
      "type": "n8n-nodes-base.salesforceTrigger",
      "position": [
        608,
        608
      ],
      "parameters": {
        "pollTimes": {
          "item": [
            {}
          ]
        },
        "triggerOn": "opportunityCreated"
      },
      "typeVersion": 1
    },
    {
      "id": "e829db96-53aa-4237-a282-ea242cd6b9a2",
      "name": "Opportunity Updated",
      "type": "n8n-nodes-base.salesforceTrigger",
      "position": [
        608,
        816
      ],
      "parameters": {
        "pollTimes": {
          "item": [
            {}
          ]
        },
        "triggerOn": "opportunityUpdated"
      },
      "typeVersion": 1
    },
    {
      "id": "1b81552b-7627-4299-990c-5f72f4283f68",
      "name": "Process Each Opportunity",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        864,
        720
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "5475d9a1-38ae-4a74-8b61-eedc84315e04",
      "name": "Get Opportunity Details",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1088,
        640
      ],
      "parameters": {
        "resource": "opportunity",
        "operation": "get",
        "opportunityId": "={{ $json.Id }}"
      },
      "typeVersion": 1
    },
    {
      "id": "6dc3b4d5-464d-44df-83e9-52e499a1327a",
      "name": "Competitor Present & Not Processed",
      "type": "n8n-nodes-base.if",
      "position": [
        1312,
        640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3b4b61fb-ef02-4aac-8d76-49a9b3471a0d",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Primary_Competitor__c }}",
              "rightValue": ""
            },
            {
              "id": "83fa08ce-25de-43a0-ab27-a315d41de8a8",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.Competitor_Intelligence_Status__c }}",
              "rightValue": "Analysis Complete"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b0c8aff9-9673-4b74-84fc-7b4f753a51a6",
      "name": "Fetch Account Opportunity History",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1648,
        576
      ],
      "parameters": {
        "query": "=SELECT Id, Name, Amount, CloseDate, StageName, IsWon FROM Opportunity WHERE AccountId = '{{ $json.AccountId }}' ORDER BY CloseDate DESC LIMIT 10",
        "resource": "search"
      },
      "typeVersion": 1
    },
    {
      "id": "e2271ca5-d45f-4820-ae7f-96e2e658e184",
      "name": "Account Opportunities",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1904,
        576
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "b4743c57-2c07-452c-b380-4a170afe7d24",
      "name": "Fetch Competitor Intelligence",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1872,
        784
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $('Get Opportunity Details').item.json.Primary_Competitor__c }}",
              "lookupColumn": "Competitor Name"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 14947557,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fwvOWtXwLzgx1FF_v1FaxTMDEiIN0qPF_zE1uFJj1Q8/edit#gid=14947557",
          "cachedResultName": "Competitive Intelligence Database"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1fwvOWtXwLzgx1FF_v1FaxTMDEiIN0qPF_zE1uFJj1Q8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fwvOWtXwLzgx1FF_v1FaxTMDEiIN0qPF_zE1uFJj1Q8/edit?usp=drivesdk",
          "cachedResultName": "N8N - PRACTICE"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "04f80cf6-8e36-4f45-816c-250c59db1c4c",
      "name": "History + Competitor Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        2304,
        688
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "0c2e1f5a-5d82-47b4-82b0-495621c01568",
      "name": "Account History Summary",
      "type": "n8n-nodes-base.code",
      "position": [
        2528,
        688
      ],
      "parameters": {
        "jsCode": "  const opps = $('Account Opportunities').first().json.data;\n  const wins = opps.filter(o => o.IsWon === true).length;\n  const losses = opps.filter(o => o.IsWon === false).length;\n  const open = opps.filter(o => o.IsWon === null).length;\n  const totalValue = opps.reduce((sum, o) => sum + (o.Amount || 0), 0);\n  \n  let summary = `Account History Summary:\\n`;\n  summary += `Total Past Opportunities: ${opps.length}\\n`;\n  summary += `Wins: ${wins} | Losses: ${losses} | Currently Open: ${open}\\n`;\n  summary += `Total Historical Value: $${totalValue.toLocaleString()}\\n\\n`;\n  summary += `Recent Opportunities:\\n`;\n  summary += opps.slice(0, 5).map(opp => {\n    const status = opp.IsWon === true ? 'WON' : (opp.IsWon === false ? 'LOST' : 'OPEN');\n    return `- ${opp.Name}: $${(opp.Amount || 0).toLocaleString()} - ${status} (${opp.CloseDate})`;\n  }).join('\\n');\n\n\nreturn {\n  json:{\n    summary\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "84d2f731-fa60-418d-a1b4-5d3f4de40889",
      "name": "AI Input Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        2752,
        688
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "644b570b-b2e9-40d5-baaf-5ec6aa6b5465",
              "name": "opportunityName",
              "type": "string",
              "value": "={{ $('Get Opportunity Details').item.json.Name }}"
            },
            {
              "id": "b26442da-f5b4-4083-9cab-5a81158d12ba",
              "name": "dealAmount",
              "type": "number",
              "value": "={{ $('Get Opportunity Details').item.json.Amount }}"
            },
            {
              "id": "e96db67c-c397-4b3c-9734-82a8179cb502",
              "name": "CloseDate",
              "type": "string",
              "value": "={{ $('Get Opportunity Details').item.json.CloseDate }}"
            },
            {
              "id": "123ba9e4-8536-43d4-a9b9-166ed658f722",
              "name": "currentStage",
              "type": "string",
              "value": "={{ $('Get Opportunity Details').item.json.StageName }}"
            },
            {
              "id": "6d45a97d-203c-47dc-8974-b3dd5e6185f5",
              "name": "competitorName",
              "type": "string",
              "value": "={{ $('Get Opportunity Details').item.json.Primary_Competitor__c }}"
            },
            {
              "id": "9c557b1b-6f02-4f04-8ad8-015d10ae590f",
              "name": "competitorIntel",
              "type": "string",
              "value": "={{ $('History + Competitor Data').item.json[\"Typical Discount Strategy\"] }}"
            },
            {
              "id": "201314f9-9748-40f5-9b55-8a4cd41043de",
              "name": "accountHistory",
              "type": "string",
              "value": "={{ $json.summary }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7e7668ac-a118-4c80-924c-e1a9cadb701a",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        208
      ],
      "parameters": {
        "width": 700,
        "height": 832,
        "content": "# Competitive Intelligence Automation\n\n**How it works:**\nThis workflow automatically analyzes competitive threats when Salesforce opportunities are created or updated. It fetches historical account data, retrieves competitor intelligence from Google Sheets, uses AI to generate competitive analysis and counter-strategies, calculates risk scores, then updates Salesforce and notifies the team via email.\n\n**Setup steps:**\n1. Connect Salesforce OAuth2 credentials\n2. Connect Gmail OAuth2 credentials\n3. Connect Google Sheets OAuth2 API\n4. Connect Google Gemini API credentials\n5. Update the Google Sheets document ID and sheet name\n6. Update the email recipient address\n7. Ensure Salesforce custom fields exist: Primary_Competitor__c, Competitive_Strategy_Notes__c, Competitor_Intelligence_Status__c\n8. Activate the workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "003bd6b7-32bb-40af-b29d-d33c68440549",
      "name": "Trigger Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        352
      ],
      "parameters": {
        "color": 2,
        "width": 908,
        "height": 688,
        "content": "## Trigger & Input Validation\n\nListens for new or updated opportunities in Salesforce. Loops through each opportunity and validates that it has a competitor assigned and hasn't been analyzed yet."
      },
      "typeVersion": 1
    },
    {
      "id": "23377c47-2e33-48f0-b147-7ad25f81a14e",
      "name": "Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        352
      ],
      "parameters": {
        "color": 2,
        "width": 600,
        "height": 696,
        "content": "## Data Collection\n\nFetches historical opportunities for the account from Salesforce and retrieves competitor intelligence data from Google Sheets based on the identified competitor."
      },
      "typeVersion": 1
    },
    {
      "id": "f97c98f6-ddea-4039-84a9-5ebfd42daa4c",
      "name": "Data Prep",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2208,
        352
      ],
      "parameters": {
        "color": 2,
        "width": 740,
        "height": 696,
        "content": "## Data Aggregation & Preparation\n\nCombines historical account data with competitor intelligence. Generates a summary of past wins/losses and structures all data for AI analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "07f2e5f4-02ba-4365-82ad-7e616c3220a5",
      "name": "AI Analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3040,
        352
      ],
      "parameters": {
        "color": 2,
        "width": 692,
        "height": 692,
        "content": "## AI-Powered Analysis\n\nUses Google Gemini to:\n1. Analyze the competitive situation and identify critical factors\n2. Generate actionable counter-strategies and talking points for the sales team\n\nBoth analyses consider the current deal stage and historical context."
      },
      "typeVersion": 1
    },
    {
      "id": "1187c1ef-1096-485f-ab2c-1f738ad47cef",
      "name": "Risk Assessment",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3824,
        352
      ],
      "parameters": {
        "color": 2,
        "width": 512,
        "height": 688,
        "content": "## Risk Scoring\n\nCalculates a competitive risk score (0-100) based on:\n- Deal size\n- Sales stage\n- Competitor strength\n- Account history\n\nCategorizes as HIGH, MODERATE, or LOW RISK."
      },
      "typeVersion": 1
    },
    {
      "id": "db9c6c81-5d37-4b68-b789-70d041737383",
      "name": "Output & Notification",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4400,
        352
      ],
      "parameters": {
        "color": 2,
        "width": 508,
        "height": 684,
        "content": "## Update & Notify\n\nWrites the complete analysis back to the Salesforce opportunity record and sends an email notification to the sales team with key insights and recommended actions."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "ce2aa966-e576-4502-9421-3379a85a7810",
  "nodeGroups": [],
  "connections": {
    "AI Input Payload": {
      "main": [
        [
          {
            "node": "Competitive Analysis (Current Deal)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Opportunity Created": {
      "main": [
        [
          {
            "node": "Process Each Opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Opportunity Updated": {
      "main": [
        [
          {
            "node": "Process Each Opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Analysis Email": {
      "main": [
        [
          {
            "node": "Control Execution Cycle",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Account Opportunities": {
      "main": [
        [
          {
            "node": "History + Competitor Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitive Risk Score": {
      "main": [
        [
          {
            "node": "Strategy Notes & Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Account History Summary": {
      "main": [
        [
          {
            "node": "AI Input Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Control Execution Cycle": {
      "main": [
        [
          {
            "node": "Process Each Opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Opportunity Details": {
      "main": [
        [
          {
            "node": "Competitor Present & Not Processed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Strategy Notes & Status": {
      "main": [
        [
          {
            "node": "Update Opportunity (Strategy & Status)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Each Opportunity": {
      "main": [
        [],
        [
          {
            "node": "Get Opportunity Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "History + Competitor Data": {
      "main": [
        [
          {
            "node": "Account History Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Counter Strategy Generator": {
      "main": [
        [
          {
            "node": "Competitive Risk Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Competitor Intelligence": {
      "main": [
        [
          {
            "node": "History + Competitor Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Fetch Account Opportunity History": {
      "main": [
        [
          {
            "node": "Account Opportunities",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitor Present & Not Processed": {
      "main": [
        [
          {
            "node": "Fetch Account Opportunity History",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Competitor Intelligence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitive Analysis (Current Deal)": {
      "main": [
        [
          {
            "node": "Counter Strategy Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Opportunity (Strategy & Status)": {
      "main": [
        [
          {
            "node": "Send Analysis Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}