{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5d6a5a45-8aa8-4c34-aa10-5dd85f05de9d",
      "name": "Human Handoff using Send and Wait",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1580,
        1040
      ],
      "parameters": {
        "chatId": "=<human chat id>",
        "message": "=chatId: {{ $('Handoff Subworkflow').first().json.chatId }}\nsessionId: {{ $('Handoff Subworkflow').first().json.sessionId }}\nuser: {{ $('Handoff Subworkflow').first().json.username }} ({{ $('Handoff Subworkflow').item.json.userId }})\n\nSummary:\n{{ $('Handoff Subworkflow').item.json.summary }}\n\n---\nThis user has now been handed off to a human.\nClick the button to return user to bot.",
        "options": {},
        "operation": "sendAndWait",
        "responseType": "freeText"
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5d2f73ff-b233-4456-b34d-d5a5454dabda",
      "name": "Set Interaction to Bot",
      "type": "n8n-nodes-base.redis",
      "position": [
        1780,
        1040
      ],
      "parameters": {
        "key": "=handoff_{{ $('Handoff Subworkflow').first().json.sessionId }}_state",
        "value": "bot",
        "keyType": "string",
        "operation": "set"
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f799e213-f3ed-4479-aade-7a7c38eb5792",
      "name": "Set Interaction to Human",
      "type": "n8n-nodes-base.redis",
      "position": [
        1380,
        1040
      ],
      "parameters": {
        "key": "=handoff_{{ $json.sessionId }}_state",
        "value": "=human",
        "keyType": "string",
        "operation": "set"
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "059c9b8c-ba50-4bdd-8969-6f5f35bba304",
      "name": "Get Interaction State",
      "type": "n8n-nodes-base.redis",
      "position": [
        -800,
        820
      ],
      "parameters": {
        "key": "=handoff_{{ $json.message.chat.id }}_state",
        "options": {},
        "operation": "get",
        "propertyName": "data"
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8afd48ff-478d-4092-ac88-fb2e435ded00",
      "name": "Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -280,
        640
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "19c5ef66-410d-47fd-9b2a-19776c53a681",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        -160,
        640
      ],
      "parameters": {
        "sessionKey": "=handoff_{{ $('Telegram Trigger').first().json.message.chat.id }}_chat",
        "sessionIdType": "customKey"
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.4
    },
    {
      "id": "814e464d-a2e0-4ae1-83d1-df3732d3b430",
      "name": "Handoff Subworkflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        980,
        1040
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "chatId"
            },
            {
              "name": "sessionId"
            },
            {
              "name": "userId"
            },
            {
              "name": "username"
            },
            {
              "name": "summary"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "53c311ca-b7ad-4705-97c9-f6438a6c6b4e",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1000,
        820
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ea54c9f7-8ebc-4146-a4ec-6d05957f340d",
      "name": "Send Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1400,
        340
      ],
      "parameters": {
        "text": "=Thank you. I've now transferred you to a human agent who will reach out to you. Once complete, you can come back to this chat to finish the process.",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7f895e2a-7aee-40be-a8b7-b2b0ff469b2d",
      "name": "Switch Interaction",
      "type": "n8n-nodes-base.switch",
      "position": [
        -620,
        820
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Human",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6bc61072-f7cf-4a6d-af81-36abede59d47",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data }}",
                    "rightValue": "human"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Bot",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6882db64-b522-4895-8949-d98d87b53b49",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.data }}",
                    "rightValue": "bot"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Onboarding"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "df203358-e6c7-4014-8e2b-ef934e331215",
      "name": "Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        440,
        460
      ],
      "parameters": {
        "text": "={{\n$json.data\n  .reverse()\n  .slice(0, 5)\n  .map(item => item.parseJson())\n  .map(item => `${item.type}: ${item.data.content}`)\n  .join('\\n')\n}}",
        "options": {
          "systemPromptTemplate": "Analyse the conversation history and extract the required customer details. If not found, leave blank."
        },
        "attributes": {
          "attributes": [
            {
              "name": "firstname",
              "required": true,
              "description": "first name of customer"
            },
            {
              "name": "lastname",
              "required": true,
              "description": "last name of customer"
            },
            {
              "name": "address_and_postcode",
              "required": true,
              "description": "address and postcode of customer"
            },
            {
              "name": "reason_for_call",
              "required": true,
              "description": "a summary of the reason for the call"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "35bc11d2-6024-425b-ac67-a61ff26b9478",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        420,
        640
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "20d71c5f-6e84-4b45-b324-0706ecd3a681",
      "name": "With Defaults",
      "type": "n8n-nodes-base.code",
      "position": [
        760,
        460
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "return {\n  \"firstname\": \"\",\n  \"lastname\": \"\",\n  \"address_and_postcode\": \"\",\n  \"reason_for_call\": \"\",\n  ...$input.item.json.output,\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "76344f79-1afa-4fd9-9c01-ca3818f62f37",
      "name": "Has All Criteria?",
      "type": "n8n-nodes-base.if",
      "position": [
        920,
        460
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "96d4a43f-aa0f-486a-b692-0105196d099a",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ Object.values($json).every(val => Boolean(val)) }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f76c1032-036b-46ad-91da-023d5af931fd",
      "name": "Onboarding Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -240,
        460
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').first().json.message.text }}",
        "options": {
          "systemMessage": "=You are a prescreen assistant whose task is to get the following details from a customer before handing them over to a human agent.\n* first name\n* last name\n* address and postcode\n* reason for calling - capture exact wording if possible.\n\nOnce all data is gathered, hand the user off to a human agent."
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "0a5b19a5-9c19-436c-b1d3-23d962efd23e",
      "name": "Get Onboarding Chat History",
      "type": "n8n-nodes-base.redis",
      "position": [
        280,
        460
      ],
      "parameters": {
        "key": "=handoff_{{ $('Telegram Trigger').first().json.message.chat.id }}_chat",
        "options": {},
        "operation": "get",
        "propertyName": "data"
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f247eb3-78f0-4ec1-8713-1373da07b5f3",
      "name": "After Sales Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        340,
        1000
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {
          "systemMessage": "You are an aftersales agent helping the user answer questions about their recent purchase."
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "bce26253-f7da-49e8-952b-52e14eb4f9b5",
      "name": "Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        420,
        1180
      ],
      "parameters": {
        "sessionKey": "=handoff_{{ $('Telegram Trigger').first().json.message.chat.id }}_chat2",
        "sessionIdType": "customKey",
        "contextWindowLength": 30
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.4
    },
    {
      "id": "51c4549b-559c-400d-9951-dde0953ade4c",
      "name": "Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        300,
        1180
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "63b8d9e8-7af2-4103-a365-ca5471bd7b36",
      "name": "Handoff Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        540,
        1180
      ],
      "parameters": {
        "name": "handoff_to_human",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "description": "Call this tool to handoff or defer to a human agent at the request of the customer. Ensure a summary of the reason for the handoff is obtained first.",
        "workflowInputs": {
          "value": {
            "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id.toString() }}",
            "userId": "={{ $('Telegram Trigger').first().json.message.from.id.toString() }}",
            "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('summary', `Reason for human hand-off`, 'string') }}",
            "username": "={{ $('Telegram Trigger').first().json.message.from.username }}",
            "sessionId": "={{ $('Telegram Trigger').first().json.message.chat.id.toString() }}"
          },
          "schema": [
            {
              "id": "chatId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "chatId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sessionId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "sessionId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "userId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "userId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "username",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9a2b9077-0ead-4f2c-9e83-05ee341ff697",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1080,
        580
      ],
      "parameters": {
        "color": 7,
        "width": 660,
        "height": 460,
        "content": "## 1. \uc218\uc2e0 \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud55c \uc0c1\ud638\uc791\uc6a9 \uc0c1\ud0dc \ud655\uc778\n\n[\ud154\ub808\uadf8\ub7a8 \ud2b8\ub9ac\uac70\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.telegramtrigger/)\n\n\uc774\uac83\uc740 \uc0c1\ud0dc \uae30\ubc18 \uc5d0\uc774\uc804\ud2b8\uc758 \uc608\uc785\ub2c8\ub2e4 - \uc77c\ubc18\uc801\uc73c\ub85c \uc720\ud55c \uc0c1\ud0dc \uae30\uacc4\ub85c \uc54c\ub824\uc9c4 \uae30\uc220\uc785\ub2c8\ub2e4. \ub370\uc774\ud130 \uc218\uc9d1\uc774\ub098 \ub2e8\uacc4\ub97c \uc21c\ucc28\uc801\uc73c\ub85c \uc218\ud589\ud574\uc57c \ud558\ub294 \uc694\uad6c\uc0ac\ud56d\uc774 \uc788\ub294 \ub300\ud654\uc758 \ud750\ub984\uacfc \ubc29\ud5a5\uc744 \uc2e4\uc81c\ub85c \uc81c\uc5b4\ud558\ub294 \ud6cc\ub96d\ud55c \ubc29\ubc95\uc785\ub2c8\ub2e4. \uc138\uc158 \uc0c1\ud0dc\ub97c \uad00\ub9ac\ud558\uae30 \uc704\ud574 Redis\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc73c\uba70, \uc138\uc158 \ud0a4\ub294 \uc0ac\uc6a9\uc790\uc758 \ubc88\ud638\uac00 \ub420 \uac83\uc785\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "ccca9a5c-595a-4c58-9316-933a8234ab91",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        260
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 520,
        "content": "## 2. \uace0\uac1d \uac80\uc99d\uc744 \uc704\ud55c \uc628\ubcf4\ub529 \uc5d0\uc774\uc804\ud2b8\n\n[\uc5d0\uc774\uc804\ud2b8\uc5d0 \ub300\ud574 \ub354 \uc77d\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent)\n\n\uc774 \uc5d0\uc774\uc804\ud2b8\ub294 \uae30\uc874\uc758 \ub2e4\uc911 \uc791\uc5c5 \uc608\uc81c\uc640 \ub2ec\ub9ac, \uc0ac\uc6a9\uc790\uc758 \uc628\ubcf4\ub529\ub9cc \ucc98\ub9ac\ud558\ub3c4\ub85d \uc124\uacc4\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uc774 \ubc29\ubc95\uc73c\ub85c, \ud3b8\ub9ac\ud568\uc744 \uc7a1\uc74c\uacfc \uad50\ud658\ud558\uc9c0\ub9cc, \uc5d0\uc774\uc804\ud2b8\uac00 \uc6d0\ud558\ub294 \uacbd\ub85c\uc5d0\uc11c \ubc97\uc5b4\ub0a0 \uac00\ub2a5\uc131\uc744 \uc904\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "2d859430-1326-4cbc-a5cc-3af0d091e5c0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        260
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 520,
        "content": "## 3. \ub300\ud654\uc5d0\uc11c \uace0\uac1d \uc138\ubd80 \uc815\ubcf4 \ucd94\ucd9c\n\n[Information Extractor\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.information-extractor)\n\n\uc0ac\uc6a9\uc790\uc758 \uc138\ubd80 \uc815\ubcf4\ub97c \uad6c\uc870\ud654\ub41c \ud615\uc2dd\uc73c\ub85c \uc218\uc9d1\ud558\uae30 \uc704\ud574, \ud604\uc7ac \ub300\ud654\ub97c \ubd84\uc11d\ud558\uace0 Information Extractor \ub178\ub4dc\ub85c \ub370\uc774\ud130\ub97c \ucd94\ucd9c\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub85c \uc778\ud574 \ub300\ud654\uac00 \uc790\uc720 \ud615\uc2dd\uc73c\ub85c \uc720\uc9c0\ub418\uba70, \uac01 \ud544\ub4dc\uc5d0 \ub300\ud574 \uc9c8\ubb38\uc744 \ud558\ub294 \uac83\uc744 \ubc29\uc9c0\ud569\ub2c8\ub2e4. \ucf54\ub4dc \ub178\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubaa8\ub4e0 \uc138\ubd80 \uc815\ubcf4\uac00 \ucea1\ucc98\ub418\uc5c8\ub294\uc9c0 \ud655\uc778\ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "754f0859-8af7-4a15-8e46-c9ad62b55bf3",
      "name": "Handoff Subworkflow1",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1220,
        340
      ],
      "parameters": {
        "mode": "each",
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {
            "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id.toString() }}",
            "userId": "={{ $('Telegram Trigger').first().json.message.from.id.toString() }}",
            "summary": "=name: {{ $json.firstname }} {{ $json.lastname }}\naddress: {{ $json.address_and_postcode }}\nsummary: {{ $json.reason_for_call }}",
            "username": "={{ $('Telegram Trigger').first().json.message.from.username }}",
            "sessionId": "={{ $('Telegram Trigger').first().json.message.chat.id.toString() }}"
          },
          "schema": [
            {
              "id": "chatId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "chatId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "sessionId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "sessionId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "userId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "userId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6f92128f-14dc-4b0a-b098-3d9535ac11e3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        140
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 640,
        "content": "## 4. \uae30\uc900 \ucda9\uc871 \uc2dc \uc778\uac04 \uc804\ub2ec  \n[\uc11c\ube0c\uc6cc\ud06c\ud50c\ub85c\uc6b0\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflow)  \n\n\uc5ec\uae30\uc11c, \uc6b0\ub9ac\ub294 \ud578\ub4dc\uc624\ud504\ub97c \uc2dc\uc791\ud558\uc5ec \uc6b0\ub9ac\uc758 \ud578\ub4dc\uc624\ud504 \uc11c\ube0c\uc6cc\ud06c\ud50c\ub85c\uc6b0\ub97c \ud638\ucd9c\ud569\ub2c8\ub2e4. \uc11c\ube0c\uc6cc\ud06c\ud50c\ub85c\uc6b0\ub294 \uc791\uc5c5\uc744 \ub3d9\uc2dc\uc5d0 \uc2e4\ud589\ud558\uace0 \uc0ac\uc6a9\uc790\uc5d0\uac8c \uc751\ub2f5\uc744 \ucc28\ub2e8\ud558\uc9c0 \uc54a\ub294 \ud6cc\ub96d\ud55c \ubc29\ubc95\uc785\ub2c8\ub2e4. \uc774 \uc2dc\uc810\uc5d0\uc11c, \uc138\uc158 \uc0c1\ud0dc\uac00 \"human\"\uc73c\ub85c \uc124\uc815\ub418\uc5b4 \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\uac00 \uc778\uacc4\ub97c \ubc1b\uc544\uc57c \ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "14500c4f-da43-460f-bf4d-80d0a2f4537b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 440,
        "content": "## 5. \uc0ac\ub78c\uc5d0\uac8c \uc591\ubcf4\n\n\uc138\uc158 \uc0c1\ud0dc\uac00 \"human\"\uc77c \ub54c, \ucd94\uac00\uc801\uc778 \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0\uac00 \uc5d0\uc774\uc804\ud2b8\uc5d0\uac8c \ub3c4\ub2ec\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774\ub294 \uc778\uac04\uacfc \uc5d0\uc774\uc804\ud2b8\ub97c \ud63c\ub780\uc2a4\ub7fd\uac8c \ud560 \uc218 \uc788\ub294 \ubcd1\ub82c \ub300\ud654\uac00 \ubc1c\uc0dd\ud558\uc9c0 \uc54a\ub3c4\ub85d \ud558\uae30 \uc704\ud568\uc785\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "4d74d479-8525-4b64-8291-e2b3058edeaa",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 520,
        "content": "## 6. \ubd07\uc73c\ub85c \uc0c1\ud638\uc791\uc6a9 \uc804\ud658\ub428  \n[\uace0\uac1d \uc6cc\ud06c\ud50c\ub85c \ud234\uc5d0 \ub300\ud574 \ub354 \uc77d\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow/)  \n\n\uc138\uc158 \uc0c1\ud0dc\uac00 \"bot\"\uc77c \ub54c, \uc774\ub294 \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\uac00 \uc0ac\uc6a9\uc790\ub97c \ubd07\uc73c\ub85c \ub2e4\uc2dc \uc774\uc804\uc2dc\ucf30\uc74c\uc744 \ub098\ud0c0\ub0b4\uba70, \ub530\ub77c\uc11c \uadf8\ub4e4\uc758 \uba54\uc2dc\uc9c0 \ucc98\ub9ac\ub97c \uacc4\uc18d\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc0ac\uc6a9\uc790\uac00 \uc694\uccad\ud560 \ub54c\ub9c8\ub2e4 \ucee4\uc2a4\ud140 \uc6cc\ud06c\ud50c\ub85c \ud234\uc774 \ud578\ub4dc\uc624\ud504 \ud504\ub85c\uc138\uc2a4\ub97c \ub2e4\uc2dc \ud2b8\ub9ac\uac70\ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "a1c064d9-cc74-475d-b233-9deb4dfa81d7",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        820
      ],
      "parameters": {
        "color": 7,
        "width": 1580,
        "height": 560,
        "content": "## 7. \uc0c1\ud638\uc791\uc6a9 \uc11c\ube0c\uc6cc\ud06c\ud50c\ub85c\n\n[\ub354 \uc54c\uc544\ubcf4\uae30 n8n\uc758 \uc778\uac04-\ub8e8\ud504 \uae30\ub2a5](https://docs.n8n.io/advanced-ai/examples/human-fallback/)\n\n\uc5ec\uae30\uc5d0\uc11c\uc758 \ud578\ub4dc\uc624\ud504 \uad6c\ud604\uc740 n8n\uc758 \"\uc778\uac04-\ub8e8\ud504\" \uae30\ub2a5 - \uc2e4\ud589 \uc911\uc5d0 \uc778\uac04\uc774 \ub2f5\ubcc0\uc774\ub098 \ud589\ub3d9\uc744 \ubcf4\ub0b4\uae30\uae4c\uc9c0 \uc2e4\ud589\uc744 \"\uc77c\uc2dc \uc911\uc9c0\"\ud558\ub294 \uae30\ub2a5 - \uc744 \ud3ec\ud568\ud569\ub2c8\ub2e4. \ubcf5\uc7a1\ud574 \ubcf4\uc774\uc9c0\ub9cc n8n\uc774 \uc774 \uc0c1\ud638\uc791\uc6a9\uc744 \ub9e4\ub044\ub7fd\uac8c \ucc98\ub9ac\ud55c\ub2e4\ub294 \uc810\uc744 \uc720\uc758\ud558\uc138\uc694! \uc5ec\uae30\uc11c, \uc6b0\ub9ac\ub294 \uc774\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\uac00 \ub300\ud654\uc758 \uc81c\uc5b4\ub97c AI \uc5d0\uc774\uc804\ud2b8\uc5d0\uac8c \ub2e4\uc2dc \uc591\ub3c4\ud560 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4. \ub610\ud55c, \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\uc758 \ud53c\ub4dc\ubc31\uc774 \ucea1\ucc98\ub418\uc5b4 \uc5d0\uc774\uc804\ud2b8\uc758 \uba54\ubaa8\ub9ac\uc5d0 \ucd94\uac00\ub418\uc5b4 \uc0ac\uc6a9\uc790\ub97c \ub354 \uc798 \ub3c4\uc6b8 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "33684768-2f21-4f30-9e56-934171b215fc",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1580,
        -260
      ],
      "parameters": {
        "width": 440,
        "height": 1320,
        "content": "## \uc774\ub97c \uc2dc\ub3c4\ud574 \ubcf4\uc138\uc694  \n### \uc774 n8n \ud15c\ud50c\ub9bf\uc740 Human-in-the-loop \uae30\ub2a5\uc744 \uc2a4\uc704\uce58\ub85c \uc0ac\uc6a9\ud558\uc5ec \ubd07-\uc778\uac04 \ud578\ub4dc\uc624\ud504\ub97c \uc218\ud589\ud558\ub294 \uc811\uadfc \ubc29\uc2dd\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4.  \n\n\uc774 \uc2e4\ud5d8\uc5d0\uc11c \uc6b0\ub9ac\ub294 \uc5d0\uc774\uc804\ud2b8\uac00 \uc0ac\uc6a9\uc790\uc640\uc758 \uc0c1\ud638\uc791\uc6a9\uc744 \uc81c\uc5b4\ud558\ub294 \uc0c1\ud0dc\uc5d0 \ub300\ud55c \uc544\uc774\ub514\uc5b4\ub97c \ud0d0\uad6c\ud569\ub2c8\ub2e4.  \n* **\uccab \ubc88\uc9f8 \uc0c1\ud0dc** - \uc5d0\uc774\uc804\ud2b8\uac00 \ud310\ub9e4 \ubb38\uc758\uc5d0 \ub300\ud55c \uc0ac\uc6a9\uc790\uc758 \uc138\ubd80 \uc815\ubcf4\ub97c \uc218\uc9d1\ud558\uc5ec \uc628\ubcf4\ub529\ud55c \ud6c4, \ud1b5\ud654\ub97c \uacc4\uc18d\ud558\uae30 \uc704\ud574 \uc778\uac04\uc5d0\uac8c \uc804\ub2ec/\uc774\uad00\ud569\ub2c8\ub2e4.  \n* **\ub450 \ubc88\uc9f8 \uc0c1\ud0dc** - \uc5d0\uc774\uc804\ud2b8\uac00 \ubcf8\uc9c8\uc801\uc73c\ub85c \"\ube44\ud65c\uc131\ud654\"\ub418\uba70, \ubd07\uc73c\ub85c\uc758 \ucd94\uac00 \uba54\uc2dc\uc9c0\ub294 \ub3c4\ub2ec\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ub300\uc2e0, \uc0ac\uc6a9\uc790\uc5d0\uac8c \ubbf8\ub9ac \uc900\ube44\ub41c \uc751\ub2f5\uc774 \uc81c\uacf5\ub429\ub2c8\ub2e4. \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\ub294 Human-in-the-loop \uc591\uc2dd\uc744 \uc644\ub8cc\ud558\uace0 \uc0ac\uc6a9\uc790\uc640\uc758 \ub300\ud654 \uc694\uc57d\uc744 \uc81c\uacf5\ud558\uc5ec \ubd07\uc744 \"\uc7ac\ud65c\uc131\ud654\"\ud574\uc57c \ud569\ub2c8\ub2e4.  \n* **\uc138 \ubc88\uc9f8 \uc0c1\ud0dc** - \uc5d0\uc774\uc804\ud2b8\uac00 \uc778\uac04-\uc0ac\uc6a9\uc790 \ub300\ud654\uc758 \ub9e5\ub77d\uacfc \ud568\uaed8 \"\uc7ac\ud65c\uc131\ud654\"\ub418\uc5b4 \uc560\ud504\ud130 \uc138\uc77c\uc988 \uc9c0\uc6d0\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4. \uc5d0\uc774\uc804\ud2b8\uac00 \uc694\uccad\ud560 \ub54c \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\uc5d0\uac8c \ub2e4\uc2dc \uc704\uc784\ud560 \uc218 \uc788\ub294 \ub3c4\uad6c\uac00 \uc81c\uacf5\ub429\ub2c8\ub2e4.  \n\n### \uc791\ub3d9 \uc6d0\ub9ac  \n* \uc774 \ud15c\ud50c\ub9bf\uc740 \ud154\ub808\uadf8\ub7a8\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc0ac\uc6a9\uc790\uc640 \uc5d0\uc774\uc804\ud2b8 \uac04\uc758 \uc0c1\ud638\uc791\uc6a9\uc744 \ucc98\ub9ac\ud569\ub2c8\ub2e4.  \n* \uac01 \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0\ub294 \uc138\uc158 \uc0c1\ud0dc\ub97c \ud655\uc778\ud558\uc5ec \ub300\ud654\uc758 \uc62c\ubc14\ub978 \ub2e8\uacc4\ub85c \uc548\ub0b4\ud569\ub2c8\ub2e4. \uc774\ub97c \uc704\ud574 Redis\ub97c \uac04\ub2e8\ud55c \ud0a4-\uac12 \uc800\uc7a5\uc18c\ub85c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.  \n* \uc0c1\ud0dc\uac00 \uc124\uc815\ub418\uc9c0 \uc54a\uc740 \uacbd\uc6b0, \uc0ac\uc6a9\uc790\ub294 \uc628\ubcf4\ub529 \ub2e8\uacc4\ub97c \ud1b5\ud574 \uc138\ubd80 \uc815\ubcf4\ub97c \uc5bb\uc2b5\ub2c8\ub2e4. \uc644\ub8cc\ub418\uba74 \uc5d0\uc774\uc804\ud2b8\ub294 \uc0ac\uc6a9\uc790\ub97c \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\uc5d0\uac8c \"\uc774\uad00\"\ud569\ub2c8\ub2e4. \uae30\uc220\uc801\uc73c\ub85c\ub294 \uc138\uc158 \uc0c1\ud0dc \uc5c5\ub370\uc774\ud2b8\uc640 \uc0ac\uc6a9\uc790\uc758 \uc138\ubd80 \uc815\ubcf4\ub97c \ub2e4\ub978 \ucc44\ud305\uc73c\ub85c \uc804\ub2ec\ud558\ub294 \uba54\uc2dc\uc9c0\ub9cc \ud3ec\ud568\ub429\ub2c8\ub2e4.  \n* \uc774 \"\uc778\uac04\" \uc0c1\ud0dc \ub3d9\uc548 \uc5d0\uc774\uc804\ud2b8\ub294 \uc0ac\uc6a9\uc790\uc5d0\uac8c \uc751\ub2f5\ud560 \uc218 \uc5c6\uc73c\uba70, \uc778\uac04\uc774 \ub300\ud654\ub97c \"\ub3cc\ub824\ubcf4\ub0b4\"\uae30\ub97c \uae30\ub2e4\ub824\uc57c \ud569\ub2c8\ub2e4. \uc778\uac04\uc740 Human-in-the-loop \uba54\uc2dc\uc9c0\uc5d0 \ub300\ud654 \uc694\uc57d\uc73c\ub85c \uc751\ub2f5\ud558\uc5ec \uc774\ub97c \uc218\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub85c\uc368 \uc138\uc158 \uc0c1\ud0dc\uac00 \"\ubd07\"\uc73c\ub85c \ubcc0\uacbd\ub418\uace0, \uc5d0\uc774\uc804\ud2b8\uc758 \uba54\ubaa8\ub9ac\uc5d0 \ub9e5\ub77d\uc774 \uc0bd\uc785\ub418\uc5b4 \ubbf8\ub798\uc758 \uc9c8\ubb38\uc5d0 \uc751\ub2f5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.  \n* \ub300\ud654\uc758 \uc774 \ub2e8\uacc4\uc5d0\uc11c \uc5d0\uc774\uc804\ud2b8\ub294 \uc560\ud504\ud130-\uc138\uc77c\uc988 \uc9c8\ubb38\uc744 \ucc98\ub9ac\ud558\uace0 \uc0ac\uc6a9\uc790\uc5d0\uac8c \ub3c4\uc6c0\uc744 \uc81c\uacf5\ud574\uc57c \ud569\ub2c8\ub2e4. \uc0ac\uc6a9\uc790\ub294 \uc5b8\uc81c\ub4e0\uc9c0 \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\ub85c\uc758 \uc774\uad00\uc744 \uc694\uccad\ud560 \uc218 \uc788\uc73c\uba70, \ud544\uc694\uc5d0 \ub530\ub77c \uc774\uc804 \ub2e8\uacc4\ub97c \ubc18\ubcf5\ud569\ub2c8\ub2e4.  \n\n#### \uc0ac\uc6a9 \ubc29\ubc95  \n* \uc0ac\uc6a9\uc790 \uc5ec\uc815\uc744 \uacc4\ud68d\ud558\uc138\uc694! \uc5ec\uae30\uc5d0\ub294 \ucd5c\ub300 3\uac1c\uc758 \uc0c1\ud0dc\ub97c \uac00\uc9c4 \uae30\ubcf8\uc801\uc778 \ud310\ub9e4 \ubb38\uc758 \uc608\uc2dc\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ub354 \ub9ce\uc740 \uc0c1\ud0dc\uac00 \ud3ec\ud568\ub420 \ub54c\ub294 \ub354 \ub9ce\uc740 \uace0\ub824\uac00 \ud544\uc694\ud569\ub2c8\ub2e4.  \n* \uc138\uc158 \uc0c1\ud0dc\ub97c \ub354 \uc798 \ub85c\uadf8\ud558\uace0 \uad00\ub9ac\ud558\uc5ec \uc0ac\uc6a9\uc790\uac00 \ubd88\ud655\uc2e4\ud55c \uc0c1\ud0dc\uc5d0 \uba38\ubb3c\uc9c0 \uc54a\ub3c4\ub85d \ud558\uc138\uc694. \uc0ac\uc6a9\u8005\u548c \uc138\uc158\uc744 CRM\uc5d0 \uc5f0\uacb0\ud574 \ubcf4\uc138\uc694.  \n* \uc628\ubcf4\ub529 \uc5d0\uc774\uc804\ud2b8\uc640 \uc560\ud504\ud130-\uc138\uc77c\uc988 \uc5d0\uc774\uc804\ud2b8\ub294 \ubcc4\ub3c4\uc758 \ucc44\ud305 \uba54\ubaa8\ub9ac\ub97c \uac00\uc9c0\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ub354 \ub9ce\uc740 \uc5d0\uc774\uc804\ud2b8\ub97c \ucd94\uac00\ud560 \ub54c\ub294 \uc0c1\ud0dc \uac04\uc5d0 \uc9d1\uc911\ub825\uc744 \ub3d5\uae30 \uc704\ud574 \ubcc4\ub3c4\uc758 \ucc44\ud305 \uba54\ubaa8\ub9ac\ub97c \uc720\uc9c0\ud558\ub294 \uac83\uc744 \ucd94\ucc9c\ud569\ub2c8\ub2e4.  \n\n### \ub3c4\uc6c0\uc774 \ud544\uc694\ud558\uc138\uc694?  \n[Discord](https://discord.com/invite/XPKeKXeB7d) \ub610\ub294 [Forum](https://community.n8n.io/)\uc5d0 \ucc38\uc5ec\ud558\uc138\uc694!  \n\n\uc990\uac70\uc6b4 \ud574\ud0b9!"
      },
      "typeVersion": 1
    },
    {
      "id": "187ca5ef-c804-4aca-8ad9-3c4b11676fbf",
      "name": "Send Response2",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2320,
        1040
      ],
      "parameters": {
        "text": "=Hello again! I'm now ready to answer any remaining questions you may have.",
        "chatId": "={{ $('Handoff Subworkflow').first().json.chatId }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ab036106-84f2-4cf7-a5ad-7706a9e5ea0a",
      "name": "Memory2",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        1980,
        1200
      ],
      "parameters": {
        "sessionKey": "=handoff_{{ $('Handoff Subworkflow').first().json.chatId }}_chat2",
        "sessionIdType": "customKey",
        "contextWindowLength": 30
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.5
    },
    {
      "id": "9d9d1aee-5632-499c-968d-63a555cc58d8",
      "name": "Update Agent Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "position": [
        1980,
        1040
      ],
      "parameters": {
        "mode": "insert",
        "messages": {
          "messageValues": [
            {
              "type": "ai",
              "message": "=Report from human agent says \"{{ $('Human Handoff using Send and Wait').first().json.data.text }}\"",
              "hideFromUI": true
            },
            {
              "type": "ai",
              "message": "Hello again! I'm now ready to answer any remaining questions you may have."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8da2fefa-e51f-4258-8ded-e0f20db87641",
      "name": "Send Response3",
      "type": "n8n-nodes-base.telegram",
      "position": [
        680,
        1000
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f027afe0-0fd2-47a2-a0f8-f0d78f8fbc18",
      "name": "Get Canned Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -180,
        1000
      ],
      "parameters": {
        "text": "=This conversation has been handed-off to a human agent who will be in contact soon if not done so already. I cannot respond to your query until the human agent transfers you back to me.",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a1ada0c7-779e-44bc-bdbd-1d5285bedf3c",
      "name": "Notify user",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1180,
        1040
      ],
      "parameters": {
        "text": "=You have now been transferred to a human. Unfortunately, I will not be able to respond until the human agent transfers you back to me.",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "31287a38-e7a7-4518-9f54-6e6c9b2486fe",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        1020
      ],
      "parameters": {
        "width": 220,
        "height": 320,
        "content": "\uc778\uac04 \ucc44\ud305 ID\ub97c \ucd94\uac00\ud558\uc138\uc694. \uc774\uac83\uc740 \uc778\uac04 \uc5d0\uc774\uc804\ud2b8\ub97c \uc54c\ub9ac\uae30 \uc704\ud574 \ud544\uc694\ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "a58a82b9-2c37-4137-9b3e-17479c78a2d2",
      "name": "Memory3",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        1580,
        500
      ],
      "parameters": {
        "sessionKey": "=handoff_{{ $('Telegram Trigger').first().json.message.chat.id }}_chat2",
        "sessionIdType": "customKey",
        "contextWindowLength": 30
      },
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.5
    },
    {
      "id": "4d3d5b46-6e82-4b97-9e5f-76f02ff79ce5",
      "name": "Update Agent Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "position": [
        1580,
        340
      ],
      "parameters": {
        "mode": "insert",
        "messages": {
          "messageValues": [
            {
              "type": "ai",
              "message": "=The person I'm speaking to has the following details:\nfirstname: {{ $('Handoff Subworkflow1').first().json.firstname }}\nlastname: {{ $('Handoff Subworkflow1').first().json.firstname }}\nreason for call: {{ $('Handoff Subworkflow1').first().json.reason_for_call }}",
              "hideFromUI": true
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ced46068-440b-46b4-aa51-b5bb9d59a004",
      "name": "Continue Conversation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1220,
        580
      ],
      "parameters": {
        "text": "={{ $('Onboarding Agent').first().json.output }}",
        "chatId": "={{ $('Telegram Trigger').first().json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "connections": {
    "Model": {
      "ai_languageModel": [
        [
          {
            "node": "Onboarding Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "Onboarding Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Model1": {
      "ai_languageModel": [
        [
          {
            "node": "After Sales Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory1": {
      "ai_memory": [
        [
          {
            "node": "After Sales Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Memory2": {
      "ai_memory": [
        [
          {
            "node": "Update Agent Memory",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Memory3": {
      "ai_memory": [
        [
          {
            "node": "Update Agent Memory1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Notify user": {
      "main": [
        [
          {
            "node": "Set Interaction to Human",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handoff Tool": {
      "ai_tool": [
        [
          {
            "node": "After Sales Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Send Response": {
      "main": [
        [
          {
            "node": "Update Agent Memory1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "With Defaults": {
      "main": [
        [
          {
            "node": "Has All Criteria?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Onboarding Agent": {
      "main": [
        [
          {
            "node": "Get Onboarding Chat History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Get Interaction State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "After Sales Agent": {
      "main": [
        [
          {
            "node": "Send Response3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has All Criteria?": {
      "main": [
        [
          {
            "node": "Handoff Subworkflow1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Continue Conversation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Switch Interaction": {
      "main": [
        [
          {
            "node": "Get Canned Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "After Sales Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Onboarding Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handoff Subworkflow": {
      "main": [
        [
          {
            "node": "Notify user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Agent Memory": {
      "main": [
        [
          {
            "node": "Send Response2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handoff Subworkflow1": {
      "main": [
        [
          {
            "node": "Send Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Interaction State": {
      "main": [
        [
          {
            "node": "Switch Interaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Information Extractor": {
      "main": [
        [
          {
            "node": "With Defaults",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Interaction to Bot": {
      "main": [
        [
          {
            "node": "Update Agent Memory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Interaction to Human": {
      "main": [
        [
          {
            "node": "Human Handoff using Send and Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Onboarding Chat History": {
      "main": [
        [
          {
            "node": "Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Human Handoff using Send and Wait": {
      "main": [
        [
          {
            "node": "Set Interaction to Bot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}