Administración de Digiflazz

Avanzado

Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 34 nodos.Utiliza principalmente nodos como Code, Switch, Telegram, HttpRequest, TelegramTrigger. Automatizar las operaciones comerciales PPOB con un bot de Telegram y la API de Digiflazz

Requisitos previos
  • Bot Token de Telegram
  • Pueden requerirse credenciales de autenticación para la API de destino
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "nE3JTHLYHcVeLg70",
  "meta": {
    "instanceId": "b14f5dd921befc4584084cc386aea593f73c7c2b00b50933075d7967a4d1c502",
    "templateCredsSetupCompleted": true
  },
  "name": "Digiflaz Management",
  "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 Trigger",
      "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": "Enrutador de Comandos Principal",
      "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": "Mensaje de Bienvenida",
      "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": "Menú Principal",
      "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": "Generar Firma de Saldo",
      "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": "Verificar Saldo 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": "Formatear Respuesta de Saldo",
      "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": "Enviar Resultado de Saldo",
      "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": "Generar Firma de Producto",
      "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": "Obtener Productos 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": "Formatear Lista de Productos",
      "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": "Enviar Categorías de Productos",
      "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": "Información de Depósito",
      "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": "Menú de Recarga",
      "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": "Menú de Consulta de Factura",
      "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": "Menú de Pago de Factura",
      "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": "Procesar Selección de Recarga",
      "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": "Procesar Selección de Consulta de Factura",
      "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": "Procesar Selección de Pago de Factura",
      "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": "Enviar Solicitud de Datos para Recarga",
      "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": "Enviar Solicitud de Datos para Consulta de Factura",
      "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": "Enviar Solicitud de Datos para Pago de Factura",
      "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": "Historial de Transacciones",
      "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": "Procesar Información de Depósito",
      "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": "Enviar Información de Depósito",
      "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": "Procesar Información de Historial de Transacciones",
      "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": "Enviar Información de Transacción",
      "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": "Procesar Menú",
      "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": "Enviar Información del Menú",
      "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": "Procesar Bienvenida",
      "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": "Enviar Bienvenida",
      "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": "Ejecutar Transacción 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": "Consulta de Factura 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": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        336
      ],
      "parameters": {
        "width": 400,
        "height": 2288,
        "content": "## Digiflazz Management — Telegram Bot (n8n)\n\n**Install & Usage Guide**\n\n## What this workflow does\n\nA Telegram bot to manage your PPOB business:\n\n* Check **deposit balance**\n* Browse **product price list**\n* Start **prepaid topups**\n* **Check** and **pay** postpaid bills\n* Show **transaction history**\n  (Inline keyboards + message/callback handling are included.)\n\n## Prerequisites\n\n* n8n up and running (self-hosted or desktop).\n* A **Telegram Bot Token** (create via @BotFather).\n* A **Digiflazz** account with **Username** and **API Key**.\n\n## Environment variables (set in n8n)\n\n* `DIGIFLAZZ_USERNAME` = your Digiflazz username\n* `DIGIFLAZZ_API_KEY` = your Digiflazz API key\n\n> n8n → Settings (or container env) → add the vars → restart if needed.\n\n## Install steps\n\n1. **Import** the workflow JSON into n8n.\n2. Open **Telegram Trigger** → select your **Telegram credentials**.\n\n   * Updates listened: `message` & `callback_query` (already configured).\n3. **Activate** the workflow.\n4. On Telegram, DM your bot and send `/start`.\n\n## How to use (commands & buttons)\n\n* `/start` → Welcome & quick actions.\n* `/menu` → Main menu:\n\n  * **💰 Check Balance** → calls `cek-saldo` and formats status with traffic-light icons (Red < Rp100k, Yellow < Rp500k, Green ≥ Rp500k). Timestamp uses **Asia/Jakarta**.\n  * **🛍️ Product List** → calls `price-list`, groups by category, renders inline buttons.\n  * **💳 Prepaid Topup** → choose product type (Pulsa/Data/PLN/Game/E-Wallet/TV). Bot prompts for the required number/ID.\n  * **🏷️ Check Bills** / **💰 Pay Bills** → choose bill type, bot prompts for customer ID; workflow prepares inquiry/payment call.\n  * **💸 Deposit** → shows admin contact & deposit tips.\n  * **📈 History** → scaffold provided for last 7 days.\n\n## Under the hood (API & signing)\n\n* **MD5 signature** is built in Code nodes using Node’s `crypto`, e.g.\n  `md5(username + apiKey + 'pricelist' | 'depo' | 'history')`.\n* HTTP nodes hit Digiflazz endpoints: `cek-saldo`, `price-list`, `transaction`, `inquiry`.\n* Switch router maps `/start`, `/menu`, and inline `callback_data` to the right branch.\n\n## Customize\n\n* Update admin contacts/text in **Telegram** nodes to your details.\n* Map additional product/bill flows and payload fields as needed.\n* For production, replace the simple in-memory session in Code nodes with **Redis/DB**.\n\n## Notes & gaps\n\n* **Transaction History** and **category-level product clicks** are scaffolded; add the missing HTTP calls/routers if you want full results in chat.\n* Keep your API key in env vars—**never** hard-code in nodes.\n\n**Quick test**\n\n1. Send `/start` → tap **💰 Check Balance**.\n2. Tap **🛍️ Product List** → see grouped categories.\n3. Tap **💳 Prepaid Topup** → follow prompts.\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0e51bd46-1467-478c-9f89-9183327ab66d",
  "connections": {
    "40b35a12-4708-4311-9114-eea7c3a3d28b": {
      "main": [
        [
          {
            "node": "034d39ee-eceb-4049-a3e9-2dfd98af03ae",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2e672107-c44d-4e5b-82bf-e2cd03182b2c": {
      "main": [
        [
          {
            "node": "0bc59035-ccc6-4a29-990e-01ec85a2825e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "034d39ee-eceb-4049-a3e9-2dfd98af03ae": {
      "main": [
        [
          {
            "node": "de28f03f-0cb6-4fcb-879f-10cebfbab73a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2a430daf-17d2-4873-a39b-d3efb301a019": {
      "main": [
        [
          {
            "node": "6e617253-ce99-4ab5-bac5-c4b22bda1ec8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7b95428d-2374-4b09-8041-eec0b4de3df7": {
      "main": [
        [
          {
            "node": "fdb35679-50ed-4f18-b967-546af8dfa98b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5efd4173-86f0-4832-a337-230e8943d6d6": {
      "main": [
        [
          {
            "node": "b4217d6a-3aa3-4c26-a85a-2d9fd3a3af38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c9456149-5d6b-4e75-b388-4fb83bcdb5dc": {
      "main": [
        [
          {
            "node": "5efd4173-86f0-4832-a337-230e8943d6d6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e50db72a-6972-4137-a98d-930045894b61": {
      "main": [
        [
          {
            "node": "74155705-1e36-4684-949e-7d4dbcbdafc4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eb098b4a-557c-4c39-aa1f-d942bb1e98cf": {
      "main": [
        [
          {
            "node": "e4f4fde2-75c4-4c4f-9e70-5d9366e28857",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "13ec07db-dcfa-4dbb-99e5-ce6d539e192b": {
      "main": [
        [
          {
            "node": "3c2c2921-36a7-4619-9aca-98280052868f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ed41f33f-964c-4c36-a444-c28ea7fdafc0": {
      "main": [
        [
          {
            "node": "c2752415-3b20-4988-be7a-4fea731b2fe2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "74155705-1e36-4684-949e-7d4dbcbdafc4": {
      "main": [
        [
          {
            "node": "afb9ab0d-2fb6-4b69-8d26-bdebe8196f92",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e4f4fde2-75c4-4c4f-9e70-5d9366e28857": {
      "main": [
        [
          {
            "node": "c9456149-5d6b-4e75-b388-4fb83bcdb5dc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "40b35a12-4708-4311-9114-eea7c3a3d28b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "4efaf4e7-40b8-49aa-b1fd-1900b9951c27",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a31f1481-abd7-4778-b8aa-4a88d11b48e0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2e672107-c44d-4e5b-82bf-e2cd03182b2c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ed41f33f-964c-4c36-a444-c28ea7fdafc0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "7b95428d-2374-4b09-8041-eec0b4de3df7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2a430daf-17d2-4873-a39b-d3efb301a019",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "92ffd1c4-6cb2-4328-a12d-b771ea582357",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "0bc59035-ccc6-4a29-990e-01ec85a2825e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "fdb35679-50ed-4f18-b967-546af8dfa98b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "6e617253-ce99-4ab5-bac5-c4b22bda1ec8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "92ffd1c4-6cb2-4328-a12d-b771ea582357": {
      "main": [
        [
          {
            "node": "a1517503-b1e2-414e-81c4-c29d2d3d90b4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c2c2921-36a7-4619-9aca-98280052868f": {
      "main": [
        [
          {
            "node": "9895edc1-40bd-433c-bdf5-f8cc48ac8a75",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0bc59035-ccc6-4a29-990e-01ec85a2825e": {
      "main": [
        [
          {
            "node": "f74d13ac-93ec-42f7-9faa-e59ae4107784",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f74d13ac-93ec-42f7-9faa-e59ae4107784": {
      "main": [
        [
          {
            "node": "7daf6540-2b6b-46f7-946f-c0dc7ec03190",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3862bfa3-98f2-476e-a35e-4b3698073e4f": {
      "main": [
        [
          {
            "node": "7daf6540-2b6b-46f7-946f-c0dc7ec03190",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4efaf4e7-40b8-49aa-b1fd-1900b9951c27": {
      "main": [
        [
          {
            "node": "13ec07db-dcfa-4dbb-99e5-ce6d539e192b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a31f1481-abd7-4778-b8aa-4a88d11b48e0": {
      "main": [
        [
          {
            "node": "e50db72a-6972-4137-a98d-930045894b61",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6e617253-ce99-4ab5-bac5-c4b22bda1ec8": {
      "main": [
        [
          {
            "node": "c36b29d2-73d0-4b87-9b7e-1c2a053aea45",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c36b29d2-73d0-4b87-9b7e-1c2a053aea45": {
      "main": [
        [
          {
            "node": "cc088e6d-3611-411d-99c8-e0311aad801f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c2752415-3b20-4988-be7a-4fea731b2fe2": {
      "main": [
        [
          {
            "node": "3862bfa3-98f2-476e-a35e-4b3698073e4f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fdb35679-50ed-4f18-b967-546af8dfa98b": {
      "main": [
        [
          {
            "node": "b4755d61-45f8-4b61-b569-91f6637fa535",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b4755d61-45f8-4b61-b569-91f6637fa535": {
      "main": [
        [
          {
            "node": "cc088e6d-3611-411d-99c8-e0311aad801f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a1517503-b1e2-414e-81c4-c29d2d3d90b4": {
      "main": [
        [
          {
            "node": "254c70d2-1307-4bf5-84aa-20efb571c154",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado - Creación de contenido, IA Multimodal

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos34
Categoría2
Tipos de nodos6
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Autor
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!"

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34