{
  "name": "Create product satisfaction surveys with Telegram, Google Sheets and AI",
  "nodes": [
    {
      "id": "c537229c-ffdf-4a4b-8cdd-1d88621e58a0",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1060,
        2060
      ]
    },
    {
      "id": "90426896-35d8-4449-8607-70e8485441ed",
      "name": "Send Next Question",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2560,
        1900
      ]
    },
    {
      "id": "614b6d06-7bca-4710-aebf-3a2a685ace09",
      "name": "Send Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1540,
        2540
      ]
    },
    {
      "id": "c7f7acc4-c3f7-4fae-98dd-25dca9caae8b",
      "name": "Has No Record?",
      "type": "n8n-nodes-base.if",
      "position": [
        60,
        2260
      ]
    },
    {
      "id": "207a2647-56eb-419a-8269-9a32edabe43a",
      "name": "Is Survey Continue?",
      "type": "n8n-nodes-base.if",
      "position": [
        1980,
        2060
      ]
    },
    {
      "id": "a8e98579-6afa-4d7d-859d-9e635a0a1b0c",
      "name": "Get State2",
      "type": "n8n-nodes-base.redis",
      "position": [
        -520,
        2060
      ]
    },
    {
      "id": "8074143c-eab7-4146-937c-16c44ef40333",
      "name": "Get Columns1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        2060
      ]
    },
    {
      "id": "1f75f3fc-7893-444d-8a1e-59ec3d42ea1d",
      "name": "Set Variables1",
      "type": "n8n-nodes-base.set",
      "position": [
        -880,
        2060
      ]
    },
    {
      "id": "a0c06eb9-46d6-4888-85b0-e9a31a31337b",
      "name": "Message Type1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -320,
        2060
      ]
    },
    {
      "id": "315585fe-d2e4-4cb1-9d0e-a3e8bc053da3",
      "name": "Get Command1",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        1760
      ]
    },
    {
      "id": "7036d250-0271-4c93-9f60-01b9ccaf8be3",
      "name": "Bot Actions1",
      "type": "n8n-nodes-base.switch",
      "position": [
        60,
        1760
      ]
    },
    {
      "id": "fa755815-29c2-419e-8e36-51102ee88681",
      "name": "Memory3",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        2220,
        2060
      ]
    },
    {
      "id": "a231e026-e5bf-4864-a57b-29d01e32e1a8",
      "name": "Get Survey State1",
      "type": "n8n-nodes-base.set",
      "position": [
        1620,
        2060
      ]
    },
    {
      "id": "a3bb744d-c59f-45a9-8b9d-3c291fa8d860",
      "name": "Reset Agent Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "position": [
        2240,
        1900
      ]
    },
    {
      "id": "b9d693b7-c139-45d8-b0d8-fd8134c7ba84",
      "name": "Memory4",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        1120,
        2700
      ]
    },
    {
      "id": "c8fd56f5-c4c0-40cb-b727-07a94b633657",
      "name": "Start Session1",
      "type": "n8n-nodes-base.redis",
      "position": [
        440,
        1620
      ]
    },
    {
      "id": "02eaa2cf-512c-4526-948e-b68989b3a8f4",
      "name": "Get State3",
      "type": "n8n-nodes-base.redis",
      "position": [
        1260,
        2060
      ]
    },
    {
      "id": "85631c2a-9317-4b14-92d1-895ac022eb70",
      "name": "Increment Index1",
      "type": "n8n-nodes-base.redis",
      "position": [
        1800,
        2060
      ]
    },
    {
      "id": "4464f6fe-d579-4e03-a8ca-918515d38b30",
      "name": "Interview Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1040,
        2540
      ]
    },
    {
      "id": "11ec3d5a-5f89-4a84-96ef-291526ae7365",
      "name": "Get Record1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -120,
        2260
      ]
    },
    {
      "id": "665d58f8-ba2f-4d87-ae56-260333c5ecdf",
      "name": "Append Responses1",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        2440
      ]
    },
    {
      "id": "4771e9e4-8b79-4530-8c4a-6e7ab0623d98",
      "name": "Update Answer2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        2540
      ]
    },
    {
      "id": "b7094d87-97ce-4f1a-8d30-4d6d57d24477",
      "name": "Get Last Bot Message1",
      "type": "n8n-nodes-base.redis",
      "position": [
        260,
        2440
      ]
    },
    {
      "id": "6dc77f41-6c3b-4358-82bc-2ea299ef69b2",
      "name": "Update Answer3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1020,
        2180
      ]
    },
    {
      "id": "dd67ca61-b36c-4f9f-84fe-0b25d411e459",
      "name": "Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1000,
        2700
      ]
    },
    {
      "id": "57698127-eea0-434e-af3a-4d49db4a7f15",
      "name": "Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        600,
        2600
      ]
    },
    {
      "id": "bad16467-bb3c-4d50-9dd8-014bac25fd61",
      "name": "Should Follow Up?1",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        620,
        2440
      ]
    },
    {
      "id": "86545380-9ff1-4815-bfaf-c4137fa00fda",
      "name": "Execution Data2",
      "type": "n8n-nodes-base.executionData",
      "position": [
        -700,
        2060
      ]
    },
    {
      "id": "ed16f03b-621e-4766-b8fd-f1f662b2dd0b",
      "name": "Create Record2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        260,
        2060
      ]
    },
    {
      "id": "f2119ef5-aef3-4b0f-80f5-1715a4afe3e0",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1120,
        1820
      ],
      "parameters": {
        "width": 760,
        "height": 500,
        "content": "## 1. Initiate Survey by Inviting User to Chat\n[Learn more about the chat trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/)\n\nTo present the survey to the u"
      }
    },
    {
      "id": "9e7ca15c-0e31-4d78-b8af-31fd6260cd61",
      "name": "Send Start",
      "type": "n8n-nodes-base.telegram",
      "position": [
        600,
        1620
      ]
    },
    {
      "id": "e8be2d00-39c8-4dd1-a597-813fc4bffe10",
      "name": "Send Start1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        260,
        1900
      ]
    },
    {
      "id": "153bbe8b-52bc-403c-ae5f-346060a5aac3",
      "name": "Completed Survey",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2220,
        2280
      ]
    },
    {
      "id": "c2e39206-f586-4c90-aeb0-d6a141e81d1d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        1540
      ],
      "parameters": {
        "width": 420,
        "height": 380,
        "content": "## 2. Handle Bot Commands\n[Learn more about the switch node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.switch/)\n\nOur chatbot can be a mix of traditional chat mechanics and AI "
      }
    },
    {
      "id": "6b6241ae-17b7-4f0f-9c00-f5de4d62f692",
      "name": "Create Record1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        280,
        1620
      ]
    },
    {
      "id": "f8f6b582-75d7-40a1-95a5-c1b80fa41c64",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        520,
        2180
      ],
      "parameters": {
        "width": 440,
        "height": 420,
        "content": "## 3. Support to Follow-Up Questions\n[Learn more about the Text Classifier node](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.text-classifier/)\n\nDepending on w"
      }
    },
    {
      "id": "5aa8956b-787d-4b4a-b4dc-a2415434a331",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        2340
      ],
      "parameters": {
        "width": 700,
        "height": 500,
        "content": "## 4. Deeper Insights with a Conversational AI Agent\n[Learn more about the AI Agent](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)\n\nThe way we utilise t"
      }
    },
    {
      "id": "aa304745-6d30-4fdb-8279-eb505ee06a61",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        1820
      ],
      "parameters": {
        "width": 740,
        "height": 380,
        "content": "## 5. Managing Conversational Flow with External State\n[Learn more about the Redis node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.redis/)\n\nWe use Redis as a quick and easy way"
      }
    },
    {
      "id": "4ce7ce73-d771-4794-b1fb-87c15ccdbdaf",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2160,
        1680
      ],
      "parameters": {
        "width": 620,
        "height": 520,
        "content": "## 6. Resetting Chat Memory for Every Question\n[Learn more about the Chat Memory Manager](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorymanager/)\n\nI discov"
      }
    },
    {
      "id": "2b26317c-6ba6-4ff0-92a6-525cce9e725d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1740,
        1300
      ],
      "parameters": {
        "width": 580,
        "height": 1020,
        "content": "## Try It Out\n### This n8n template demonstrates how you can build a structured chat journey augmented with AI for your business.\n\nIn this scenario, a chatbot conducts a product satisfaction survey wi"
      }
    }
  ],
  "connections": {
    "Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Interview Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Should Follow Up?1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory3": {
      "ai_memory": [
        [
          {
            "node": "Reset Agent Memory1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Memory4": {
      "ai_memory": [
        [
          {
            "node": "Interview Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get State2": {
      "main": [
        [
          {
            "node": "Message Type1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get State3": {
      "main": [
        [
          {
            "node": "Get Columns1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Start": {
      "main": [
        []
      ]
    },
    "Get Record1": {
      "main": [
        [
          {
            "node": "Has No Record?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Start1": {
      "main": [
        []
      ]
    },
    "Bot Actions1": {
      "main": [
        [
          {
            "node": "Create Record1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get State3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Start1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Columns1": {
      "main": [
        [
          {
            "node": "Get Survey State1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Command1": {
      "main": [
        [
          {
            "node": "Bot Actions1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Type1": {
      "main": [
        [
          {
            "node": "Get Command1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Record1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Response": {
      "main": [
        []
      ]
    },
    "Create Record1": {
      "main": [
        [
          {
            "node": "Start Session1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Record2": {
      "main": [
        [
          {
            "node": "Get State3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has No Record?": {
      "main": [
        [
          {
            "node": "Create Record2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Last Bot Message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables1": {
      "main": [
        [
          {
            "node": "Execution Data2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Session1": {
      "main": [
        [
          {
            "node": "Send Start",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Answer2": {
      "main": [
        [
          {
            "node": "Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Answer3": {
      "main": [
        [
          {
            "node": "Get State3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execution Data2": {
      "main": [
        [
          {
            "node": "Get State2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Increment Index1": {
      "main": [
        [
          {
            "node": "Is Survey Continue?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Interview Agent1": {
      "main": [
        [
          {
            "node": "Update Answer2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Set Variables1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Responses1": {
      "main": [
        [
          {
            "node": "Should Follow Up?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Survey State1": {
      "main": [
        [
          {
            "node": "Increment Index1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Next Question": {
      "main": [
        []
      ]
    },
    "Should Follow Up?1": {
      "main": [
        [
          {
            "node": "Update Answer3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Interview Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Survey Continue?": {
      "main": [
        [
          {
            "node": "Reset Agent Memory1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Completed Survey",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reset Agent Memory1": {
      "main": [
        [
          {
            "node": "Send Next Question",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Last Bot Message1": {
      "main": [
        [
          {
            "node": "Append Responses1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}