MONDAY GET FULL ITEM

工作流概述

这是一个包含26个节点的复杂工作流,主要用于自动化处理各种任务。

工作流源代码

下载
{
  "id": "ZdGZh4qmOqTQe1oq",
  "meta": {
    "instanceId": "da824ad45fda1b156c8390a3c35cdfbb10059e671c074c19429dac59c5ae98f6"
  },
  "name": "MONDAY GET FULL ITEM",
  "tags": [
    {
      "id": "uKg1PU2D27Vsr8ud",
      "name": "MONDAY",
      "createdAt": "2023-12-05T07:54:13.266Z",
      "updatedAt": "2023-12-05T07:54:13.266Z"
    }
  ],
  "nodes": [
    {
      "id": "20299349-bc2c-4aa8-b083-db31cb9aa278",
      "name": "GET ALL COLUMNS",
      "type": "n8n-nodes-base.code",
      "position": [
        1840,
        -600
      ],
      "parameters": {
        "jsCode": "function createColumnValuesArray(data) {
  const result = {};
  data.forEach(item => {
    const name = item.id;
    result[name] = item;
  });

  return result;
}

columns = $input.last().json.column_values
data1 = { \"name\" : $input.last().json.name, \"id\" : $input.last().json.id }
data2 = createColumnValuesArray(columns)

const combinedData = { \"item\" : data1, columnValuesById: data2}

return (combinedData)


"
      },
      "typeVersion": 2
    },
    {
      "id": "04c2550e-41d8-46f4-a131-2ea99dd4258a",
      "name": "GET ALL RELATIONS",
      "type": "n8n-nodes-base.code",
      "position": [
        1860,
        -220
      ],
      "parameters": {
        "jsCode": "var data = $input.last().json.columnValuesById;
i = 0;
relations = [];
for (var key in data) {
    if (data[key].type == \"board_relation\") {
      relations[i] = data[key];
      i++
    }
}

return relations;

"
      },
      "typeVersion": 2
    },
    {
      "id": "5796cb17-199b-4838-ae9c-c3636824bd13",
      "name": "PULL LINKEDPULSE1",
      "type": "n8n-nodes-base.mondayCom",
      "position": [
        1720,
        -40
      ],
      "parameters": {
        "itemId": "=
{{ $json.linkedPulse.linkedPulseId }}",
        "resource": "boardItem",
        "operation": "get"
      },
      "credentials": {
        "mondayComApi": {
          "id": "5nd48DKapWBLcUBx",
          "name": "Monday.com account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "67a8a151-5875-4ec7-8fda-f797f3d3b198",
      "name": "GET LINKEDPULSES1",
      "type": "n8n-nodes-base.code",
      "position": [
        1340,
        -40
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "data = $input.item.json.value
id = $input.item.json.id
name = $input.item.json.column.title

const linkedPulseID = JSON.parse(data).linkedPulseIds

return { \"linkedPulse\": linkedPulseID, \"id\" : id, \"name\": name }
"
      },
      "typeVersion": 2
    },
    {
      "id": "5dbe451d-ec23-48bf-9193-55a03b8752a4",
      "name": "SPLIT LINKED PULSES1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1540,
        -40
      ],
      "parameters": {
        "include": "=",
        "options": {},
        "fieldToSplitOut": "linkedPulse"
      },
      "typeVersion": 1
    },
    {
      "id": "536897b1-ed71-4888-9761-cb4a363f0a86",
      "name": "SPLIT SUBITEMS1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1540,
        200
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "linkedPulseIds",
        "fieldsToInclude": "linkedPulseIds[0].linkedPulseId"
      },
      "typeVersion": 1
    },
    {
      "id": "57777d0c-77d0-4652-a798-2d347b12cfb4",
      "name": "GET EACH SUBITEM1",
      "type": "n8n-nodes-base.mondayCom",
      "position": [
        1700,
        200
      ],
      "parameters": {
        "itemId": "=
{{ $json.linkedPulseIds.linkedPulseId }}",
        "resource": "boardItem",
        "operation": "get"
      },
      "credentials": {
        "mondayComApi": {
          "id": "5nd48DKapWBLcUBx",
          "name": "Monday.com account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "1a7574db-16bb-4d69-b91f-33b20e52c794",
      "name": "GET ALL COLUMNS1",
      "type": "n8n-nodes-base.code",
      "position": [
        1880,
        200
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "function createColumnValuesArray(data) {
  const result = {};
  data.forEach(item => {
    const name = item.id;
    result[name] = item;
  });

  return result;
}

columns = $input.item.json.column_values
data1 = { \"name\" : $input.item.json.name, \"id\" : $input.item.json.id }
data2 = createColumnValuesArray(columns)

const combinedData = { ...data1, ...data2 }

return (combinedData)


"
      },
      "typeVersion": 2
    },
    {
      "id": "ba95aef3-49b3-4a3e-a5fd-51ec04691949",
      "name": "GET ALL COLUMNS2",
      "type": "n8n-nodes-base.code",
      "position": [
        1840,
        -420
      ],
      "parameters": {
        "jsCode": "function createColumnValuesArray(data) {
  const result = {};
  data.forEach(item => {
  if (item.type != \"subtasks\") {
    const name = item.column.title;
    result[name] = item;
  }
  });

  return result;
}

columns = $input.last().json.column_values
data = createColumnValuesArray(columns)
return {\"columnValuesByName\": data}


"
      },
      "typeVersion": 2
    },
    {
      "id": "8c475537-efe6-4417-b293-e47abe817f7a",
      "name": "Aggregate1",
      "type": "n8n-nodes-base.aggregate",
      "onError": "continueRegularOutput",
      "position": [
        2180,
        100
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "subitems"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "f96f5fb7-1701-4cf4-b572-2ed3d8376232",
      "name": "PULL SUBITEMS",
      "type": "n8n-nodes-base.code",
      "position": [
        1320,
        200
      ],
      "parameters": {
        "jsCode": "//Search for \"Subitems\" column
const columnName = \"Subitems\"
function getColumnValue(item, columnId) {
    const column = item.column_values.find(column => column.column.title === columnId);
    if (column) {
          return column
    } else {
        return null;
    }
}
const columnValue = getColumnValue($input.last().json, columnName);
return JSON.parse(columnValue.value);

//ALT OPTION - direct access by column_values[0]
//var ids = $input.last().json['column_values'][0]['value'];
//return JSON.parse(ids)"
      },
      "typeVersion": 2
    },
    {
      "id": "aa96e7e9-6c2a-46d4-95af-124609a7b524",
      "name": "GET ITEM",
      "type": "n8n-nodes-base.mondayCom",
      "position": [
        1180,
        -600
      ],
      "parameters": {
        "itemId": "=
{{ $input.item.json.pulse }}",
        "resource": "boardItem",
        "operation": "get"
      },
      "credentials": {
        "mondayComApi": {
          "id": "5nd48DKapWBLcUBx",
          "name": "Monday.com account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "da23cad1-77f9-4035-8ad3-b322dadba853",
      "name": "GET ALL COLUMNS3",
      "type": "n8n-nodes-base.code",
      "position": [
        1880,
        -40
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "function createColumnValuesArray(data) {
  const result = {};
  data.forEach(item => {
    const name = item.id;
    result[name] = item;
  });

  return result;
}

columns = $input.item.json.column_values
data1 = { \"name\" : $input.item.json.name, \"id\" : $input.item.json.id }
data2 = createColumnValuesArray(columns)

const combinedData = { \"item\" : data1, columnValuesById: data2}

return (combinedData)


"
      },
      "typeVersion": 2
    },
    {
      "id": "9c27b7af-2568-4b07-b526-9c18ca52649f",
      "name": "Merge4",
      "type": "n8n-nodes-base.merge",
      "position": [
        2180,
        -100
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "6f0008fd-b8f5-4161-8fbf-363b3d5a7794",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "onError": "continueRegularOutput",
      "position": [
        2340,
        -100
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "boardrelations"
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "d95b1e2a-405e-417b-8618-89af85b10350",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "onError": "continueRegularOutput",
      "position": [
        2540,
        0
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "e9d7977d-1fd3-4be8-ad90-b42a93bc1ea4",
      "name": "Merge2",
      "type": "n8n-nodes-base.merge",
      "onError": "continueRegularOutput",
      "position": [
        2480,
        -240
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "72e04613-f953-49b0-ad13-4bd5464cc55e",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2680,
        -160
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combinationMode": "mergeByPosition"
      },
      "typeVersion": 2.1
    },
    {
      "id": "0846e8ee-8b58-40c2-8d3f-1e33f519bf55",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        980,
        -600
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1c753c05-3541-4579-a815-b3465f26d51c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        -240
      ],
      "parameters": {
        "width": 752.1995067108865,
        "height": 335.74971164936585,
        "content": "PULL ALL BOARDRELATION COLUMNS AND THEIR DATA"
      },
      "typeVersion": 1
    },
    {
      "id": "79c61e1f-6cbf-45ca-b0d3-31250fb7be18",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1300,
        120
      ],
      "parameters": {
        "width": 748.2468880082052,
        "height": 237.44804034647325,
        "content": "PULL ALL SUBITEMS AND THEIR COLUMN DATA
"
      },
      "typeVersion": 1
    },
    {
      "id": "b5da95d7-d0d8-4ad1-ab93-e06e6c823ed2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1720,
        -640
      ],
      "parameters": {
        "color": 4,
        "width": 325.58246828143024,
        "height": 352.5605536332179,
        "content": "PULL ALL COLUMN DATA AND INDEX BY ID AND NAME
"
      },
      "typeVersion": 1
    },
    {
      "id": "02125cbf-aa28-4cf1-a0ef-cf3cf45e76c2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2140,
        -298.05978270268713
      ],
      "parameters": {
        "color": 5,
        "width": 677.0818915801614,
        "height": 605.5742002344051,
        "content": "COMBINE ALL DATA INTO ONE JSON OUTPUT
"
      },
      "typeVersion": 1
    },
    {
      "id": "e96deeef-6fb5-4130-b422-752e0e0dc9c5",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1180,
        -780
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": true
        },
        "workflowId": "ZdGZh4qmOqTQe1oq"
      },
      "typeVersion": 1
    },
    {
      "id": "955d8a6e-931c-411f-a26a-17f547370fd9",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        980,
        -780
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "pulse",
              "stringValue": "4030768878"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "f508d0cd-448c-482e-9eeb-d569f26dbaab",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        940,
        -920
      ],
      "parameters": {
        "color": 6,
        "width": 418.4714893828877,
        "height": 302.08861782546296,
        "content": "HOW TO USE
-Copy these nodes into another workflow, and update the workflow id in the execute workflow node
-Using the Edit Fields nodes, define the “pulse” variable which will tell the workflow which monday item to pull data from.
"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "dd22e2e2-0699-41d1-b6ad-001073624540",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge2": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge4": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET ITEM": {
      "main": [
        [
          {
            "node": "GET ALL COLUMNS",
            "type": "main",
            "index": 0
          },
          {
            "node": "GET ALL COLUMNS2",
            "type": "main",
            "index": 0
          },
          {
            "node": "PULL SUBITEMS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PULL SUBITEMS": {
      "main": [
        [
          {
            "node": "SPLIT SUBITEMS1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET ALL COLUMNS": {
      "main": [
        [
          {
            "node": "GET ALL RELATIONS",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SPLIT SUBITEMS1": {
      "main": [
        [
          {
            "node": "GET EACH SUBITEM1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET ALL COLUMNS1": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET ALL COLUMNS2": {
      "main": [
        [
          {
            "node": "Merge2",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "GET ALL COLUMNS3": {
      "main": [
        [
          {
            "node": "Merge4",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "GET ALL RELATIONS": {
      "main": [
        [
          {
            "node": "GET LINKEDPULSES1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET EACH SUBITEM1": {
      "main": [
        [
          {
            "node": "GET ALL COLUMNS1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET LINKEDPULSES1": {
      "main": [
        [
          {
            "node": "SPLIT LINKED PULSES1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PULL LINKEDPULSE1": {
      "main": [
        [
          {
            "node": "GET ALL COLUMNS3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SPLIT LINKED PULSES1": {
      "main": [
        [
          {
            "node": "PULL LINKEDPULSE1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "GET ITEM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

功能特点

  • 自动检测新邮件
  • AI智能内容分析
  • 自定义分类规则
  • 批量处理能力
  • 详细的处理日志

技术分析

节点类型及作用

  • Code
  • Mondaycom
  • Splitout
  • Aggregate
  • Merge

复杂度评估

配置难度:
★★★★☆
维护难度:
★★☆☆☆
扩展性:
★★★★☆

实施指南

前置条件

  • 有效的Gmail账户
  • n8n平台访问权限
  • Google API凭证
  • AI分类服务订阅

配置步骤

  1. 在n8n中导入工作流JSON文件
  2. 配置Gmail节点的认证信息
  3. 设置AI分类器的API密钥
  4. 自定义分类规则和标签映射
  5. 测试工作流执行
  6. 配置定时触发器(可选)

关键参数

参数名称 默认值 说明
maxEmails 50 单次处理的最大邮件数量
confidenceThreshold 0.8 分类置信度阈值
autoLabel true 是否自动添加标签

最佳实践

优化建议

  • 定期更新AI分类模型以提高准确性
  • 根据邮件量调整处理批次大小
  • 设置合理的分类置信度阈值
  • 定期清理过期的分类规则

安全注意事项

  • 妥善保管API密钥和认证信息
  • 限制工作流的访问权限
  • 定期审查处理日志
  • 启用双因素认证保护Gmail账户

性能优化

  • 使用增量处理减少重复工作
  • 缓存频繁访问的数据
  • 并行处理多个邮件分类任务
  • 监控系统资源使用情况

故障排除

常见问题

邮件未被正确分类

检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。

Gmail认证失败

确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。

调试技巧

  • 启用详细日志记录查看每个步骤的执行情况
  • 使用测试邮件验证分类逻辑
  • 检查网络连接和API服务状态
  • 逐步执行工作流定位问题节点

错误处理

工作流包含以下错误处理机制:

  • 网络超时自动重试(最多3次)
  • API错误记录和告警
  • 处理失败邮件的隔离机制
  • 异常情况下的回滚操作