{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "5d9cf2ce-4808-4d44-9f0d-2c15d8dcea91",
      "name": "Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -440,
        340
      ],
      "parameters": {
        "updates": [
          "*"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "22fc0669-96f2-4767-9bc2-03644c7ced21",
      "name": "Global data",
      "type": "n8n-nodes-base.set",
      "position": [
        -200,
        340
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "d5925fd8-abde-45bf-ac3d-22649ecb1f4e",
      "name": "Telegram1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1700,
        -360
      ],
      "parameters": {
        "text": "Photo",
        "chatId": "={{ $('Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5dc06f04-26b4-45af-99d6-a06b7c1b936d",
      "name": "Telegram2",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1700,
        -120
      ],
      "parameters": {
        "text": "File",
        "chatId": "={{ $('Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d036c602-17bb-45b5-b7b0-331339570cb3",
      "name": "Telegram3",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1260,
        460
      ],
      "parameters": {
        "text": "Callback",
        "chatId": "={{ $('Trigger').item.json.callback_query.data }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a86fe429-65df-471b-bdcb-e4765b14f109",
      "name": "Telegram4",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1940,
        -740
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b28ef71b-4e4b-48cb-b64d-029feee13ee4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        360
      ],
      "parameters": {
        "color": 7,
        "width": 1200.5980355767667,
        "height": 326.00218267794156,
        "content": "## Callback"
      },
      "typeVersion": 1
    },
    {
      "id": "d51d4ac4-e182-4245-b26f-248f99235de8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -920
      ],
      "parameters": {
        "color": 7,
        "width": 1201,
        "height": 481,
        "content": "## Text\n"
      },
      "typeVersion": 1
    },
    {
      "id": "05754c06-8f64-44c6-be55-3eb480e0cb3d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -400
      ],
      "parameters": {
        "color": 7,
        "width": 1200.5980355767667,
        "height": 198.69915410333263,
        "content": "## Photo"
      },
      "typeVersion": 1
    },
    {
      "id": "d9906042-25cd-4812-bbf1-4c46aa2c0492",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 1200.5980355767667,
        "height": 198.69915410333263,
        "content": "## File"
      },
      "typeVersion": 1
    },
    {
      "id": "0e0bfc7f-23a3-478e-a3a1-cffbc9f9f95e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        100
      ],
      "parameters": {
        "color": 7,
        "width": 1200.5980355767667,
        "height": 198.69915410333263,
        "content": "## Voice"
      },
      "typeVersion": 1
    },
    {
      "id": "a4519088-76c3-427c-95b6-7982814bf8e3",
      "name": "Telegram5",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1700,
        140
      ],
      "parameters": {
        "text": "Voice",
        "chatId": "={{ $('Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0b597db9-d240-4be3-90f3-095117b1c6bc",
      "name": "Switch_MessageType",
      "type": "n8n-nodes-base.switch",
      "position": [
        720,
        -120
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "360a2e5b-8736-488c-87dc-b5fcbd2b5102",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.message.hasOwnProperty('text') }}",
                    "rightValue": "/"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Photo",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.message.hasOwnProperty('photo') }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "File",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "eb5a5507-4374-46c9-b8eb-25b36cbe17ee",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.message.hasOwnProperty('document') }}",
                    "rightValue": "2"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Voice",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b5a43050-e657-4b56-aa9b-290a94aa8902",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.message.hasOwnProperty('voice') }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "efb08696-e76f-494c-8872-d117a379adec",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -1460
      ],
      "parameters": {
        "color": 7,
        "width": 1776,
        "height": 501,
        "content": "## Commands"
      },
      "typeVersion": 1
    },
    {
      "id": "7edecce3-6371-45ab-8dc1-f3e1a2052daa",
      "name": "Telegram6",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1840,
        -1180
      ],
      "parameters": {
        "text": "Don't know the command",
        "chatId": "={{ $('Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c3b030e2-a085-4e21-8645-0224d6bb7c35",
      "name": "Menu",
      "type": "n8n-nodes-base.switch",
      "position": [
        1420,
        460
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Conditions",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "798e1a40-e85b-4294-afcb-b129f92eb833",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Trigger').item.json.callback_query.data }}",
                    "rightValue": "menu_conditions"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Reviews",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f91b8a94-8961-4d20-ae9c-0ee34ff04000",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Trigger').item.json.callback_query.data }}",
                    "rightValue": "menu_reviews"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "71907904-21f3-459c-a445-ca44a432dd36",
      "name": "Command?",
      "type": "n8n-nodes-base.if",
      "position": [
        1340,
        -760
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a2025331-2c2b-4df8-9e23-37035a5c808a",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              },
              "leftValue": "={{ $('Trigger').item.json.message.text }}\n",
              "rightValue": "/"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "23e5c351-095b-4485-ad09-4dc4df195a8d",
      "name": "Change status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1460,
        1220
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "0"
          },
          "schema": [
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lastname",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Lastname",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Username",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Language",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Language",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Balance",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Balance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ]
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nTDcSinsEdKUA_BzISUwCa8WogQZXc7sjIdBvs3D7o0/edit#gid=0",
          "cachedResultName": "USERS"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/1nTDcSinsEdKUA_BzISUwCa8WogQZXc7sjIdBvs3D7o0/edit?gid=0#gid=0"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "12e9c69a-ac4d-4c1b-ba2e-18602a1ac715",
      "name": "Start bot?",
      "type": "n8n-nodes-base.if",
      "position": [
        1260,
        1040
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "253b4dfb-2b86-499a-a1a6-b6d916c9c25f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Trigger').item.json.my_chat_member.new_chat_member.status }}",
              "rightValue": "member"
            }
          ]
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b60a7063-a62f-4fbe-bc33-40ff55170f3e",
      "name": "Register",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1660,
        920
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": "XZKoHGcXJE1fUizb"
      },
      "typeVersion": 1
    },
    {
      "id": "6a7249dd-f664-4115-a907-883d1da4e1c5",
      "name": "Payment Handler",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1460,
        1660
      ],
      "parameters": {
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "lPX901W8CIMbKbww"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "586f875f-e119-467e-8a3d-6090b8eaed80",
      "name": "Trigger Data for Payment",
      "type": "n8n-nodes-base.set",
      "notes": "Chat ID required. \n\nSend action name to handle it inside Payment workflow",
      "position": [
        1280,
        1660
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ Object.assign({}, $('Trigger').item.json, { \"action\": \"HandlePayment\" }) }}"
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "f6f231a0-f5b7-4e58-acda-4f8dfe46a666",
      "name": "Trigger Data for Register",
      "type": "n8n-nodes-base.set",
      "position": [
        1460,
        920
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ $('Trigger').item.json }}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "b7287bcc-b4d0-4b42-bdfc-eeb8c1a0c289",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -20,
        340
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Message",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "360a2e5b-8736-488c-87dc-b5fcbd2b5102",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.message && (!$('Trigger').item.json.message.successful_payment) }}",
                    "rightValue": "/"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Callback",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "727fdd8d-ed98-4d64-b720-a10d78d73025",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.hasOwnProperty('callback_query') }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "System",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e014a230-519a-4028-98b3-33c10d408c85",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.hasOwnProperty('my_chat_member') }}",
                    "rightValue": "System"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Payment",
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b03aaa37-d57f-437c-acb2-de2068d3241a",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $('Trigger').item.json.hasOwnProperty('pre_checkout_query') || $('Trigger').item.json.message.hasOwnProperty('successful_payment') }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "509c5575-2226-486c-8398-887eb69a74f8",
      "name": "Data for Invoice",
      "type": "n8n-nodes-base.set",
      "notes": "Chat ID required. \n\nSend action name to handle it inside Payment workflow",
      "position": [
        1840,
        -1380
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={{ Object.assign({}, $('Trigger').item.json, { \"action\": \"SendInvoice\" }) }}"
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "6634d3a8-848a-4a14-ba37-58f33e3409f2",
      "name": "Send Invoice",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        2040,
        -1380
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": "lPX901W8CIMbKbww"
      },
      "typeVersion": 1
    },
    {
      "id": "e4bef639-3451-4ddc-ad26-481ba2acf33d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        820
      ],
      "parameters": {
        "color": 7,
        "width": 1417,
        "height": 613,
        "content": "## New member or Member left"
      },
      "typeVersion": 1
    },
    {
      "id": "4affaf7d-0694-4aa0-9616-8e12ca5bee15",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        1500
      ],
      "parameters": {
        "color": 7,
        "width": 1217,
        "height": 577,
        "content": "## Payment handler"
      },
      "typeVersion": 1
    },
    {
      "id": "58008f10-7336-4633-ab15-51556e3b53bd",
      "name": "Switch_Commands",
      "type": "n8n-nodes-base.switch",
      "position": [
        1540,
        -1280
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Command 1",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "360a2e5b-8736-488c-87dc-b5fcbd2b5102",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $('Trigger').item.json.message.text }}",
                    "rightValue": "/pay"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Command 2",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "546c81bf-2ee0-46b2-847b-1f92b84efaf3",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $('Trigger').item.json.message.text }}",
                    "rightValue": "/command2"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1a8af547-3492-4a07-9ab3-39f0fba25f0e",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        100
      ],
      "parameters": {
        "width": 260,
        "height": 400,
        "content": "### \ud83d\ude80 Set up Telegram Trigger\n\n1. Create a bot via [@BotFather](https://t.me/BotFather) and copy the **Bot Token**.\n2. Connect it to this node\n\n\ud83d\udcdd Tip: Send `/start` to your bot in Telegram to trigger the flow.\n\n[\ud83d\udd17 Full guide](https://docs.n8n.io/integrations/builtin/credentials/telegram/?utm_source=n8n_app&utm_medium=credential_settings&utm_campaign=create_new_credentials_modal)"
      },
      "typeVersion": 1
    },
    {
      "id": "15fb1560-8ac2-43b6-809e-a794bdb48cda",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1860,
        860
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 460,
        "content": "### \ud83d\udc4b New member joined? Register them automatically!\n\nUse this node when someone joins or leaves your Telegram group.\n\nPair it with the [n8n Telegram Payment & Registration Workflow \u2b50\ufe0f](https://viktorgubanov.gumroad.com/l/n8n-telegram-payment-workflow-stars) to:\n\n- \u2705 Automatically **register new users** in your database\n- \ud83d\udcac Send a **welcome message** or onboarding flow\n- \ud83d\udcbe Keep track of active members for payments, access control, or CRM\n- \ud83d\udd01 Remove access or mark users as inactive when they leave\n\n\u26a1\ufe0f Automate your group membership like a pro \u2014 start now with this ready-to-use workflow!"
      },
      "typeVersion": 1
    },
    {
      "id": "ffca62ab-00b4-4b0c-931c-08124fee3bdd",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        1540
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 420,
        "content": "### \ud83d\udcb8 Telegram Payments Made Easy with n8n\n\nThis ready-to-use workflow helps you:\n\n- \u2705 Accept payments **directly in Telegram**\n- \ud83d\udc64 Automatically **register paying users**\n- \u23f3 Control access based on subscription status or payment\n- \ud83d\udcca Save user data for analytics, CRM, or follow-up\n\nPerfect for:\n- Online schools  \n- Closed communities  \n- Paid bots or premium content  \n\n\ud83d\udc49 [Download the full template on Gumroad](https://viktorgubanov.gumroad.com/l/n8n-telegram-payment-workflow-stars) and start accepting payments today \u2014 no coding required.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9a6be66e-7e2a-4235-b358-d45d7c66cdde",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2280,
        -1420
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 420,
        "content": "### \ud83d\udcb8 Telegram Payments Made Easy with n8n\n\nThis ready-to-use workflow helps you:\n\n- \u2705 Accept payments **directly in Telegram**\n- \ud83d\udc64 Automatically **register paying users**\n- \u23f3 Control access based on subscription status or payment\n- \ud83d\udcca Save user data for analytics, CRM, or follow-up\n\nPerfect for:\n- Online schools  \n- Closed communities  \n- Paid bots or premium content  \n\n\ud83d\udc49 [Download the full template on Gumroad](https://viktorgubanov.gumroad.com/l/n8n-telegram-payment-workflow-stars) and start accepting payments today \u2014 no coding required.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e25379f9-1a25-477e-b65a-a5a6ed30efbd",
      "name": "TextDataExample",
      "type": "n8n-nodes-base.set",
      "position": [
        -200,
        160
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "\n  {\n    \"update_id\": 327139593,\n    \"message\": {\n      \"message_id\": 264,\n      \"from\": {\n        \"id\": 194972177,\n        \"is_bot\": false,\n        \"first_name\": \"Victor\",\n        \"last_name\": \"Gold\",\n        \"username\": \"gubanov_vn\",\n        \"language_code\": \"en\",\n        \"is_premium\": true\n      },\n      \"chat\": {\n        \"id\": 194972177,\n        \"first_name\": \"Victor\",\n        \"last_name\": \"Gold\",\n        \"username\": \"gubanov_vn\",\n        \"type\": \"private\"\n      },\n      \"date\": 1749162501,\n      \"text\": \"test text\"\n    }\n  }\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "5f3f8ab0-208d-4f10-b259-5014470e785a",
      "name": "Agent: Find in the Internet",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "disabled": true,
      "position": [
        2860,
        -420
      ],
      "parameters": {
        "name": "knolageBase"
      },
      "typeVersion": 2.1
    },
    {
      "id": "ab42d6cd-cd08-42e2-a3ed-5d4b9f56a7e0",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1600,
        -740
      ],
      "parameters": {
        "text": "=Answer the questions:\n{{ $('Trigger').item.json.message.text }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "8bdf237f-fbe0-47de-80b3-98f846c4a874",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1700,
        -580
      ],
      "parameters": {
        "sessionKey": "={{ $('Trigger').item.json.message.from.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 3
      },
      "typeVersion": 1.3
    },
    {
      "id": "5764520d-9be5-489a-8323-0fc96a1ea1fa",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1580,
        -580
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4f507f23-8517-479a-82c1-62034a30964e",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2220,
        -920
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 480,
        "content": "### \ud83e\uddea Basic AI agent for testing and play\n\nThis setup is a **lightweight prototype** that lets you:\n\n- \ud83d\udcac Chat with an AI via Telegram  \n- \ud83e\udde0 Retain short context (3 messages) per user  \n- \ud83d\udd01 Explore how memory + Langchain + OpenAI work in n8n  \n---\n\n### \u26a0\ufe0f Limitations for production use\n\nNot suitable for serious bots without upgrades:\n\n- \ud83d\udd04 **Memory resets** on restart \u2014 no long-term context  \n- \ud83e\udde0 **Shallow context** \u2014 only 3 messages, no thread awareness  \n- \ud83d\udc64 **No user profiles** \u2014 no saved data or personalization  \n- \ud83e\udde9 **No workflow actions** \u2014 can't trigger external APIs or steps  \n- \ud83d\udcc8 **Not scalable** \u2014 lacks logging, fallback logic, and analytics  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "85ecf7b0-1c85-4fc8-9aec-62d3abf563a1",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2780,
        -920
      ],
      "parameters": {
        "color": 4,
        "width": 1260,
        "height": 300,
        "content": "## \ud83e\udd16 Supercharge Your Bot with Task-YOUR_OPENAI_KEY_HERE AI Agents\n\n### Transform your Telegram bot from a simple responder into a **versatile business assistant** powered by modular AI agents. Each agent is designed to handle a focused task \u2014 acting like a smart, specialized teammate inside your workflow.\n\nSeamlessly integrated with the `Langchain Agent`, these tools let your bot **search, calculate, retrieve, and automate actions**, not just respond.\n\n\u26a1\ufe0f Want more than small talk?\nEnable these agents and let your bot work like part of your operations team.\n\n### You can find some of them in my [Gumroad page \u2192](https://viktorgubanov.gumroad.com/)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c376adc1-e468-4320-9b1f-3d79fcd8a575",
      "name": "Agent: Check Order Status",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "disabled": true,
      "position": [
        3380,
        -420
      ],
      "parameters": {
        "name": "knolageBase"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c0a0c774-3257-467b-8bee-bb17297a13d8",
      "name": "Agent: Search Internal Docs",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "disabled": true,
      "position": [
        3120,
        -420
      ],
      "parameters": {
        "name": "knolageBase"
      },
      "typeVersion": 2.1
    },
    {
      "id": "befaa35a-f56b-4918-b597-dd69e7c95900",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2780,
        -580
      ],
      "parameters": {
        "color": 4,
        "height": 340,
        "content": "### \ud83c\udf10 **Agent: Find in the Internet**  \n  \u2192 Searches live data online to answer fresh, time-sensitive queries."
      },
      "typeVersion": 1
    },
    {
      "id": "dade8080-91be-47ad-a15a-2d70ef7d8429",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3040,
        -580
      ],
      "parameters": {
        "color": 4,
        "height": 340,
        "content": "### \ud83d\udcc1 **Agent: Search Internal Docs**  \n  \u2192 Fetches relevant answers from your internal knowledge base (Notion, Google Drive, etc.)."
      },
      "typeVersion": 1
    },
    {
      "id": "4850057e-ef20-4067-9e64-f02bec9d49d9",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3300,
        -580
      ],
      "parameters": {
        "color": 4,
        "height": 340,
        "content": "### \ud83d\udce6 **Agent: Check Order Status** \n  \u2192 Instantly checks order progress from Google Sheets, Airtable, or CRM."
      },
      "typeVersion": 1
    },
    {
      "id": "cdab4f13-dc58-4b9b-89e3-c42a147fc95a",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3560,
        -580
      ],
      "parameters": {
        "color": 4,
        "height": 340,
        "content": "### \ud83d\udcb0 **Agent: Calculate Cost or Quote**  \n  \u2192 Generates quotes using predefined pricing logic based on user input. "
      },
      "typeVersion": 1
    },
    {
      "id": "2fcb9768-9d99-4541-b5cb-274988154b74",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3820,
        -580
      ],
      "parameters": {
        "height": 340,
        "content": "##### \u2753 Need help with your own?\n\n\n\n## Share your idea and get the estimation for your agent. \n\n### [Fill the form \u2192](https://tally.so/r/wQaeJA)"
      },
      "typeVersion": 1
    },
    {
      "id": "865b678f-5841-4c24-a0c2-8a11ba550b0c",
      "name": "Agent: Calculate Cost or Quote",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "disabled": true,
      "position": [
        3640,
        -420
      ],
      "parameters": {
        "name": "knolageBase"
      },
      "typeVersion": 2.1
    }
  ],
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Switch_MessageType",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Start bot?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Trigger Data for Payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger": {
      "main": [
        [
          {
            "node": "Global data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Telegram4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command?": {
      "main": [
        [
          {
            "node": "Switch_Commands",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram3": {
      "main": [
        [
          {
            "node": "Menu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram4": {
      "main": [
        []
      ]
    },
    "Start bot?": {
      "main": [
        [
          {
            "node": "Trigger Data for Register",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Change status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Global data": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Switch_Commands": {
      "main": [
        [
          {
            "node": "Data for Invoice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data for Invoice": {
      "main": [
        [
          {
            "node": "Send Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Switch_MessageType": {
      "main": [
        [
          {
            "node": "Command?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Data for Payment": {
      "main": [
        [
          {
            "node": "Payment Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Data for Register": {
      "main": [
        [
          {
            "node": "Register",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent: Search Internal Docs": {
      "ai_tool": [
        []
      ]
    }
  }
}