{
  "id": "3sovD0Vw1CbMrpBz",
  "name": "Email Router",
  "tags": [
    {
      "id": "VxQ2oC9UPeMrvUEc",
      "name": "Email Routing",
      "createdAt": "2026-03-11T08:37:24.986Z",
      "updatedAt": "2026-03-11T08:37:24.986Z"
    },
    {
      "id": "X5EhbRELpSJ4B5oN",
      "name": "PM-DailyOS",
      "createdAt": "2026-03-11T08:36:55.975Z",
      "updatedAt": "2026-03-11T08:36:55.975Z"
    }
  ],
  "nodes": [
    {
      "id": "7ba71607-e9ac-4683-bb26-dc2a5d41385e",
      "name": "Poll Email Intelligence",
      "type": "n8n-nodes-base.notion",
      "position": [
        -704,
        384
      ],
      "parameters": {
        "limit": 10,
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "id",
          "value": "31e06bab-3ebe-81d6-8c12-f607c8ff3b3f"
        },
        "filterType": "formula"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a4f10c46-8477-4d70-8e80-c3d263a5e5e1",
      "name": "Extract Email Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -464,
        384
      ],
      "parameters": {
        "jsCode": "// Extract email data from Notion page for routing\nconst page = $input.item.json;\n\nreturn [{\n  json: {\n    pageId: page.id,\n    notionUrl: page.url,\n    subject: page.properties?.['Subject']?.title?.[0]?.plain_text || '',\n    from: page.properties?.['From']?.rich_text?.[0]?.plain_text || '',\n    category: page.properties?.['Category']?.select?.name || 'Other',\n    urgency: page.properties?.['Urgency']?.select?.name || 'Medium',\n    status: page.properties?.['Status']?.select?.name || 'Triaged',\n    summary: page.properties?.['Summary']?.rich_text?.[0]?.plain_text || '',\n    keyAsk: page.properties?.['Key Ask']?.rich_text?.[0]?.plain_text || '',\n    draftResponse: page.properties?.['Draft Response']?.rich_text?.[0]?.plain_text || '',\n    customer: page.properties?.['Customer']?.rich_text?.[0]?.plain_text || '',\n    revenueImpact: page.properties?.['Revenue Impact']?.rich_text?.[0]?.plain_text || '',\n    suggestedAction: page.properties?.['Suggested Action']?.select?.name || '',\n    delegateTo: page.properties?.['Delegate To']?.rich_text?.[0]?.plain_text || '',\n    emailId: page.properties?.['Email ID']?.rich_text?.[0]?.plain_text || '',\n    threadId: page.properties?.['Thread ID']?.rich_text?.[0]?.plain_text || '',\n    tags: page.properties?.['Tags']?.rich_text?.[0]?.plain_text || ''\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1ee4f539-b4b5-4ae8-87e9-c5e5236d082c",
      "name": "Switch by Status",
      "type": "n8n-nodes-base.switch",
      "position": [
        -208,
        384
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "Responded"
                  }
                ]
              }
            },
            {
              "conditions": {
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "Delegated"
                  }
                ]
              }
            },
            {
              "conditions": {
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "Routed"
                  }
                ]
              }
            },
            {
              "conditions": {
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "Archived"
                  }
                ]
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "9dc43a16-a312-42f1-af19-c33788264b84",
      "name": "Gmail Send Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        80,
        80
      ],
      "parameters": {
        "message": "={{ $json.draftResponse }}",
        "options": {},
        "subject": "=Re: {{ $json.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "87bd0854-cac2-45f6-b81c-5333042656e9",
      "name": "Update Status - Responded",
      "type": "n8n-nodes-base.notion",
      "position": [
        368,
        80
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Extract Email Data').item.json.pageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|select",
              "selectValue": "Processed"
            },
            {
              "key": "Processed At|date",
              "date": "={{ $now.toISO() }}"
            },
            {
              "key": "Action Taken|rich_text"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "641b81b1-56a6-4f81-9c4d-967f2f25e6ca",
      "name": "Gmail Forward",
      "type": "n8n-nodes-base.gmail",
      "position": [
        64,
        272
      ],
      "parameters": {
        "message": "=Hi,\n\nForwarding this email for your attention. Here's the context:\n\n**Summary:** {{ $json.summary }}\n**Key Ask:** {{ $json.keyAsk }}\n**Urgency:** {{ $json.urgency }}\n{{ $json.customer ? '**Customer:** ' + $json.customer : '' }}\n{{ $json.revenueImpact ? '**Revenue Impact:** ' + $json.revenueImpact : '' }}\n\nPlease take ownership of this item. Let me know if you need any additional context.\n\nThanks!",
        "options": {},
        "subject": "=FWD: {{ $json.subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "75fb5e4c-8499-40ab-8762-85be5790221c",
      "name": "Slack DM Delegate",
      "type": "n8n-nodes-base.slack",
      "position": [
        384,
        272
      ],
      "parameters": {
        "text": "=:incoming_envelope: *Email Delegated to You*\n\n*Subject:* {{ $('Extract Email Data').item.json.subject }}\n*From:* {{ $('Extract Email Data').item.json.from }}\n*Urgency:* {{ $('Extract Email Data').item.json.urgency }}\n\n*Summary:* {{ $('Extract Email Data').item.json.summary }}\n*Key Ask:* {{ $('Extract Email Data').item.json.keyAsk }}\n\nI've forwarded the full email to you. Please take ownership and respond.",
        "otherOptions": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "a9e5f12d-1a8e-4f16-a860-645d37554ce3",
      "name": "Update Status - Delegated",
      "type": "n8n-nodes-base.notion",
      "position": [
        592,
        272
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Extract Email Data').item.json.pageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|select",
              "selectValue": "Processed"
            },
            {
              "key": "Processed At|date",
              "date": "={{ $now.toISO() }}"
            },
            {
              "key": "Action Taken|rich_text"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "41810ba1-f295-4604-84ca-8637e63619e8",
      "name": "Switch by Route Destination",
      "type": "n8n-nodes-base.switch",
      "position": [
        64,
        448
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b964017f-1a0c-45e3-bfe8-a8d2dcab6056",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.tags }}",
                    "rightValue": "RICE"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5dd4a0bf-2189-4db6-b590-79038916c18f",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Customer"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0eb23f72-35f5-43ba-a64c-f8346d94887f",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.tags }}",
                    "rightValue": "Sprint"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b06557d8-6af4-4715-ae6d-c5be8db36197",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "Competitor Intel"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "4f27d4c7-986f-4d7f-a5a0-b91ef6395130",
      "name": "Prepare Route Data",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        464
      ],
      "parameters": {
        "jsCode": "// Create a signal from the routed email\nconst email = $input.item.json;\n\nreturn [{\n  json: {\n    title: email.subject,\n    type: 'Email Intel',\n    source: email.from,\n    content: email.summary,\n    category: email.category,\n    urgency: email.urgency,\n    customer: email.customer,\n    revenueImpact: email.revenueImpact,\n    tags: email.tags,\n    sourceEmailId: email.emailId,\n    routedFrom: 'Email Router'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "5c7d3e10-bd4d-4f91-81cd-cfbb43251a33",
      "name": "Create in Signal Stream",
      "type": "n8n-nodes-base.notion",
      "position": [
        592,
        464
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "id",
          "value": "31e06bab-3ebe-811b-b204-c5f41b273303"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Signal|title",
              "title": "={{ $json.title }}"
            },
            {
              "key": "Type|select",
              "selectValue": "={{ $json.type }}"
            },
            {
              "key": "Source|rich_text"
            },
            {
              "key": "Content|rich_text"
            },
            {
              "key": "Category|select",
              "selectValue": "={{ $json.category }}"
            },
            {
              "key": "Urgency|select",
              "selectValue": "={{ $json.urgency }}"
            },
            {
              "key": "Status|select",
              "selectValue": "New"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "77c86b00-18a4-4956-a634-9a53f47ad81d",
      "name": "Update Status - Routed",
      "type": "n8n-nodes-base.notion",
      "position": [
        832,
        464
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Extract Email Data').item.json.pageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|select",
              "selectValue": "Processed"
            },
            {
              "key": "Processed At|date",
              "date": "={{ $now.toISO() }}"
            },
            {
              "key": "Action Taken|rich_text"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7063c624-77a6-4620-9ca3-3696c1708d04",
      "name": "Prepare Archive Labels",
      "type": "n8n-nodes-base.code",
      "position": [
        64,
        704
      ],
      "parameters": {
        "jsCode": "// Gmail modify labels - archive the email\nconst email = $input.item.json;\n\n// In production, this would use Gmail API to:\n// 1. Remove INBOX label\n// 2. Add appropriate labels (e.g., 'PM-Processed', 'Archived')\n// For now, we prepare the label modification data\n\nreturn [{\n  json: {\n    emailId: email.emailId,\n    threadId: email.threadId,\n    addLabels: ['PM-Processed', 'Auto-Archived'],\n    removeLabels: ['INBOX', 'UNREAD'],\n    action: 'archive',\n    subject: email.subject,\n    pageId: email.pageId\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "5808aefb-de5b-4138-a2ec-20be8630212e",
      "name": "Update Status - Archived",
      "type": "n8n-nodes-base.notion",
      "position": [
        400,
        704
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.pageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|select",
              "selectValue": "Processed"
            },
            {
              "key": "Processed At|date",
              "date": "={{ $now.toISO() }}"
            },
            {
              "key": "Action Taken|rich_text"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d38e9a6a-6589-43d3-91b3-2215814453da",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        -112
      ],
      "parameters": {
        "width": 420,
        "height": 400,
        "content": "## How it works\n\nWhen you set an email's status in Notion (Responded, Delegated, Routed, or Archived), this workflow executes the action: sends the reply, forwards to a delegate, routes to Jira/backlog, or archives in Gmail."
      },
      "typeVersion": 1
    },
    {
      "id": "b601a2c3-e9af-4bdb-bda6-60b0ba4d7f6f",
      "name": "Sticky Note - Routes",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 1112,
        "height": 984,
        "content": "## Action Router\n\n4-way switch: Responded sends the draft reply via Gmail thread, Delegated forwards + Slack DMs the delegate, Routed creates items in destination DBs, Archived applies Gmail labels."
      },
      "typeVersion": 1
    },
    {
      "id": "2c4e0b5a-3691-4f1d-8841-7165583508dd",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 992,
        "content": "## Closed Loop\n\nAfter each action, updates the Email Intelligence entry in Notion to 'Processed' with a timestamp and reference."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "aa526a40-2afe-41ac-9336-91ea301408c5",
  "connections": {
    "Gmail Forward": {
      "main": [
        [
          {
            "node": "Slack DM Delegate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Send Reply": {
      "main": [
        [
          {
            "node": "Update Status - Responded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch by Status": {
      "main": [
        [
          {
            "node": "Gmail Send Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail Forward",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Switch by Route Destination",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Archive Labels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack DM Delegate": {
      "main": [
        [
          {
            "node": "Update Status - Delegated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email Data": {
      "main": [
        [
          {
            "node": "Switch by Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Route Data": {
      "main": [
        [
          {
            "node": "Create in Signal Stream",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Archive Labels": {
      "main": [
        [
          {
            "node": "Update Status - Archived",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create in Signal Stream": {
      "main": [
        [
          {
            "node": "Update Status - Routed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll Email Intelligence": {
      "main": [
        [
          {
            "node": "Extract Email Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch by Route Destination": {
      "main": [
        [
          {
            "node": "Prepare Route Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Route Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Route Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Route Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}