{
  "id": "Lx5RGx7x7i0Jbmvw",
  "name": "AI-Driven Campaign Email Automation",
  "tags": [],
  "nodes": [
    {
      "id": "4da9096f-6c08-48c1-b605-912a330ab2c9",
      "name": "Every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -208,
        64
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "ddb84f23-62fe-4c74-be01-4247bd7cd31d",
      "name": "Don't email on weekends",
      "type": "n8n-nodes-base.filter",
      "position": [
        -16,
        816
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "421b64fa-c831-4185-9263-ab6c5230e8b9",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1216,
        736
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "a89b2bd4-3bb2-412d-87d1-e3fa58da2f3b",
      "name": "Get histories",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        752,
        816
      ],
      "parameters": {},
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "e8aecf67-fdb3-41f3-a77a-344c09d57687",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        816
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "d04556be-b3b0-4843-9c7f-506923eb1a0f",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        656,
        64
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "a9750fc5-a356-41ce-8703-5a93f150369b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "40e6c795-6d5c-4128-9aa0-5493fd7666e5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1bc15a17-be24-41b8-b7b5-3125e9c357aa",
      "name": "Customer information",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        64
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "14d24b94-3e3c-49ea-9564-f74e077f661f",
      "name": "Convert to JSON object",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        64
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "cd549a4c-d3b1-4340-924a-cd97d3d5bd7b",
      "name": "OpenAI Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        656,
        272
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "8e2f151c-6c7c-467d-b07f-646b5e48f55a",
      "name": "OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1216,
        976
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "2e5c75b4-a7a7-40dc-91a9-a5aa6009f4a4",
      "name": "Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -208,
        816
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "c6ff9b4c-c991-47c3-8b29-9a5253f1230b",
      "name": "Update Campaign",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1664,
        1024
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f639371a-1c5e-4e45-8032-5c73a313a97d",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1856,
        736
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "0b3e9e37-b59e-457c-928b-1b2815220997",
      "name": "Convert to JSON object1",
      "type": "n8n-nodes-base.code",
      "position": [
        1648,
        736
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "2584e764-ded0-46cb-9a1d-2c888f39f7d3",
      "name": "Filter customer",
      "type": "n8n-nodes-base.filter",
      "position": [
        592,
        816
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "b0654632-9188-453a-aa6e-076cf0052bb6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c9517c3e-df2f-49a6-874b-59395aa0131b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "46c557e9-3f00-4f6a-a197-1fa28804fbf8",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d3b9ce97-ffd3-42fe-9dcc-212cd0d423b3",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1568,
        944
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ff170ba5-2ef4-41e8-890f-11e1927cd79c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1568,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1b5ba18f-1394-43c7-8c16-2bbd711290ab",
      "name": "Get new campaign",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        176,
        816
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "de48f2e2-98b9-49d6-b1ac-01b1acab1fee",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -208,
        1584
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "071ea811-ad80-4917-ac98-984390f0b0db",
      "name": "Convert to JSON object2",
      "type": "n8n-nodes-base.code",
      "position": [
        1024,
        1584
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "f9f84f12-8d0b-4843-aafe-8d5707ff8407",
      "name": "Reply to a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1280,
        1680
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "898af04d-33cc-45e2-929e-a1d764d11283",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        1392
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "af46b57f-be47-42d7-9290-b1e9ef350f27",
      "name": "Get message histories",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        0,
        1584
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0dba3765-048c-42c5-b9b6-3036738e8fc3",
      "name": "Update customer's reply",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        272,
        1584
      ],
      "parameters": {},
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "12d770da-cc41-4222-9df9-7bae9817f2fd",
      "name": "reply to customer",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        640,
        1584
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "6c6a16a1-62fd-4f10-8a7a-c59113f7ae2e",
      "name": "Insert new mesage",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1280,
        1536
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c56e9beb-7c1e-4412-b7bc-be42119aafda",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        1392
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3f107765-b7e6-4730-8afc-ae00f9923413",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        1392
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b2d065c2-6b45-4b7b-baa8-ba85e1e628f9",
      "name": "Get campaign",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        256
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "1ff29183-a896-405c-a405-5fe02c6931e3",
      "name": "Insert new campaign",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        384,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "757c94bd-6f2f-4623-a1ee-f854ebb54f0c",
      "name": "Get customers",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        64
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "a95e5d8e-c044-42e2-9d53-e453cd9cc8d0",
      "name": "If campaign does not exist1",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        192,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c880bf5d-8939-468b-a926-0e1c565acd5d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b30d68ba-44c3-4e85-b3f7-00b5ae0f23ff",
      "name": "Insert message history",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        2032,
        736
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4c326a90-e973-4db4-8fa3-e8956245b40d",
      "name": "Update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1856,
        1024
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "2beee387-3f0f-43af-99a7-886a40f84ad0",
      "name": "Update row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        64
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "43b822c8-e023-4309-b1f5-e50ad483ea13",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        1872
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ead0b140-bb0b-4153-9f60-05aa320b536c",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        2208
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f29f0ff2-514a-47e2-9f51-e1aab9d9c944",
      "name": "Create an event",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        1152,
        2320
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "00e5ccd6-bbfb-422a-baed-944aa52112b2",
      "name": "Create calendar info",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        640,
        2320
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "8e2a114f-cbc9-4b20-ae98-df5141da4501",
      "name": "Convert to JSON Object",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        2320
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "ce7c0ebb-f35c-47d1-9ed6-8f1f8c61abd6",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        192,
        64
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "fd24a324-9291-4b62-a7aa-dd69a7af5da4",
      "name": "Update reply's category",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        944,
        1984
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "868f0420-c17e-4a6c-8150-4fb21708d8fd",
      "name": "Get Customer",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        480,
        1584
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "675692ec-4227-4ae3-b47f-4e61e1ad7ced",
      "name": "Create new Customer",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1248,
        64
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "aea88323-93a4-4da5-b71c-e3dcce4119a2",
      "name": "Get customer",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        432,
        816
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "f77aab55-7dfe-4399-a15b-3fc332ac1a08",
      "name": "\u30cd\u30ac\u30dd\u30b8\u5224\u5b9a",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        640,
        1984
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "2b89521e-b73f-4a97-a18c-03fd78acabb0",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -112
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c14099ff-4a68-4597-ae3b-ca9b4253b4e0",
  "connections": {
    "Daily": {
      "main": [
        [
          {
            "node": "Don't email on weekends",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Customer information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Convert to JSON object1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Convert to JSON object",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every hour": {
      "main": [
        [
          {
            "node": "Get customers",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer": {
      "main": [
        [
          {
            "node": "reply to customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get campaign": {
      "main": [
        [
          {
            "node": "If campaign does not exist1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get customer": {
      "main": [
        [
          {
            "node": "Filter customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get customers": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get histories": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Get message histories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Insert message history",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter customer": {
      "main": [
        [
          {
            "node": "Get histories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Campaign": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get new campaign": {
      "main": [
        [
          {
            "node": "Get customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "reply to customer": {
      "main": [
        [
          {
            "node": "Convert to JSON object2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Update Campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u30cd\u30ac\u30dd\u30b8\u5224\u5b9a": {
      "main": [
        [
          {
            "node": "Update reply's category",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new Customer": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create calendar info": {
      "main": [
        [
          {
            "node": "Convert to JSON Object",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer information": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get message histories": {
      "main": [
        [
          {
            "node": "Update customer's reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON Object": {
      "main": [
        [
          {
            "node": "Create an event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON object": {
      "main": [
        [
          {
            "node": "Create new Customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON object1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON object2": {
      "main": [
        [
          {
            "node": "Reply to a message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Insert new mesage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Don't email on weekends": {
      "main": [
        [
          {
            "node": "Get new campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update customer's reply": {
      "main": [
        [
          {
            "node": "\u30cd\u30ac\u30dd\u30b8\u5224\u5b9a",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create calendar info",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If campaign does not exist1": {
      "main": [
        [
          {
            "node": "Insert new campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}