{
  "name": "Stakeholder",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -352,
        -48
      ],
      "id": "2725b13c-5466-4a48-a3a1-789e784ad1fe",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1BuELVNEtV2J6fJvNTtJXufGb7EKslIDqGWf5EC42WqU",
          "mode": "list",
          "cachedResultName": "Jira Data",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1BuELVNEtV2J6fJvNTtJXufGb7EKslIDqGWf5EC42WqU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1BuELVNEtV2J6fJvNTtJXufGb7EKslIDqGWf5EC42WqU/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -128,
        -48
      ],
      "id": "7137ab4f-3d29-4a14-86e0-332a0a2a2cc7",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "uppMVnK5jeLM4hE4",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const issues = items.map(item => ({\n  key: item.json.key,\n  summary: item.json.summary,\n  status: item.json.status,\n  priority: item.json.priority,\n  assignee: item.json.assignee,\n  sprint: item.json.sprint,\n  updated: item.json.updated,\n  blocked: item.json.blocked === true || item.json.blocked === \"TRUE\"\n}));\n\nreturn [\n  {\n    json: { issues }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        96,
        -48
      ],
      "id": "cb114b83-fd42-43aa-8680-d3fe17747cbb",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "jsCode": "const issues = $input.first().json.issues;\n\nconst signals = {\n  total: issues.length,\n  completed: issues.filter(i => i.status === \"Done\").length,\n  inProgress: issues.filter(i => i.status === \"In Progress\").length,\n  blocked: issues.filter(i => i.status === \"Blocked\").length,\n  blockedHighPriority: issues.filter(\n    i => i.status === \"Blocked\" && i.priority === \"High\"\n  )\n};\n\nreturn [{ json: signals }];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        320,
        -48
      ],
      "id": "7f5655bf-0855-4e2c-9f2b-8b08e3114283",
      "name": "Code in JavaScript1"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b09eb74c-d71e-46dd-ac95-fd1376005b22",
              "name": "stakeholders",
              "value": "=[\n  {\n    \"role\": \"Leadership\",\n    \"focus\": \"overall progress, risks, timelines\",\n    \"channel\": \"email\",\n    \"recipient\": \"riya.gulhare@gmail.com\"\n  },\n  {\n    \"role\": \"Engineering\",\n    \"focus\": \"blockers, ownership, dependencies\",\n    \"channel\": \"email\",\n    \"recipient\": \"engineering@company.com\"\n  },\n  {\n    \"role\": \"Operations\",\n    \"focus\": \"customer impact, readiness\",\n    \"channel\": \"email\",\n    \"recipient\": \"ops@company.com\"\n  }\n]\n",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        544,
        -112
      ],
      "id": "2343bb4c-dad1-4931-aa61-dfc7a5c62b6a",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\n\n// Parse stakeholders string → array\nconst stakeholders = JSON.parse(input.stakeholders);\n\n// Return EVERYTHING + stakeholders as array\nreturn [\n  {\n    json: {\n      ...input,\n      stakeholders\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        800,
        -272
      ],
      "id": "a8880cf0-26af-481b-89d4-a406727db663",
      "name": "Code in JavaScript2"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1040,
        32
      ],
      "id": "1bcbb813-8010-4f5a-b79f-73d8760509f6",
      "name": "Merge"
    },
    {
      "parameters": {
        "jsCode": "const { stakeholders, ...signals } = $json;\n\n// Create one item per stakeholder\nreturn stakeholders.map(stakeholder => ({\n  json: {\n    ...signals,\n    ...stakeholder\n  }\n}));\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1216,
        -48
      ],
      "id": "d43329ec-2d29-438c-9f0a-981bb2d7ad49",
      "name": "Code in JavaScript3"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.role }}",
                    "rightValue": "Leadership",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "1b34f34a-e2e4-4ad1-9bde-b6686f0817f5"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "1fcb5afe-2d80-431f-a926-331ed8750c75",
                    "leftValue": "={{ $json.role }}",
                    "rightValue": "Engineering",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "2da9da20-9871-477c-969c-063b4cf8693a",
                    "leftValue": "={{ $json.role }}",
                    "rightValue": "Operations",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        1424,
        80
      ],
      "id": "acbbce86-efc7-40b9-bb56-ddb71d2c0a2d",
      "name": "Switch"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a Product Manager preparing a leadership sprint update email.\n\nAudience: Senior Leadership\nTone: Concise, professional, outcome-focused\n\nUsing the provided sprint data, draft an email in the following format:\n\nSubject: <short executive summary>\n\nBody:\n- Overall progress (numbers)\n- Key risks / blockers (high priority only)\n- Impact on timelines or customers\n- Next steps / mitigation plan\n\nRules:\n- Do NOT include markdown\n- Do NOT add greetings like \"Hi team\"\n- Keep it under 150 words\n\nReturn output in STRICT JSON only:\n\n{\n  \"subject\": \"string\",\n  \"body\": \"string\"\n}\n",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1648,
        -176
      ],
      "id": "ced15c86-e0e1-4efa-9bba-756df1e333dc",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        1680,
        -16
      ],
      "id": "9ecc1924-463f-495c-9e15-25c427871f65",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "TPz6Al0V9LLuwkcV",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return items.map(item => {\n  const ai = JSON.parse(item.json.output);\n\n  return {\n    json: {\n      ...item.json,     // ← keeps recipient, channel, role\n      subject: ai.subject,\n      body: ai.body\n    }\n  };\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2000,
        -176
      ],
      "id": "15850166-07bc-4900-9b1a-6abc668db166",
      "name": "Code in JavaScript4"
    },
    {
      "parameters": {
        "sendTo": "leadership@company.com",
        "subject": "={{ $json.subject }}",
        "emailType": "text",
        "message": "={{ $json.body }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        2208,
        -176
      ],
      "id": "9fb0104a-5a98-424f-b3a9-37f854eede60",
      "name": "Send a message",
      "webhookId": "97af30ba-da3e-4ff1-970d-b123696b2abf",
      "credentials": {
        "gmailOAuth2": {
          "id": "FCTEJeXrzhYk8Ee7",
          "name": "Gmail account 2"
        }
      }
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "value": "2f8f0d39-2b66-801e-a23e-ce71b48716da",
          "mode": "list",
          "cachedResultName": "Updates",
          "cachedResultUrl": "https://www.notion.so/2f8f0d392b66801ea23ece71b48716da"
        },
        "title": "Sprint Update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Key|title",
              "title": "={{ $json.blockedHighPriority[0].key }}"
            },
            {
              "key": "Summary|rich_text",
              "textContent": "={{ $json.blockedHighPriority[0].summary }}"
            },
            {
              "key": "Sprint|rich_text",
              "textContent": "={{ $json.blockedHighPriority[0].sprint }}"
            },
            {
              "key": "Priority|rich_text",
              "textContent": "={{ $json.blockedHighPriority[0].priority }}"
            },
            {
              "key": "Assignee|rich_text",
              "textContent": "={{ $json.blockedHighPriority[0].assignee }}"
            },
            {
              "key": "Status|status",
              "statusValue": "={{ $json.blockedHighPriority[0].status }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        1920,
        240
      ],
      "id": "55dbe371-059d-4060-97dd-8d2fa8b166c8",
      "name": "Create a database page",
      "credentials": {
        "notionApi": {
          "id": "g92RVqcOAskZo54o",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "resource": "channel",
        "operation": "get",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "options": {}
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        1808,
        400
      ],
      "id": "c008256d-f1a3-40b7-936e-1ec45dcd2e7f",
      "name": "Get a channel",
      "webhookId": "2f1d10c2-e2a7-4251-9ca3-a7b55bc78919",
      "credentials": {
        "slackOAuth2Api": {
          "id": "lU0aqor04lpntuiG",
          "name": "Slack account 3"
        }
      },
      "disabled": true
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Code in JavaScript2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Code in JavaScript3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript3": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create a database page",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code in JavaScript4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript4": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "9f6a35a6-7f4d-41fb-8cda-43a872558659",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "6fdabfb3425051a03838967ed50d4350dc827cfd636ffc6821f571ab320d29a1"
  },
  "id": "ez4IenkwKQWHUW7y",
  "tags": []
}