{
  "name": "Flag bounced emails in Google Sheets from Gmail delivery error messages",
  "nodes": [
    {
      "id": "9963c9a2-ace8-4de9-b9ba-45f82713bf4a",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -944,
        -48
      ]
    },
    {
      "id": "54d5fbd7-5932-4994-ab52-bbffddbf3de8",
      "name": "geterremail",
      "type": "n8n-nodes-base.code",
      "position": [
        -928,
        208
      ]
    },
    {
      "id": "3c6df588-89dd-4e85-9ee9-cc2793bd4cf3",
      "name": "listerremail",
      "type": "n8n-nodes-base.set",
      "position": [
        -704,
        208
      ]
    },
    {
      "id": "d700ab34-e7da-4336-b6c7-4e4c303ad5ec",
      "name": "readspamfolder",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -496,
        -48
      ]
    },
    {
      "id": "fd3634df-d31a-450c-ac7a-4db633f569d4",
      "name": "undelivered_failure",
      "type": "n8n-nodes-base.if",
      "position": [
        -272,
        -48
      ]
    },
    {
      "id": "34c8eeb3-760a-43cc-8d7d-ccea4689af63",
      "name": "lookupemail",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -480,
        208
      ]
    },
    {
      "id": "17af022f-0c5f-47f6-b5ef-bd6df05d7952",
      "name": "update_err",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -32,
        208
      ]
    },
    {
      "id": "565a47a3-80cc-418f-8862-7ed07c58fdd0",
      "name": "keep_row",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        208
      ]
    },
    {
      "id": "ef72cddc-e32f-4e46-bf41-c57b1a0c98a8",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        -176
      ],
      "parameters": {
        "width": 656,
        "height": 1024,
        "content": "# Scanning Email Inbox for Delivery Errors\n\n**Prerequisite:** [Automate Personalized Email Campaigns with Google Docs, Sheets, and SMTP](https://n8n.io/workflows/7065-automate-personalized-email-campa"
      }
    },
    {
      "id": "8c0840f2-3731-4b02-a92d-e80fe6cf99d3",
      "name": "settings",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        -48
      ]
    },
    {
      "id": "62510cba-702f-4e0e-9462-64cd2d22338c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -160
      ],
      "parameters": {
        "width": 192,
        "height": 96,
        "content": "Define the Google  Sheet ID used in this [Workflow](https://n8n.io/workflows/7065-automate-personalized-email-campaigns-with-google-docs-sheets-and-smtp/)"
      }
    },
    {
      "id": "9ce3155f-1cf5-4457-83a4-e9bab7315aba",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -160
      ],
      "parameters": {
        "width": 192,
        "height": 96,
        "content": "Read the folder (Gmail SPAM here), with Mail Delivery issues"
      }
    },
    {
      "id": "3fe9243f-5a5e-484b-8a13-8bdb658282d8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -160
      ],
      "parameters": {
        "width": 192,
        "height": 96,
        "content": "Identify Subject containing \"Undelivered\" or \"Failure\""
      }
    },
    {
      "id": "1fb775c5-aa90-45d0-9826-a24ba430268f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        368
      ],
      "parameters": {
        "width": 192,
        "height": 112,
        "content": "Extract the \"email\" from the body message. Unduplication to be sure you get one unique email"
      }
    },
    {
      "id": "1f1bec65-c428-4c72-a141-d748a6b11498",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        368
      ],
      "parameters": {
        "width": 192,
        "height": 288,
        "content": "Find the Row Number in the Google  Sheet ID used by this previous [Workflow](https://n8n.io/workflows/7065-automate-personalized-email-campaigns-with-google-docs-sheets-and-smtp/)\n\nThe `email` column "
      }
    },
    {
      "id": "2e050778-b76f-4497-b42f-dee1d9a55e13",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        368
      ],
      "parameters": {
        "width": 192,
        "height": 112,
        "content": "For debugging. To show the emails in error"
      }
    },
    {
      "id": "8d635eba-7666-4c70-96d4-1acf02a42728",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        368
      ],
      "parameters": {
        "width": 192,
        "height": 112,
        "content": "For debugging. To show the \"Row Number\" we are going to update in the Google Sheet\n"
      }
    },
    {
      "id": "ecd8fd66-a6b2-4a25-b070-218af8bd0df0",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        368
      ],
      "parameters": {
        "width": 192,
        "height": 224,
        "content": "Update the Google Sheet and set err = \"Y\"\n\n`row_number` (using to match)\n\n`{{ $('lookupemail').item.json.row_number }}`"
      }
    }
  ],
  "connections": {
    "keep_row": {
      "main": [
        [
          {
            "node": "update_err",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "settings": {
      "main": [
        [
          {
            "node": "readspamfolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "geterremail": {
      "main": [
        [
          {
            "node": "listerremail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "lookupemail": {
      "main": [
        [
          {
            "node": "keep_row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "listerremail": {
      "main": [
        [
          {
            "node": "lookupemail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "readspamfolder": {
      "main": [
        [
          {
            "node": "undelivered_failure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "undelivered_failure": {
      "main": [
        [
          {
            "node": "geterremail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}