{
  "name": "Gmail campaign sender: Bulk-send emails and follow up automatically if no reply",
  "nodes": [
    {
      "id": "8565747a-4108-4467-98e4-f57d441f66af",
      "name": "Update last contacted time",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2380,
        140
      ]
    },
    {
      "id": "5f079ac7-1bef-4bb8-8efe-1f3803357fb1",
      "name": "Set message template",
      "type": "n8n-nodes-base.set",
      "position": [
        1500,
        1120
      ]
    },
    {
      "id": "7ff4eabc-f49a-4adc-9a4b-750585b72070",
      "name": "Email sequence",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        140
      ]
    },
    {
      "id": "7b038199-cf02-4536-a351-b86d51b0d367",
      "name": "Fill message placeholders",
      "type": "n8n-nodes-base.code",
      "position": [
        1720,
        1120
      ]
    },
    {
      "id": "42fe4448-1a44-47aa-a04b-927d441b265a",
      "name": "Compose message",
      "type": "n8n-nodes-base.set",
      "position": [
        1940,
        1120
      ]
    },
    {
      "id": "bccf2e89-852e-49b4-ad98-194008c47760",
      "name": "Get previous message threads",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1280,
        620
      ]
    },
    {
      "id": "3ce6c45f-a257-4270-a84d-6a19ec35b2eb",
      "name": "Get thread details",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1500,
        620
      ]
    },
    {
      "id": "9224bb16-fbc2-45b5-a2cb-f63cb440f46f",
      "name": "Classify threads",
      "type": "n8n-nodes-base.code",
      "position": [
        1940,
        620
      ]
    },
    {
      "id": "776cb743-339d-49f6-af3c-9ae2b464d01a",
      "name": "Next message due?",
      "type": "n8n-nodes-base.filter",
      "position": [
        2160,
        620
      ]
    },
    {
      "id": "2ecf68b5-f5bf-4961-a849-7c0d29940387",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1906,
        427
      ],
      "parameters": {
        "width": 181.66573318934627,
        "height": 344.96230939963334,
        "content": "Follow-up is due if:\n- All the messages in the thread are automated (no-one has replied yet)\n- Enough time has passed for the next message to be sent"
      }
    },
    {
      "id": "a3a78abb-0691-4152-a349-658b8286df2f",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        1280,
        1120
      ]
    },
    {
      "id": "a62bff23-2742-4a5e-8896-e1a3be5915fd",
      "name": "Replying?",
      "type": "n8n-nodes-base.if",
      "position": [
        2160,
        1120
      ]
    },
    {
      "id": "76d25df2-4472-40a6-80c6-f2e3dc8702a3",
      "name": "Send new message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2380,
        1240
      ]
    },
    {
      "id": "ceefaf78-28b8-4711-b50e-b5487862dba6",
      "name": "Call message send sub-workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        2820,
        620
      ]
    },
    {
      "id": "809e9df8-881a-4b32-a3c0-e55c669bd8d1",
      "name": "Prepare reply params",
      "type": "n8n-nodes-base.set",
      "position": [
        2380,
        620
      ]
    },
    {
      "id": "cdda96f1-e0a2-4ce8-bc78-da8e80f7029f",
      "name": "Prepare first message params",
      "type": "n8n-nodes-base.set",
      "position": [
        1720,
        140
      ]
    },
    {
      "id": "c2d9869e-0608-472a-a124-26e9e6f1820a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        -100
      ],
      "parameters": {
        "width": 181.66573318934627,
        "height": 410.4105111871959,
        "content": "Columns the sheet needs\n- email\n- first_emailed (leave blank - will be filled in automatically)\n- Other columns matching placeholders in email sequence"
      }
    },
    {
      "id": "26bc2c58-fea5-4ee0-b9ea-264ad00e8d32",
      "name": "Call message send sub-workflow1",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        2160,
        140
      ]
    },
    {
      "id": "e7e7d9bd-79c6-4534-b88d-b54cc695c7bf",
      "name": "To email?",
      "type": "n8n-nodes-base.filter",
      "position": [
        1500,
        140
      ]
    },
    {
      "id": "db4b6481-5fdb-4bc3-a10f-b6ccfb5b0bf0",
      "name": "Decode messages",
      "type": "n8n-nodes-base.code",
      "position": [
        1720,
        620
      ]
    },
    {
      "id": "fc4868f0-845d-4f76-a566-b0db3d2676f8",
      "name": "Decode placeholder values",
      "type": "n8n-nodes-base.code",
      "position": [
        2600,
        620
      ]
    },
    {
      "id": "5af9b08e-6c5d-4701-a44a-794e96216948",
      "name": "Package placeholder values",
      "type": "n8n-nodes-base.code",
      "position": [
        1940,
        140
      ]
    },
    {
      "id": "e655a9c2-617b-4119-9582-45f1db2cc6d2",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        140
      ]
    },
    {
      "id": "a8975f91-6413-448b-bc3f-1084959b8b31",
      "name": "Reply to message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2380,
        1020
      ]
    },
    {
      "id": "d453661e-25f7-471c-90dc-633270f14396",
      "name": "Get emails",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1280,
        140
      ]
    },
    {
      "id": "7a838728-38e1-45f9-8bac-19c6ad005a38",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        -180
      ],
      "parameters": {
        "width": 1790.5345476157208,
        "height": 515.1374038700677,
        "content": "## Send initial emails"
      }
    },
    {
      "id": "5d8823c1-00a7-43a2-963d-90e971167ef8",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        360
      ],
      "parameters": {
        "width": 1797.4980261229769,
        "height": 515.1374038700677,
        "content": "## Send follow-up emails if appropriate"
      }
    },
    {
      "id": "fd2bb0b2-a313-45ed-ad58-935d803237e5",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        920
      ],
      "parameters": {
        "width": 1797.4980261229769,
        "height": 515.1374038700677,
        "content": "## Sub-workflow for sending the emails\nThis is called by the sections above - you shouldn't need to touch it"
      }
    },
    {
      "id": "be4a4bbb-1e10-4c9e-afb9-cc4a46a78113",
      "name": "Every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        320,
        140
      ]
    },
    {
      "id": "be582e38-6da2-4c64-8804-981936f71d88",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2120,
        958
      ],
      "parameters": {
        "width": 181.66573318934627,
        "height": 306.5470605243249,
        "content": "If reply_message_id is set, will reply to that message.\n\nOtherwise, will send a new message to the user in the 'email' field"
      }
    },
    {
      "id": "88e9ff03-62f0-4dcf-9e28-62c95386df66",
      "name": "Don't email on weekends",
      "type": "n8n-nodes-base.filter",
      "position": [
        540,
        140
      ]
    },
    {
      "id": "7a5822f3-b2ea-42d7-8034-21a92e283112",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -120
      ],
      "parameters": {
        "width": 404.04123613412946,
        "height": 418.96364526464185,
        "content": "# Try me out\n1. Clone [this Google worksheet](https://docs.google.com/spreadsheets/d/12dsbRpvtVFDdPmyZ7-39vuHuFpM1eMyfOqGGGdsnrtc/edit#gid=0) and update the 'Settings' node with its URL (plus change a"
      }
    }
  ],
  "connections": {
    "Settings": {
      "main": [
        [
          {
            "node": "Email sequence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replying?": {
      "main": [
        [
          {
            "node": "Reply to message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send new message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "To email?": {
      "main": [
        [
          {
            "node": "Prepare first message params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every hour": {
      "main": [
        [
          {
            "node": "Don't email on weekends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get emails": {
      "main": [
        [
          {
            "node": "To email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email sequence": {
      "main": [
        [
          {
            "node": "Get previous message threads",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compose message": {
      "main": [
        [
          {
            "node": "Replying?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decode messages": {
      "main": [
        [
          {
            "node": "Classify threads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify threads": {
      "main": [
        [
          {
            "node": "Next message due?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Next message due?": {
      "main": [
        [
          {
            "node": "Prepare reply params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get thread details": {
      "main": [
        [
          {
            "node": "Decode messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare reply params": {
      "main": [
        [
          {
            "node": "Decode placeholder values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set message template": {
      "main": [
        [
          {
            "node": "Fill message placeholders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Don't email on weekends": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Set message template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decode placeholder values": {
      "main": [
        [
          {
            "node": "Call message send sub-workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fill message placeholders": {
      "main": [
        [
          {
            "node": "Compose message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Package placeholder values": {
      "main": [
        [
          {
            "node": "Call message send sub-workflow1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get previous message threads": {
      "main": [
        [
          {
            "node": "Get thread details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare first message params": {
      "main": [
        [
          {
            "node": "Package placeholder values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call message send sub-workflow1": {
      "main": [
        [
          {
            "node": "Update last contacted time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}