Gmail の受信箱メールを自動アーカイブ

中級

これはOther分野の自動化ワークフローで、10個のノードを含みます。主にGmail, Filter, ItemLists, ScheduleTriggerなどのノードを使用。 Gmailの受信トレイを自動アーカイブ

前提条件
  • Googleアカウント + Gmail API認証情報

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "nodes": [
    {
      "id": "b1afd02d-6edf-4540-bf32-09d87cb8a27b",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        220
      ],
      "parameters": {
        "color": 5,
        "width": 379,
        "height": 80,
        "content": "### 👨‍🎤 Setup\n1. Add your Gmail creds"
      },
      "typeVersion": 1
    },
    {
      "id": "3481e6c3-7706-4c7f-8ca6-c96f76d82021",
      "name": "平日毎日深夜",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        400,
        340
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 0 * * 1-5"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3c74e4fd-e919-4acb-8092-658f2e71513b",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        520
      ],
      "parameters": {
        "color": 7,
        "width": 202,
        "height": 100,
        "content": "👆 Set your schedule. I use this for work emails. For personal emails, I run this daily."
      },
      "typeVersion": 1
    },
    {
      "id": "de421702-d012-4ea1-826e-1a4756ff4856",
      "name": "過去1日間の全メールを取得",
      "type": "n8n-nodes-base.gmail",
      "position": [
        620,
        340
      ],
      "parameters": {
        "filters": {
          "q": "label:inbox",
          "receivedBefore": "={{ $now.minus({days: 1}) }}"
        },
        "resource": "thread",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "8",
          "name": "Work Gmail account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "ef43b756-5f9c-4c8d-830a-8ccb71562618",
      "name": "各メールのスレッドを取得",
      "type": "n8n-nodes-base.gmail",
      "position": [
        840,
        340
      ],
      "parameters": {
        "options": {},
        "resource": "thread",
        "threadId": "={{ $json.id }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "8",
          "name": "Work Gmail account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "bfc3b7e1-651a-4eb5-8882-b21d120d982b",
      "name": "受信トレイ内のスター付きメールのみを保持",
      "type": "n8n-nodes-base.filter",
      "position": [
        1060,
        340
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ JSON.stringify($json.messages).includes('STARRED') }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3d8145dc-577d-4e9b-83a7-fdf06afa1b96",
      "name": "スレッド内の各メッセージについて",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        1480,
        520
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "messages"
      },
      "typeVersion": 2
    },
    {
      "id": "1a9083a8-ffd2-403e-bf53-9b9eee87ff5b",
      "name": "メッセージをアーカイブ(受信トレイから削除)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1700,
        520
      ],
      "parameters": {
        "labelIds": "=INBOX",
        "messageId": "={{ $json.id }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "8",
          "name": "Work Gmail account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "c51240d0-88cb-461b-82ba-929a2d8a9dde",
      "name": "スレッドをアーカイブ(受信トレイから削除)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1340,
        300
      ],
      "parameters": {
        "labelIds": "=INBOX",
        "resource": "thread",
        "threadId": "={{ $json.id }}",
        "operation": "removeLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "8",
          "name": "Work Gmail account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 2
    },
    {
      "id": "3ca7074f-c912-456c-92e4-08cac8833471",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        520
      ],
      "parameters": {
        "color": 7,
        "width": 202,
        "height": 100,
        "content": "⭐ Keep starred emails in inbox.. Archive everything else!"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "3481e6c3-7706-4c7f-8ca6-c96f76d82021": {
      "main": [
        [
          {
            "node": "de421702-d012-4ea1-826e-1a4756ff4856",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ef43b756-5f9c-4c8d-830a-8ccb71562618": {
      "main": [
        [
          {
            "node": "bfc3b7e1-651a-4eb5-8882-b21d120d982b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de421702-d012-4ea1-826e-1a4756ff4856": {
      "main": [
        [
          {
            "node": "ef43b756-5f9c-4c8d-830a-8ccb71562618",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3d8145dc-577d-4e9b-83a7-fdf06afa1b96": {
      "main": [
        [
          {
            "node": "1a9083a8-ffd2-403e-bf53-9b9eee87ff5b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bfc3b7e1-651a-4eb5-8882-b21d120d982b": {
      "main": [
        [
          {
            "node": "c51240d0-88cb-461b-82ba-929a2d8a9dde",
            "type": "main",
            "index": 0
          },
          {
            "node": "3d8145dc-577d-4e9b-83a7-fdf06afa1b96",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - その他

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数10
カテゴリー1
ノードタイプ5
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34