8
n8n 中文网amn8n.com

将带标签的邮件发送到Notion数据库

初级

这是一个Building Blocks领域的自动化工作流,包含 0 个节点。 将带标签的邮件发送到Notion数据库

前置要求
  • 无特殊前置要求,导入即可使用

使用的节点 (0)

没有找到匹配的工作流
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "a2434c94d549548a685cca39cc4614698e94f527bcea84eefa363f1037ae14cd"
  },
  "nodes": [
    {
      "id": "0bacf032-53d6-4ba6-ab71-e01625c49cc4",
      "name": "按计划",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1960,
        160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 1
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "2e0d9aef-0a60-4506-9c11-c6c2cccb16ea",
      "name": "推导上次请求时间",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        -1740,
        160
      ],
      "parameters": {
        "duration": 1,
        "timeUnit": "minutes",
        "magnitude": "={{ $json.timestamp }}",
        "operation": "subtractFromDate",
        "outputFieldName": "last_request_time"
      },
      "typeVersion": 2
    },
    {
      "id": "f726c448-b4c4-4159-8ca5-c94c092127b7",
      "name": "从标签和上次请求时间获取电子邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1520,
        160
      ],
      "parameters": {
        "filters": {
          "labelIds": [
            "Label_9178764513576607415"
          ]
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "31",
          "name": "REPLACE ME"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9b86331f-d33b-4266-ba34-bc0491a0da24",
      "name": "创建数据库页面",
      "type": "n8n-nodes-base.notion",
      "position": [
        -620,
        60
      ],
      "parameters": {
        "title": "={{ $('If database page not found').item.json.Subject }}",
        "blockUi": {
          "blockValues": [
            {
              "type": "heading_3",
              "textContent": "Snippet"
            },
            {
              "textContent": "={{ $('If database page not found').item.json.snippet }}"
            },
            {
              "text": {
                "text": [
                  {
                    "text": "See more",
                    "isLink": true,
                    "textLink": "=https://mail.google.com/mail/u/{{ $json.emailAddress }}/#all/{{ $('If database page not found').item.json.id }}",
                    "annotationUi": {}
                  }
                ]
              },
              "richText": true
            }
          ]
        },
        "options": {
          "icon": "https://avatars.githubusercontent.com/u/45487711?s=280&v=4",
          "iconType": "file"
        },
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "e606a7c1-e93d-47fd-8b8d-8000cd6e7522",
          "cachedResultUrl": "https://www.notion.so/e606a7c1e93d47fd8b8d8000cd6e7522",
          "cachedResultName": "Gmail"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Thread ID|rich_text",
              "textContent": "={{ $('If database page not found').item.json.id }}"
            },
            {
              "key": "Email thread|url",
              "urlValue": "=https://mail.google.com/mail/u/{{ $json.emailAddress }}/#all/{{ $('If database page not found').item.json.id }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "18",
          "name": "[UPDATE ME]"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "d7198578-4c83-4f57-8eba-5b5a9b89195c",
      "name": "尝试获取数据库页面",
      "type": "n8n-nodes-base.notion",
      "position": [
        -1360,
        220
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Thread ID|rich_text",
              "condition": "equals",
              "richTextValue": "={{ $json.id }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "e606a7c1-e93d-47fd-8b8d-8000cd6e7522",
          "cachedResultUrl": "https://www.notion.so/e606a7c1e93d47fd8b8d8000cd6e7522",
          "cachedResultName": "My Gmail Tasks"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "id": "18",
          "name": "[UPDATE ME]"
        }
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "f8188ab9-9a80-4aa9-b773-73cd90b8dbd3",
      "name": "如果已勾选",
      "type": "n8n-nodes-base.if",
      "position": [
        -1740,
        460
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.Complete }}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bfcfeeb1-ad8b-47fb-8a09-b58e7b649a25",
      "name": "在更新数据库页面时",
      "type": "n8n-nodes-base.notionTrigger",
      "position": [
        -1960,
        460
      ],
      "parameters": {
        "event": "pagedUpdatedInDatabase",
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "e606a7c1-e93d-47fd-8b8d-8000cd6e7522",
          "cachedResultUrl": "https://www.notion.so/e606a7c1e93d47fd8b8d8000cd6e7522",
          "cachedResultName": "My Gmail Tasks"
        }
      },
      "credentials": {
        "notionApi": {
          "id": "18",
          "name": "[UPDATE ME]"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc2c59b8-6e0d-46b3-946a-e48b0461c48f",
      "name": "从目标电子邮件移除标签",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1520,
        460
      ],
      "parameters": {
        "labelIds": [
          "Label_9178764513576607415"
        ],
        "messageId": "={{ $json['Thread ID'] }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "31",
          "name": "REPLACE ME"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0f693c2f-ce89-4a2f-a85f-9230b7bcb94d",
      "name": "尚未勾选,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1520,
        660
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bf792470-fc0a-45a2-b655-df5c977faa97",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1220,
        100
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "enrichInput1",
        "mergeByFields": {
          "values": [
            {
              "field1": "id",
              "field2": "property_thread_id"
            }
          ]
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f910c34c-4c3d-481f-8223-a8aae710dbbd",
      "name": "如果找到,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -840,
        260
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7086cd15-9f2e-40e4-be3b-47d117dde670",
      "name": "如果数据库页面未找到",
      "type": "n8n-nodes-base.if",
      "position": [
        -1060,
        160
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.property_thread_id }}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "86ce380c-0810-4edb-94e4-fb67b0ca422c",
      "name": "查找我的电子邮件地址",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -840,
        60
      ],
      "parameters": {
        "url": "https://gmail.googleapis.com/gmail/v1/users/me/profile",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "gmailOAuth2"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "31",
          "name": "REPLACE ME"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "f576f785-49e4-4ed2-b83e-400b001b6c3a",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2540,
        100
      ],
      "parameters": {
        "width": 501.0810810810809,
        "height": 545.405405405404,
        "content": "## 将带标签的电子邮件发送到 Notion 数据库"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "If database page not found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On schedule": {
      "main": [
        [
          {
            "node": "Derive last request time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If checked off": {
      "main": [
        [
          {
            "node": "Remove label from target email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not yet checked off, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find my email address": {
      "main": [
        [
          {
            "node": "Create database page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Try get database page": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Derive last request time": {
      "main": [
        [
          {
            "node": "Get emails from label and last request time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On updated database page": {
      "main": [
        [
          {
            "node": "If checked off",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If database page not found": {
      "main": [
        [
          {
            "node": "Find my email address",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If found, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get emails from label and last request time": {
      "main": [
        [
          {
            "node": "Try get database page",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

初级 - 构建模块

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
初级
节点数量0
分类1
节点类型0
难度说明

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
n8n Team

n8n Team

@n8n-team

Meet the official n8n team. We specialize in building workflows that transform intricate tasks into seamless operations.

外部链接
在 n8n.io 查看

分享此工作流