8
n8n 中文网amn8n.com

Digiflazz 管理

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 34 个节点。主要使用 Code, Switch, Telegram, HttpRequest, TelegramTrigger 等节点。 使用Telegram机器人和Digiflazz API自动化PPOB业务运营

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "nE3JTHLYHcVeLg70",
  "meta": {
    "instanceId": "b14f5dd921befc4584084cc386aea593f73c7c2b00b50933075d7967a4d1c502",
    "templateCredsSetupCompleted": true
  },
  "name": "Digiflazz 管理",
  "tags": [
    {
      "id": "TP4PAaWeCf1SVUdK",
      "name": "Digiflazz Management",
      "createdAt": "2025-09-18T03:22:47.434Z",
      "updatedAt": "2025-09-18T03:22:47.434Z"
    }
  ],
  "nodes": [
    {
      "id": "eb098b4a-557c-4c39-aa1f-d942bb1e98cf",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -640,
        176
      ],
      "webhookId": "digiflazz-main",
      "parameters": {
        "updates": [
          "message",
          "callback_query"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e4f4fde2-75c4-4c4f-9e70-5d9366e28857",
      "name": "主命令路由器",
      "type": "n8n-nodes-base.switch",
      "position": [
        -400,
        176
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "welcome",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message?.text || $json.callback_query?.data }}",
                    "rightValue": "/start"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "main_menu",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message?.text || $json.callback_query?.data }}",
                    "rightValue": "/menu"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "main_menu"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "check_balance",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "check_balance"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "list_products",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "list_products"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "topup_command",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message?.text || $json.callback_query?.data }}",
                    "rightValue": "/topup"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "new_transaction"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "deposit_request",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message?.text }}",
                    "rightValue": "/deposit"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "request_deposit"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "checkbill_command",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message?.text || $json.callback_query?.data }}",
                    "rightValue": "/checkbill"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "check_bills"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "paybill_command",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "or",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.message?.text || $json.callback_query?.data }}",
                    "rightValue": "/paybill"
                  },
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "pay_bills"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "history_command",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "transaction_history"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "process_topup",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "topup_"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "process_checkbill",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "checkbill_"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "process_paybill",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "startsWith"
                    },
                    "leftValue": "={{ $json.callback_query?.data }}",
                    "rightValue": "paybill_"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "c9456149-5d6b-4e75-b388-4fb83bcdb5dc",
      "name": "欢迎消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        -16
      ],
      "webhookId": "bad0c27e-f434-4480-8287-9dc2515b7bed",
      "parameters": {
        "text": "🚀 *Welcome to Digiflazz Management Bot!*\n\n✨ This bot helps you manage your mobile credit & PPOB business easily:\n\n💰 */balance* - Check deposit balance\n🛍️ */products* - View product list\n💳 */topup* - Prepaid transactions\n🏷️ */checkbill* - Check postpaid bills\n💰 */paybill* - Pay bills\n💸 */deposit* - Request deposit\n📋 */menu* - Main menu\n📈 */history* - Transaction history\n\n💡 *Tips:* Use inline keyboard for easier navigation!\n\n🔐 *Security:* This bot uses MD5 encryption for all API transactions",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "💰 Check Balance",
                "callbackData": "check_balance"
              },
              {
                "text": "🛍️ Products",
                "callbackData": "list_products"
              }
            ],
            [
              {
                "text": "💳 New Transaction",
                "callbackData": "new_transaction"
              },
              {
                "text": "💸 Deposit",
                "callbackData": "request_deposit"
              }
            ],
            [
              {
                "text": "🏷️ Check Bills",
                "callbackData": "check_bills"
              },
              {
                "text": "💰 Pay Bills",
                "callbackData": "pay_bills"
              }
            ],
            [
              {
                "text": "📈 History",
                "callbackData": "transaction_history"
              },
              {
                "text": "📋 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "40b35a12-4708-4311-9114-eea7c3a3d28b",
      "name": "主菜单",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        176
      ],
      "webhookId": "e5820042-1739-4251-b870-fe7365f8ea04",
      "parameters": {
        "text": "📋 *Digiflazz Management Main Menu*\n\nSelect the operation you want to perform:",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "💰 Check Balance",
                "callbackData": "check_balance"
              },
              {
                "text": "💸 Request Deposit",
                "callbackData": "request_deposit"
              }
            ],
            [
              {
                "text": "🛍️ Product List",
                "callbackData": "list_products"
              },
              {
                "text": "🔍 Search Product",
                "callbackData": "search_product"
              }
            ],
            [
              {
                "text": "💳 Prepaid Topup",
                "callbackData": "new_transaction"
              },
              {
                "text": "🏷️ Check Bills",
                "callbackData": "check_bills"
              }
            ],
            [
              {
                "text": "💰 Pay Bills",
                "callbackData": "pay_bills"
              },
              {
                "text": "📈 Transaction History",
                "callbackData": "transaction_history"
              }
            ],
            [
              {
                "text": "⚙️ Settings",
                "callbackData": "settings"
              },
              {
                "text": "❓ Help",
                "callbackData": "help"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4efaf4e7-40b8-49aa-b1fd-1900b9951c27",
      "name": "生成余额签名",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        368
      ],
      "parameters": {
        "jsCode": "// Generate MD5 signature for balance check\nconst crypto = require('crypto');\nconst username = '{{DIGIFLAZZ_USERNAME}}';\nconst apiKey = '{{DIGIFLAZZ_API_KEY}}';\nconst command = 'depo';\n\nconst signature = crypto.createHash('md5').update(username + apiKey + command).digest('hex');\n\nreturn {\n  json: {\n    cmd: 'deposit',\n    username: username,\n    sign: signature\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "13ec07db-dcfa-4dbb-99e5-ce6d539e192b",
      "name": "检查余额 API",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        384,
        368
      ],
      "parameters": {
        "url": "https://api.digiflazz.com/v1/cek-saldo",
        "method": "POST",
        "options": {
          "timeout": 30000,
          "response": {
            "response": {}
          }
        },
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3c2c2921-36a7-4619-9aca-98280052868f",
      "name": "格式化余额响应",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        576,
        368
      ],
      "parameters": {
        "jsCode": "// Handle both success and error responses for balance check\nconst response = $input.first();\n\nif (response.json && response.json.data) {\n  // Success response\n  const data = response.json.data;\n  const balance = Number(data.deposit || 0);\n  \n  let statusIcon = '';\n  let statusColor = '';\n  let warningText = '';\n  \n  if (balance < 100000) {\n    statusIcon = '🔴';\n    statusColor = 'Need Deposit';\n    warningText = '⚠️ *Warning:* Your balance is low! Please make a deposit soon.';\n  } else if (balance < 500000) {\n    statusIcon = '🟡';\n    statusColor = 'Good';\n    warningText = '✅ Your balance is sufficient for transactions.';\n  } else {\n    statusIcon = '🟢';\n    statusColor = 'Very Good';\n    warningText = '✅ Your balance is sufficient for transactions.';\n  }\n  \n  const message = `💰 *Balance Information*\\n\\n💳 Deposit Balance: *Rp ${balance.toLocaleString('id-ID')}*\\n\\n${warningText}\\n\\n📊 Status: ${statusIcon} ${statusColor}\\n\\n⏰ Checked at: ${new Date().toLocaleString('en-US', { timeZone: 'Asia/Jakarta' })} WIB`;\n  \n  return {\n    json: {\n      success: true,\n      message: message,\n      balance: balance,\n      status: statusColor\n    }\n  };\n} else {\n  // Error response\n  let errorMessage = '❌ *Failed to Check Balance*\\n\\n';\n  \n  if (response.json && response.json.data && response.json.data.rc) {\n    const rc = response.json.data.rc;\n    const msg = response.json.data.message || 'Unknown error';\n    errorMessage += `📋 Response Code: ${rc}\\n💬 Message: ${msg}\\n\\n`;\n    \n    switch (rc) {\n      case '41':\n        errorMessage += '💡 Solution: Invalid signature, check API Key';\n        break;\n      case '45':\n        errorMessage += '💡 Solution: IP not recognized, contact admin';\n        break;\n      default:\n        errorMessage += '💡 Contact customer service for assistance';\n    }\n  } else {\n    errorMessage += '🔍 Network error occurred\\n💡 Please try again in a few moments';\n  }\n  \n  return {\n    json: {\n      success: false,\n      message: errorMessage\n    }\n  };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "9895edc1-40bd-433c-bdf5-f8cc48ac8a75",
      "name": "发送余额结果",
      "type": "n8n-nodes-base.telegram",
      "position": [
        768,
        368
      ],
      "webhookId": "6b2eadb1-6aa8-4fa9-afbc-1acf15e290f9",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message?.chat?.id || $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "💸 Request Deposit",
                "callbackData": "request_deposit"
              },
              {
                "text": "📊 Refresh Balance",
                "callbackData": "check_balance"
              }
            ],
            [
              {
                "text": "💳 New Transaction",
                "callbackData": "new_transaction"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a31f1481-abd7-4778-b8aa-4a88d11b48e0",
      "name": "生成产品签名",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        560
      ],
      "parameters": {
        "jsCode": "// Generate MD5 signature for product list\nconst crypto = require('crypto');\nconst username = '{{DIGIFLAZZ_USERNAME}}';\nconst apiKey = '{{DIGIFLAZZ_API_KEY}}';\nconst command = 'pricelist';\n\nconst signature = crypto.createHash('md5').update(username + apiKey + command).digest('hex');\n\nreturn {\n  json: {\n    cmd: 'prepaid',\n    username: username,\n    sign: signature\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "e50db72a-6972-4137-a98d-930045894b61",
      "name": "获取产品 API",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        384,
        560
      ],
      "parameters": {
        "url": "https://api.digiflazz.com/v1/price-list",
        "method": "POST",
        "options": {
          "timeout": 30000,
          "response": {
            "response": {}
          }
        },
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "74155705-1e36-4684-949e-7d4dbcbdafc4",
      "name": "格式化产品列表",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        576,
        560
      ],
      "parameters": {
        "jsCode": "// Format product list response with categorization and pagination\nconst response = $input.first();\n\nif (response.json && response.json.data) {\n  const products = response.json.data;\n  \n  // Group products by category\n  const categories = {};\n  products.forEach(product => {\n    const category = product.category || 'Others';\n    if (!categories[category]) {\n      categories[category] = [];\n    }\n    categories[category].push(product);\n  });\n  \n  // Create menu for categories\n  let message = '🛍️ *Product Category List*\\n\\n';\n  const buttons = [];\n  const buttonRow = [];\n  \n  Object.keys(categories).forEach((category, index) => {\n    const count = categories[category].length;\n    message += `${index + 1}. ${category} (${count} products)\\n`;\n    \n    buttonRow.push({\n      text: `${category} (${count})`,\n      callbackData: `category_${category.replace(/\\s+/g, '_').toLowerCase()}`\n    });\n    \n    // Add row every 2 buttons\n    if (buttonRow.length === 2) {\n      buttons.push([...buttonRow]);\n      buttonRow.length = 0;\n    }\n  });\n  \n  // Add remaining button if any\n  if (buttonRow.length > 0) {\n    buttons.push(buttonRow);\n  }\n  \n  // Add navigation buttons\n  buttons.push([{\n    text: '🔙 Main Menu',\n    callbackData: 'main_menu'\n  }]);\n  \n  return {\n    json: {\n      success: true,\n      message: message,\n      buttons: buttons,\n      categories: categories\n    }\n  };\n} else {\n  return {\n    json: {\n      success: false,\n      message: '❌ *Failed to Load Product List*\\n\\n🔍 An error occurred while retrieving product data\\n💡 Please try again in a few moments',\n      buttons: [[{\n        text: '🔄 Try Again',\n        callbackData: 'list_products'\n      }, {\n        text: '🔙 Main Menu',\n        callbackData: 'main_menu'\n      }]]\n    }\n  };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "afb9ab0d-2fb6-4b69-8d26-bdebe8196f92",
      "name": "发送产品分类",
      "type": "n8n-nodes-base.telegram",
      "position": [
        768,
        560
      ],
      "webhookId": "5f63afe7-695e-4779-a643-02d6a740396a",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message?.chat?.id || $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": "={{ $json.buttons }}"
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ed41f33f-964c-4c36-a444-c28ea7fdafc0",
      "name": "存款信息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        752
      ],
      "webhookId": "3d326ff4-0139-46c7-96cd-5dac5dfaa99a",
      "parameters": {
        "text": "💸 *Request Deposit*\n\n📋 To make a deposit, please contact admin with the following information:\n\n👤 Username: `{{DIGIFLAZZ_USERNAME}}`\n💰 Amount: _[Mention the amount you want to deposit]_\n🏦 Method: _[Bank Transfer / E-Wallet / etc]_\n\n📞 **Admin Contact:**\n📱 Telegram: @digiflazzadmin\n📲 WhatsApp: 08123456789\n📧 Email: support@digiflazz.com\n\n⏰ **Operating Hours:**\nMonday - Friday: 08:00 - 17:00 WIB\nSaturday: 08:00 - 14:00 WIB\n\n💡 *Tips:* Include transfer proof screenshot for faster processing",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "💰 Check Balance",
                "callbackData": "check_balance"
              },
              {
                "text": "📋 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2e672107-c44d-4e5b-82bf-e2cd03182b2c",
      "name": "充值菜单",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        944
      ],
      "webhookId": "bfcf0788-9e76-4513-88ad-9370b562eb9e",
      "parameters": {
        "text": "💳 *Prepaid Topup Transaction*\n\nSelect product type for topup:",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "📱 Mobile Credit",
                "callbackData": "topup_pulsa"
              },
              {
                "text": "📶 Data Package",
                "callbackData": "topup_data"
              }
            ],
            [
              {
                "text": "⚡ PLN Token",
                "callbackData": "topup_pln"
              },
              {
                "text": "🎮 Game Voucher",
                "callbackData": "topup_game"
              }
            ],
            [
              {
                "text": "💰 E-Wallet",
                "callbackData": "topup_ewallet"
              },
              {
                "text": "📺 TV Voucher",
                "callbackData": "topup_tv"
              }
            ],
            [
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7b95428d-2374-4b09-8041-eec0b4de3df7",
      "name": "检查账单菜单",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        1136
      ],
      "webhookId": "6b24b2bf-e0bb-45ba-bcc3-3d7ae63c3c02",
      "parameters": {
        "text": "🏷️ *Check Postpaid Bills*\n\nSelect the type of bill you want to check:",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "⚡ PLN Postpaid",
                "callbackData": "checkbill_pln"
              },
              {
                "text": "📱 Telkom",
                "callbackData": "checkbill_telkom"
              }
            ],
            [
              {
                "text": "📺 Cable TV",
                "callbackData": "checkbill_tv"
              },
              {
                "text": "🌐 Internet",
                "callbackData": "checkbill_internet"
              }
            ],
            [
              {
                "text": "💰 Credit Card",
                "callbackData": "checkbill_cc"
              },
              {
                "text": "🏦 Multifinance",
                "callbackData": "checkbill_finance"
              }
            ],
            [
              {
                "text": "💧 PDAM",
                "callbackData": "checkbill_pdam"
              },
              {
                "text": "📻 Radio",
                "callbackData": "checkbill_radio"
              }
            ],
            [
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2a430daf-17d2-4873-a39b-d3efb301a019",
      "name": "支付账单菜单",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        1328
      ],
      "webhookId": "940cdd48-e761-4205-8335-c8212647293a",
      "parameters": {
        "text": "💰 *Pay Bills*\n\nSelect the type of bill you want to pay:",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "⚡ PLN Postpaid",
                "callbackData": "paybill_pln"
              },
              {
                "text": "📱 Telkom",
                "callbackData": "paybill_telkom"
              }
            ],
            [
              {
                "text": "📺 Cable TV",
                "callbackData": "paybill_tv"
              },
              {
                "text": "🌐 Internet",
                "callbackData": "paybill_internet"
              }
            ],
            [
              {
                "text": "💰 Credit Card",
                "callbackData": "paybill_cc"
              },
              {
                "text": "🏦 Multifinance",
                "callbackData": "paybill_finance"
              }
            ],
            [
              {
                "text": "💧 PDAM",
                "callbackData": "paybill_pdam"
              },
              {
                "text": "📻 Radio",
                "callbackData": "paybill_radio"
              }
            ],
            [
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0bc59035-ccc6-4a29-990e-01ec85a2825e",
      "name": "处理充值选择",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        944
      ],
      "parameters": {
        "jsCode": "// Extract callback data and prepare topup transaction\nconst callbackData = $('Telegram Trigger').item.json.callback_query.data;\nconst productType = callbackData.replace('topup_', '');\n\n// Set user state for awaiting input\nconst userId = $('Telegram Trigger').item.json.callback_query.from.id;\n\nlet message = '';\nlet inputPrompt = '';\n\nswitch(productType) {\n  case 'pulsa':\n    message = '📱 *Mobile Credit Topup*\\n\\nℹ️ Enter the mobile number to be topped up:\\n\\n*Format:* 08123456789\\n*Example:* 081234567890';\n    inputPrompt = 'Enter mobile number:';\n    break;\n  case 'data':\n    message = '📶 *Data Package Topup*\\n\\nℹ️ Enter mobile number for data package:\\n\\n*Format:* 08123456789\\n*Example:* 081234567890';\n    inputPrompt = 'Enter mobile number:';\n    break;\n  case 'pln':\n    message = '⚡ *PLN Token Topup*\\n\\nℹ️ Enter PLN meter number:\\n\\n*Format:* 12345678901\\n*Example:* 12345678901 (11 digits)';\n    inputPrompt = 'Enter PLN meter number:';\n    break;\n  case 'game':\n    message = '🎮 *Game Voucher Topup*\\n\\nℹ️ Enter game User ID:\\n\\n*Format:* 123456789\\n*Example:* Mobile Legends: 123456789 (1234)';\n    inputPrompt = 'Enter User ID:';\n    break;\n  case 'ewallet':\n    message = '💰 *E-Wallet Topup*\\n\\nℹ️ Enter e-wallet mobile number:\\n\\n*Format:* 08123456789\\n*Example:* 081234567890';\n    inputPrompt = 'Enter mobile number:';\n    break;\n  case 'tv':\n    message = '📺 *TV Voucher Topup*\\n\\nℹ️ Enter customer number:\\n\\n*Format:* 12345678\\n*Example:* 12345678';\n    inputPrompt = 'Enter customer number:';\n    break;\n  default:\n    message = '❌ Unknown product type';\n}\n\nreturn {\n  json: {\n    message: message,\n    productType: productType,\n    userId: userId,\n    step: 'awaiting_number',\n    inputPrompt: inputPrompt\n  }\n};\n\n// Enhanced input validation and session management\nconst messageText = $('Telegram Trigger').item.json.message?.text;\nconst userId = $('Telegram Trigger').item.json.message?.from?.id;\n\n// Validation functions\nfunction validatePhoneNumber(phone) {\n  const phoneRegex = /^(\\+62|62|0)([0-9]{9,12})$/;\n  return phoneRegex.test(phone.replace(/[-\\s]/g, ''));\n}\n\nfunction validatePLNNumber(pln) {\n  const plnRegex = /^[0-9]{11,12}$/;\n  return plnRegex.test(pln);\n}\n\nfunction validateAmount(amount) {\n  const num = parseFloat(amount.replace(/[^\\d]/g, ''));\n  return num >= 10000 && num <= 10000000; // 10k - 10M\n}\n\n// Session state management (simple in-memory for demo)\n// In production, use Redis or database\nconst userSessions = global.userSessions || (global.userSessions = {});\n\nreturn {\n  json: {\n    validation: {\n      validatePhoneNumber,\n      validatePLNNumber,\n      validateAmount\n    },\n    session: userSessions[userId] || {},\n    userId: userId,\n    messageText: messageText\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "fdb35679-50ed-4f18-b967-546af8dfa98b",
      "name": "处理检查账单选择",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        1136
      ],
      "parameters": {
        "jsCode": "// Extract callback data and prepare check bill inquiry\nconst callbackData = $('Telegram Trigger').item.json.callback_query.data;\nconst billType = callbackData.replace('checkbill_', '');\n\n// Set user state for awaiting input\nconst userId = $('Telegram Trigger').item.json.callback_query.from.id;\n\nlet message = '';\nlet inputPrompt = '';\n\nswitch(billType) {\n  case 'pln':\n    message = '⚡ *Check PLN Postpaid Bill*\\n\\nℹ️ Enter PLN Customer ID:\\n\\n*Format:* 123456789012\\n*Example:* 123456789012 (12 digits)';\n    inputPrompt = 'Enter PLN Customer ID:';\n    break;\n  case 'telkom':\n    message = '📱 *Check Telkom Bill*\\n\\nℹ️ Enter Telkom phone number:\\n\\n*Format:* 021xxxxxxx\\n*Example:* 02112345678';\n    inputPrompt = 'Enter phone number:';\n    break;\n  case 'tv':\n    message = '📺 *Check Cable TV Bill*\\n\\nℹ️ Enter TV customer number:\\n\\n*Format:* 12345678\\n*Example:* 12345678';\n    inputPrompt = 'Enter customer number:';\n    break;\n  case 'internet':\n    message = '🌐 *Check Internet Bill*\\n\\nℹ️ Enter Internet customer number:\\n\\n*Format:* 123456789\\n*Example:* 123456789';\n    inputPrompt = 'Enter customer number:';\n    break;\n  case 'cc':\n    message = '💰 *Check Credit Card Bill*\\n\\nℹ️ Enter credit card number:\\n\\n*Format:* 4xxx-xxxx-xxxx-xxxx\\n*Example:* 4111-1111-1111-1111';\n    inputPrompt = 'Enter card number:';\n    break;\n  case 'finance':\n    message = '🏦 *Check Multifinance Bill*\\n\\nℹ️ Enter contract number:\\n\\n*Format:* 123456789\\n*Example:* 123456789';\n    inputPrompt = 'Enter contract number:';\n    break;\n  case 'pdam':\n    message = '💧 *Check PDAM Bill*\\n\\nℹ️ Enter PDAM customer number:\\n\\n*Format:* 123456789\\n*Example:* 123456789';\n    inputPrompt = 'Enter customer number:';\n    break;\n  default:\n    message = '❌ Unknown bill type';\n}\n\nreturn {\n  json: {\n    message: message,\n    billType: billType,\n    userId: userId,\n    step: 'awaiting_customer_id',\n    inputPrompt: inputPrompt\n  }\n};\n\n// Enhanced input validation and session management\nconst messageText = $('Telegram Trigger').item.json.message?.text;\nconst userId = $('Telegram Trigger').item.json.message?.from?.id;\n\n// Validation functions\nfunction validatePhoneNumber(phone) {\n  const phoneRegex = /^(\\+62|62|0)([0-9]{9,12})$/;\n  return phoneRegex.test(phone.replace(/[-\\s]/g, ''));\n}\n\nfunction validatePLNNumber(pln) {\n  const plnRegex = /^[0-9]{11,12}$/;\n  return plnRegex.test(pln);\n}\n\nfunction validateAmount(amount) {\n  const num = parseFloat(amount.replace(/[^\\d]/g, ''));\n  return num >= 10000 && num <= 10000000; // 10k - 10M\n}\n\n// Session state management (simple in-memory for demo)\n// In production, use Redis or database\nconst userSessions = global.userSessions || (global.userSessions = {});\n\nreturn {\n  json: {\n    validation: {\n      validatePhoneNumber,\n      validatePLNNumber,\n      validateAmount\n    },\n    session: userSessions[userId] || {},\n    userId: userId,\n    messageText: messageText\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "6e617253-ce99-4ab5-bac5-c4b22bda1ec8",
      "name": "处理支付账单选择",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        1328
      ],
      "parameters": {
        "jsCode": "// Extract callback data and prepare pay bill transaction\nconst callbackData = $('Telegram Trigger').item.json.callback_query.data;\nconst billType = callbackData.replace('paybill_', '');\n\n// Set user state for awaiting input\nconst userId = $('Telegram Trigger').item.json.callback_query.from.id;\n\nlet message = '';\nlet inputPrompt = '';\n\nswitch(billType) {\n  case 'pln':\n    message = '⚡ *Pay PLN Postpaid Bill*\\n\\nℹ️ Enter PLN Customer ID:\\n\\n*Format:* 123456789012\\n*Example:* 123456789012 (12 digits)\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter PLN Customer ID:';\n    break;\n  case 'telkom':\n    message = '📱 *Pay Telkom Bill*\\n\\nℹ️ Enter Telkom phone number:\\n\\n*Format:* 021xxxxxxx\\n*Example:* 02112345678\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter phone number:';\n    break;\n  case 'tv':\n    message = '📺 *Pay Cable TV Bill*\\n\\nℹ️ Enter TV customer number:\\n\\n*Format:* 12345678\\n*Example:* 12345678\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter customer number:';\n    break;\n  case 'internet':\n    message = '🌐 *Pay Internet Bill*\\n\\nℹ️ Enter Internet customer number:\\n\\n*Format:* 123456789\\n*Example:* 123456789\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter customer number:';\n    break;\n  case 'cc':\n    message = '💰 *Pay Credit Card Bill*\\n\\nℹ️ Enter credit card number:\\n\\n*Format:* 4xxx-xxxx-xxxx-xxxx\\n*Example:* 4111-1111-1111-1111\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter card number:';\n    break;\n  case 'finance':\n    message = '🏦 *Pay Multifinance Bill*\\n\\nℹ️ Enter contract number:\\n\\n*Format:* 123456789\\n*Example:* 123456789\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter contract number:';\n    break;\n  case 'pdam':\n    message = '💧 *Pay PDAM Bill*\\n\\nℹ️ Enter PDAM customer number:\\n\\n*Format:* 123456789\\n*Example:* 123456789\\n\\n💡 *Tips:* Make sure to check the bill before paying';\n    inputPrompt = 'Enter customer number:';\n    break;\n  default:\n    message = '❌ Unknown bill type';\n}\n\nreturn {\n  json: {\n    message: message,\n    billType: billType,\n    userId: userId,\n    step: 'awaiting_customer_id_pay',\n    inputPrompt: inputPrompt\n  }\n};\n\n// Enhanced input validation and session management\nconst messageText = $('Telegram Trigger').item.json.message?.text;\nconst userId = $('Telegram Trigger').item.json.message?.from?.id;\n\n// Validation functions\nfunction validatePhoneNumber(phone) {\n  const phoneRegex = /^(\\+62|62|0)([0-9]{9,12})$/;\n  return phoneRegex.test(phone.replace(/[-\\s]/g, ''));\n}\n\nfunction validatePLNNumber(pln) {\n  const plnRegex = /^[0-9]{11,12}$/;\n  return plnRegex.test(pln);\n}\n\nfunction validateAmount(amount) {\n  const num = parseFloat(amount.replace(/[^\\d]/g, ''));\n  return num >= 10000 && num <= 10000000; // 10k - 10M\n}\n\n// Session state management (simple in-memory for demo)\n// In production, use Redis or database\nconst userSessions = global.userSessions || (global.userSessions = {});\n\nreturn {\n  json: {\n    validation: {\n      validatePhoneNumber,\n      validatePLNNumber,\n      validateAmount\n    },\n    session: userSessions[userId] || {},\n    userId: userId,\n    messageText: messageText\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "f74d13ac-93ec-42f7-9faa-e59ae4107784",
      "name": "发送充值输入提示",
      "type": "n8n-nodes-base.telegram",
      "position": [
        384,
        944
      ],
      "webhookId": "92930e11-8562-4e05-9ca1-09bb8866c65b",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "new_transaction"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b4755d61-45f8-4b61-b569-91f6637fa535",
      "name": "发送检查账单输入提示",
      "type": "n8n-nodes-base.telegram",
      "position": [
        384,
        1136
      ],
      "webhookId": "867442b8-13e7-45da-a3ca-165cf158b36f",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "check_bills"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c36b29d2-73d0-4b87-9b7e-1c2a053aea45",
      "name": "发送支付账单输入提示",
      "type": "n8n-nodes-base.telegram",
      "position": [
        384,
        1328
      ],
      "webhookId": "5a97bc21-e66c-4074-b819-a91324d07062",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "pay_bills"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "92ffd1c4-6cb2-4328-a12d-b771ea582357",
      "name": "交易历史",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -64,
        1552
      ],
      "webhookId": "5a8ec26d-3659-4c7b-ab68-59d19dac309b",
      "parameters": {
        "text": "📈 *Transaction History*\n\nTransaction history for the last 7 days:",
        "chatId": "={{ $json.message?.chat?.id || $json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "💰 Check Balance",
                "callbackData": "check_balance"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c2752415-3b20-4988-be7a-4fea731b2fe2",
      "name": "处理存款信息",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        752
      ],
      "parameters": {
        "jsCode": "// Process deposit request information\nconst userId = $('Telegram Trigger').item.json.callback_query?.from?.id;\nconst username = $('Telegram Trigger').item.json.callback_query?.from?.username || 'user';\n\nconst message = `💸 *Request Deposit - Complete Information*\n\n📋 **Required Information:**\n• Username: \\`{{DIGIFLAZZ_USERNAME}}\\`\n• Telegram ID: \\`${userId}\\`\n• Username: @${username}\n\n💰 **Deposit Methods:**\n🏦 Bank Transfer (BCA, Mandiri, BRI, BNI)\n💳 E-Wallet (OVO, DANA, GoPay, ShopeePay)\n🏪 Convenience Store (Alfamart, Indomaret)\n\n📞 **Contact Admin:**\n📱 Telegram: @digiflazzadmin\n📲 WhatsApp: +6281234567890\n📧 Email: support@digiflazz.co.id\n\n⏰ **Processing Time:**\n• Bank Transfer: 1-15 minutes\n• E-Wallet: Instant\n• Convenience Store: 1-24 hours\n\n💡 **Tips:**\n• Minimum deposit: Rp 50,000\n• Include your username in transfer notes\n• Send transfer proof for faster processing`;\n\nreturn {\n  json: {\n    message: message,\n    success: true\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "3862bfa3-98f2-476e-a35e-4b3698073e4f",
      "name": "发送存款信息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        384,
        752
      ],
      "webhookId": "92930e11-8562-4e05-9ca1-09bb8866c65b-1",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "new_transaction"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a1517503-b1e2-414e-81c4-c29d2d3d90b4",
      "name": "处理交易历史信息",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        192,
        1552
      ],
      "parameters": {
        "jsCode": "// Generate MD5 signature for transaction history\nconst crypto = require('crypto');\nconst username = '{{DIGIFLAZZ_USERNAME}}';\nconst apiKey = '{{DIGIFLAZZ_API_KEY}}';\nconst command = 'history';\n\nconst signature = crypto.createHash('md5').update(username + apiKey + command).digest('hex');\n\nreturn {\n  json: {\n    cmd: 'history',\n    username: username,\n    sign: signature,\n    start_date: new Date(Date.now() - 7*24*60*60*1000).toISOString().split('T')[0], // 7 days ago\n    end_date: new Date().toISOString().split('T')[0] // today\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "254c70d2-1307-4bf5-84aa-20efb571c154",
      "name": "发送交易信息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        384,
        1552
      ],
      "webhookId": "92930e11-8562-4e05-9ca1-09bb8866c65b-1",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "new_transaction"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "034d39ee-eceb-4049-a3e9-2dfd98af03ae",
      "name": "处理菜单",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        144,
        176
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "de28f03f-0cb6-4fcb-879f-10cebfbab73a",
      "name": "发送菜单信息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        336,
        176
      ],
      "webhookId": "92930e11-8562-4e05-9ca1-09bb8866c65b-1",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "new_transaction"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5efd4173-86f0-4832-a337-230e8943d6d6",
      "name": "处理欢迎信息",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        144,
        -16
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "b4217d6a-3aa3-4c26-a85a-2d9fd3a3af38",
      "name": "发送欢迎信息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        336,
        -16
      ],
      "webhookId": "92930e11-8562-4e05-9ca1-09bb8866c65b-1",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "={{ $('Telegram Trigger').item.json.callback_query?.message?.chat?.id }}",
        "replyMarkup": {
          "type": "inlineKeyboard",
          "values": [
            [
              {
                "text": "❌ Cancel",
                "callbackData": "new_transaction"
              },
              {
                "text": "🔙 Main Menu",
                "callbackData": "main_menu"
              }
            ]
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "5UNbimarOaH1QxRo",
          "name": "Telegram account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7daf6540-2b6b-46f7-946f-c0dc7ec03190",
      "name": "执行交易 API",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        736,
        992
      ],
      "parameters": {
        "url": "https://api.digiflazz.com/v1/transaction",
        "method": "POST",
        "options": {
          "timeout": 30000
        },
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cc088e6d-3611-411d-99c8-e0311aad801f",
      "name": "账单查询 API",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        736,
        1184
      ],
      "parameters": {
        "url": "https://api.digiflazz.com/v1/inquiry",
        "method": "POST",
        "options": {
          "timeout": 30000
        },
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "58a3cb4b-e01d-4ce0-9b0c-d8ed8a68bda4",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        336
      ],
      "parameters": {
        "width": 400,
        "height": 2288,
        "content": "## Digiflazz 管理 — Telegram 机器人 (n8n)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0e51bd46-1467-478c-9f89-9183327ab66d",
  "connections": {
    "Main Menu": {
      "main": [
        [
          {
            "node": "Process Menu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Topup Menu": {
      "main": [
        [
          {
            "node": "Process Topup Selection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Menu": {
      "main": [
        [
          {
            "node": "Send Menu Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pay Bill Menu": {
      "main": [
        [
          {
            "node": "Process Pay Bill Selection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Bill Menu": {
      "main": [
        [
          {
            "node": "Process Check Bill Selection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Welcome": {
      "main": [
        [
          {
            "node": "Send Welcome",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome Message": {
      "main": [
        [
          {
            "node": "Process Welcome",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Products API": {
      "main": [
        [
          {
            "node": "Format Product List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Main Command Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Balance API": {
      "main": [
        [
          {
            "node": "Format Balance Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deposit Information": {
      "main": [
        [
          {
            "node": "Process Deposit Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Product List": {
      "main": [
        [
          {
            "node": "Send Product Categories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Main Command Router": {
      "main": [
        [
          {
            "node": "Welcome Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Main Menu",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Balance Signature",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Product Signature",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Topup Menu",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deposit Information",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Bill Menu",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Pay Bill Menu",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Transaction History",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Topup Selection",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Check Bill Selection",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Pay Bill Selection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transaction History": {
      "main": [
        [
          {
            "node": "Process Trancation History Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Balance Response": {
      "main": [
        [
          {
            "node": "Send Balance Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Topup Selection": {
      "main": [
        [
          {
            "node": "Send Topup Input Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Topup Input Prompt": {
      "main": [
        [
          {
            "node": "Execute Transaction API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Deposit Information": {
      "main": [
        [
          {
            "node": "Execute Transaction API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Balance Signature": {
      "main": [
        [
          {
            "node": "Check Balance API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Product Signature": {
      "main": [
        [
          {
            "node": "Get Products API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Pay Bill Selection": {
      "main": [
        [
          {
            "node": "Send Pay Bill Input Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Pay Bill Input Prompt": {
      "main": [
        [
          {
            "node": "Bill Inquiry API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Deposit Information": {
      "main": [
        [
          {
            "node": "Send Deposit Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Check Bill Selection": {
      "main": [
        [
          {
            "node": "Send Check Bill Input Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Check Bill Input Prompt": {
      "main": [
        [
          {
            "node": "Bill Inquiry API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Trancation History Information": {
      "main": [
        [
          {
            "node": "Send Transaction Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量34
分类2
节点类型6
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Tegar karunia ilham

Tegar karunia ilham

@tegarkaruniailham

Helping business owners & marketers automate their processes with n8n. Specialist in custom workflows, API integrations, and template development. 📈 100+ successful automation projects 🔧 Premium n8n templates available 💡 Free consultation for custom automation Book a consultation for your business digital transformation!"

外部链接
在 n8n.io 查看

分享此工作流