{
  "name": "Autonomous customizable support chatbot on Intercom + Discord thread reports",
  "nodes": [
    {
      "id": "acadd03a-00af-4439-b97c-9e7caaa0fe34",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1920,
        2080
      ]
    },
    {
      "id": "cef48677-4c16-4d28-93c8-eee5d2203ecb",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        5340,
        2080
      ]
    },
    {
      "id": "a0e76f53-1a99-4f32-9545-17477a87543a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        4380,
        2080
      ]
    },
    {
      "id": "01ae341e-b492-44ce-8bae-3c4dbdc39aef",
      "name": "Intercom Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -340,
        1820
      ]
    },
    {
      "id": "fc0d468f-d2c2-4bff-82f5-74757ee5acaf",
      "name": "Whether it is a new conversation or not",
      "type": "n8n-nodes-base.if",
      "position": [
        760,
        1820
      ]
    },
    {
      "id": "2c24a9fa-c587-4a3d-9cd0-ef3da97cbb45",
      "name": "[Intercom] GET conversation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        2080
      ]
    },
    {
      "id": "62e73a27-876f-4316-ac37-db81d94431f5",
      "name": "[Discord] Create Thread",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        1560
      ]
    },
    {
      "id": "ecc423a2-52ec-46cd-99b9-a1990b460f6f",
      "name": "[Discord] Type first message into the thread",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1580,
        1560
      ]
    },
    {
      "id": "9cd78f1c-9e8a-4f57-8bbd-0f7ed1d770a1",
      "name": "[Intercom] Store the thread ID as a 'note'",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2240,
        1560
      ]
    },
    {
      "id": "8c15f869-1b1f-4101-b8d8-47a340e6aa6c",
      "name": "Isolating the 'note' to get the thread ID stored",
      "type": "n8n-nodes-base.filter",
      "position": [
        2580,
        1980
      ]
    },
    {
      "id": "0f4a73af-5144-4794-81c0-013096a1c8dd",
      "name": "Isolating all textual messages contents",
      "type": "n8n-nodes-base.filter",
      "position": [
        2580,
        2180
      ]
    },
    {
      "id": "9a015403-72a7-44ee-86d4-3a5926f3736c",
      "name": "conversation -> JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        2920,
        2180
      ]
    },
    {
      "id": "269c8662-bf3b-468e-8ce6-9cab155b46bd",
      "name": "conversation info -> JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        3280,
        1980
      ]
    },
    {
      "id": "749d36fe-c31e-4376-a1a4-92a67fb80218",
      "name": "not going through if bot deactivated",
      "type": "n8n-nodes-base.filter",
      "position": [
        5960,
        1800
      ]
    },
    {
      "id": "2682a8be-7560-4d44-ac6e-2efa00770071",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        6740,
        2000
      ]
    },
    {
      "id": "5fe91a17-1768-4110-948e-5b966b341f0e",
      "name": "sorting data (cuz we join 2 different flows here)",
      "type": "n8n-nodes-base.set",
      "position": [
        6300,
        1560
      ]
    },
    {
      "id": "792704bd-4b32-42dd-b7c6-ac0afa1a57a7",
      "name": "preparing data for Agentic use",
      "type": "n8n-nodes-base.set",
      "position": [
        6600,
        1800
      ]
    },
    {
      "id": "c328c53d-384a-4f55-8619-8ff8f5a9c665",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        6920,
        2000
      ]
    },
    {
      "id": "7bc61aa6-3adc-4833-b6cc-460c013533d6",
      "name": "[Discord] Reply",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7680,
        1980
      ]
    },
    {
      "id": "cd487fbc-a3c8-47b3-9f2e-2b1fb9a16c28",
      "name": "[Intercom] Reply",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7680,
        1800
      ]
    },
    {
      "id": "c829182b-d100-4d99-8fed-fc6df2cd7da5",
      "name": "[Discord] Notify bot re-activation notification",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5640,
        1980
      ]
    },
    {
      "id": "fc05a5c1-be77-488d-b3aa-3d1eb1a7c36b",
      "name": "[Discord] Notify bot de-activation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5640,
        2180
      ]
    },
    {
      "id": "f905f1d5-0f1c-4757-9b0d-4f4c0a4ab5cb",
      "name": "[Discord] User message",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5340,
        1800
      ]
    },
    {
      "id": "707567d9-f780-4056-afe7-5b95bc5243f7",
      "name": "[Discord] Human admin reply ",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5340,
        2360
      ]
    },
    {
      "id": "bb635970-44de-4c42-88f9-c71af1e17f65",
      "name": "Tokens and Ids",
      "type": "n8n-nodes-base.set",
      "position": [
        300,
        1820
      ]
    },
    {
      "id": "7a06e017-bb20-441c-8f4d-f113c2458c88",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        960
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "d7bde7f1-00a1-448c-ac75-ccb5427810cb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5020,
        1040
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "f891d3e4-52ca-4909-a310-903556dfd1a0",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        1920
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "71231481-70ac-4170-b947-d7377acb497a",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        1640
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "09ec7853-a1ed-46a5-9055-7a9103a2d110",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        1300
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "131ae42e-9adb-49d7-afec-4fe5976c29e2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        1640
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "2432affd-4424-4f68-ae3d-00bc991bc96d",
      "name": "Prevents from running when event is 'bot reply'",
      "type": "n8n-nodes-base.filter",
      "position": [
        -20,
        1820
      ]
    },
    {
      "id": "5c31ee8a-80af-40fc-a571-e95912d3d724",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2100,
        1300
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "439052bc-fcc1-4171-b184-6eb674984748",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        1820
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "97a775b8-acab-4adb-ae6d-eb64897802fc",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        1080
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "ab933937-257b-430a-9ae0-c383c2b7dc89",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        1080
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "903b3144-1808-45b5-9151-eebbcb4df700",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3680,
        1360
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "892eedde-a217-4478-950b-7ef8265172ca",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2340,
        1880
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "71d585de-b44f-4de0-97ac-163bed7b5537",
      "name": "new conversation prepared data",
      "type": "n8n-nodes-base.set",
      "position": [
        3840,
        1560
      ]
    },
    {
      "id": "9175e5a4-ffd0-4653-8bca-881a7cc7166a",
      "name": "conversation prepared data",
      "type": "n8n-nodes-base.merge",
      "position": [
        3840,
        2080
      ]
    },
    {
      "id": "0519dfc9-2a47-4863-94f5-a62576ddacf3",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4220,
        1420
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "3d137d8e-cac2-493d-bdba-a03e5e7aa08e",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4280,
        1820
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "ae7d4a72-6ede-4099-92ba-1023debaf492",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4980,
        1560
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "cfe700c6-373f-4496-bfa6-2376dc6d6124",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7540,
        1540
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "60f6d9a0-596c-4c07-a80b-75cb9b95bce6",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7540,
        1960
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "c93a0d33-4d30-4ab9-a227-b73cb2346472",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6200,
        1420
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "a4417a0d-f082-42b1-8f74-a59aefb4352b",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7500,
        1420
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "96d10602-fc7b-4d38-905c-0e4631101ec9",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        1640
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "4c5a7096-11d6-4532-9692-8b38bc74d649",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        2040
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "5449ff44-148a-48f9-b7e6-cb0482563562",
      "name": "Aggregate1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3280,
        2180
      ]
    },
    {
      "id": "e52e5c92-a109-4644-911c-d4300e39edfe",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        6880,
        1800
      ]
    },
    {
      "id": "4851a935-7556-4442-ac58-da8629c5afd8",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        7240,
        2780
      ]
    },
    {
      "id": "a78906ea-a87c-4512-9a46-68c4f3eb8e5d",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        7180,
        2940
      ]
    },
    {
      "id": "a4f6ab9e-9071-4316-a2f4-b2c88a1c5446",
      "name": "Sticky Note24",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7120,
        2680
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "4c893c65-dec4-474b-9300-b678431498ae",
      "name": "Get a lead",
      "type": "n8n-nodes-base.intercom",
      "position": [
        -40,
        1640
      ]
    },
    {
      "id": "ccf408c5-f48d-4445-acf4-546bee3dd919",
      "name": "Get a lead1",
      "type": "n8n-nodes-base.intercom",
      "position": [
        4500,
        2860
      ]
    },
    {
      "id": "8b5a9511-697b-46b2-8884-81d903391499",
      "name": "Get a lead2",
      "type": "n8n-nodes-base.intercom",
      "position": [
        3660,
        2520
      ]
    },
    {
      "id": "5883b999-c0e6-47fa-b257-feff038caf84",
      "name": "Get a lead3",
      "type": "n8n-nodes-base.intercom",
      "position": [
        4420,
        1300
      ]
    }
  ],
  "connections": {
    "If2": {
      "main": [
        [
          {
            "node": "[Discord] Notify bot re-activation notification",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[Discord] Notify bot de-activation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "[Discord] User message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[Discord] Human admin reply ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "[Intercom] Reply",
            "type": "main",
            "index": 0
          },
          {
            "node": "[Discord] Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Isolating all textual messages contents",
            "type": "main",
            "index": 0
          },
          {
            "node": "Isolating the 'note' to get the thread ID stored",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "conversation prepared data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Tokens and Ids": {
      "main": [
        [
          {
            "node": "Whether it is a new conversation or not",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "conversation -> JSON": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Discord] User message": {
      "main": [
        [
          {
            "node": "not going through if bot deactivated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Discord] Create Thread": {
      "main": [
        [
          {
            "node": "[Discord] Type first message into the thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Intercom Webhook Trigger": {
      "main": [
        [
          {
            "node": "Prevents from running when event is 'bot reply'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "conversation info -> JSON": {
      "main": [
        [
          {
            "node": "conversation prepared data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "conversation prepared data": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Intercom] GET conversation": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "new conversation prepared data": {
      "main": [
        [
          {
            "node": "sorting data (cuz we join 2 different flows here)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "preparing data for Agentic use": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "not going through if bot deactivated": {
      "main": [
        [
          {
            "node": "preparing data for Agentic use",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Isolating all textual messages contents": {
      "main": [
        [
          {
            "node": "conversation -> JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Whether it is a new conversation or not": {
      "main": [
        [
          {
            "node": "[Discord] Create Thread",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "[Intercom] GET conversation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Intercom] Store the thread ID as a 'note'": {
      "main": [
        [
          {
            "node": "new conversation prepared data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "[Discord] Type first message into the thread": {
      "main": [
        [
          {
            "node": "[Intercom] Store the thread ID as a 'note'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prevents from running when event is 'bot reply'": {
      "main": [
        [
          {
            "node": "Tokens and Ids",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Isolating the 'note' to get the thread ID stored": {
      "main": [
        [
          {
            "node": "conversation info -> JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "sorting data (cuz we join 2 different flows here)": {
      "main": [
        [
          {
            "node": "preparing data for Agentic use",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}