Dialogflowインテントエクスポーター

中級

これはDocument Extraction分野の自動化ワークフローで、13個のノードを含みます。主にIf, Code, Telegram, HttpRequest, GoogleSheetsなどのノードを使用。 Dialogflowインテントと優先度をTelegramでGoogleシートに書き出し

前提条件
  • Telegram Bot Token
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "Y7rM4PEAHjh3zefB",
  "meta": {
    "instanceId": "ab5a4f9feb36866287f2bf6d72ca9d3295062a67ea6afb78c0e5970c38eb8578"
  },
  "name": "Dialogflow Intent Exporter",
  "tags": [],
  "nodes": [
    {
      "id": "2ee1d52e-e143-47e1-b3bc-22d0fd17528e",
      "name": "Telegramトリガー",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        64,
        128
      ],
      "webhookId": "d6cbae0c-dc62-4f9e-8098-212bc28bdb51",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "4e8fe8a7-13e3-4cd9-9670-6e5a720da072",
      "name": "シートに行を追加",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1600,
        176
      ],
      "parameters": {
        "columns": {
          "value": {
            "Nombre": "={{ $json.Nombre }}",
            "Prioridad": "={{ $json.textoPrioridad }}",
            "Hora de registro": "={{$now.format('HH:mm:ss') }}",
            "Fecha de registro": "={{$now.format('dd/MM/yyyy') }}",
            "Color de prioridad": "={{ $json.colorPrioridad }}",
            "Valor de prioridad": "={{ $json.prioridad }}"
          },
          "schema": [
            {
              "id": "Nombre",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Nombre",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Prioridad",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Prioridad",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Color de prioridad",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Color de prioridad",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Valor de prioridad",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Valor de prioridad",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Fecha de registro",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Fecha de registro",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hora de registro",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Hora de registro",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1v9VHfyEQSWYZxKCMEal0uT5_z6gV1Qx4EIwgr6ShN6E/edit#gid=0",
          "cachedResultName": "intents-nombres"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1v9VHfyEQSWYZxKCMEal0uT5_z6gV1Qx4EIwgr6ShN6E",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1v9VHfyEQSWYZxKCMEal0uT5_z6gV1Qx4EIwgr6ShN6E/edit?usp=drivesdk",
          "cachedResultName": "Listado-intents"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "63227264-c9f0-4c5a-aea1-a22e99ece365",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 896,
        "height": 480,
        "content": "## Se valida el usuario y comando enviado"
      },
      "typeVersion": 1
    },
    {
      "id": "66dfded1-7af6-45f9-98ae-7fdedd75a644",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        80
      ],
      "parameters": {
        "width": 496,
        "height": 272,
        "content": "## Se obtiene la información de los intents y se procesa"
      },
      "typeVersion": 1
    },
    {
      "id": "4ebfb516-ff02-4c53-9fee-82676ff3b3eb",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        80
      ],
      "parameters": {
        "color": 4,
        "width": 576,
        "height": 272,
        "content": "## Registro en Sheets y confirmación por Telegram"
      },
      "typeVersion": 1
    },
    {
      "id": "72b44433-2b77-4bc3-a31b-cbc04f3ecfd5",
      "name": "IDによるユーザー検証",
      "type": "n8n-nodes-base.if",
      "position": [
        288,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3f4c5e75-e48d-450a-896b-4bd396851417",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.from.id }}",
              "rightValue": 7894561234
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ca22c2d9-821a-4f15-8011-2e9f02361cc6",
      "name": "コマンド検証",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "30b2659a-c708-4cb4-8576-913182ec1e65",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "backup"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a383d91d-134c-43c1-b48b-e5d8024ff831",
      "name": "コマンド検証メッセージ",
      "type": "n8n-nodes-base.telegram",
      "position": [
        624,
        160
      ],
      "webhookId": "f1bac6b6-3a01-4ce7-9a85-b759f45a7fb7",
      "parameters": {
        "text": "Palabra inválida",
        "chatId": "={{ $json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "778342fd-e973-4c30-b1d6-6fbd79187c5d",
      "name": "インテントデータの取得",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1040,
        176
      ],
      "parameters": {
        "url": "https://dialogflow.googleapis.com/v2/projects/TU_PROJECT_ID/agent/intents",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googleApi"
      },
      "typeVersion": 4.2
    },
    {
      "id": "730f58b8-bb78-471b-bde0-ba1a10ee8b24",
      "name": "確認メッセージ",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1824,
        176
      ],
      "webhookId": "c97e1e83-3534-48cd-bb57-84e6bf7337f0",
      "parameters": {
        "text": "= Se registraron {{$items(\"Añadir fila en la hoja\").length}} intents en Google Sheets.",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "7d18b6fa-39c1-46c4-8578-f90b357f3f36",
      "name": "無効ユーザーメッセージ",
      "type": "n8n-nodes-base.telegram",
      "position": [
        448,
        288
      ],
      "webhookId": "68ff50f6-a0ed-489c-8637-5aede49ab6f9",
      "parameters": {
        "text": "Usuario inválido",
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d925126b-f8c9-4c68-836b-bfe769c70c57",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -272
      ],
      "parameters": {
        "color": 6,
        "width": 352,
        "height": 1008,
        "content": "## 🔄 Flujo explicado\n\n### 🎯 Trigger (Telegram)\n- **Se activa automáticamente** al recibir *cualquier mensaje* en el bot de Telegram.\n\n### 🛡️ Validación de Usuario y Comando\n- **Se valida el ID** del usuario remitente. (Reemplaza el nro de 10 dígitos por un id real)\n- **Se verifica** que el mensaje recibido sea exactamente **\"backup\"**.\n- ❌ En caso de error, **se envía un mensaje indicando que el usuario o el comando es inválido**.\n\n### 🌐 Solicitud HTTP a Dialogflow\n- **Se consulta la API de Dialogflow** para obtener todos los intents configurados en el agente.\n\n### 🧠 Nodo de Código (JavaScript)\n- **Se transforma el JSON** recibido desde Dialogflow.\n- **Se extraen** los valores `displayName` y `priority` de cada intent.\n- **Se asigna un emoji y texto descriptivo** dependiendo del nivel de prioridad:\n  - 🔴 Highest\n  - 🟠 High\n  - 🔵 Normal\n  - 🟢 Low\n  - 🚫 Ignore\n\n### 📄 Registro en Google Sheets\n- **Se agrega cada intent** como una fila en la hoja de cálculo.\n- **Se registran también la fecha y hora** de procesamiento.\n\n### ✅ Confirmación por Telegram\n- **Se envía un mensaje de confirmación** con el total de intents registrados.\n- Este mensaje se envía **una sola vez** usando la opción `Execute Once`.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ac3bf08d-e601-445d-9e48-13bb6a676f36",
      "name": "インテントと優先度のマッピング",
      "type": "n8n-nodes-base.code",
      "position": [
        1264,
        176
      ],
      "parameters": {
        "jsCode": "// 1️⃣ Obtenemos el array de intents del primer item recibido por este nodo.\n// Si la propiedad \"intents\" no existe, devolvemos un array vacío para evitar errores.\nconst data = $input.first().json.intents || [];\n\n// 2️⃣ Función que evalúa la prioridad numérica de un intent\n// y devuelve un objeto con:\n//   - emoji: Representación visual del nivel de prioridad\n//   - texto: Nombre descriptivo del nivel de prioridad\nfunction obtenerPrioridad(priority) {\n  if (priority >= 1000000) return { emoji: '🔴', texto: 'Highest' }; // Prioridad máxima\n  if (priority >= 750000)  return { emoji: '🟠', texto: 'High' };    // Prioridad alta\n  if (priority >= 500000)  return { emoji: '🔵', texto: 'Normal' };  // Prioridad normal\n  if (priority >= 250000)  return { emoji: '🟢', texto: 'Low' };     // Prioridad baja\n  return { emoji: '🚫', texto: 'Ignore' };                           // Ignorado o desactivado\n}\n\n// 3️⃣ Recorremos cada intent y lo convertimos en un item compatible con n8n.\n// Cada item incluirá:\n//   - Nombre: El displayName del intent\n//   - prioridad: Valor numérico de la prioridad del intent\n//   - colorPrioridad: Emoji que representa la prioridad\n//   - textoPrioridad: Descripción textual de la prioridad\nconst intents = data.map(intent => {\n  \n  // Extrae la información de prioridad del intent actual.\n  // Si la propiedad \"priority\" no existe, usamos 0 como valor por defecto para evitar errores.\n  const prioridadInfo = obtenerPrioridad(intent.priority || 0);\n  \n  // Construye el item final que n8n espera: { json: {...} }\n  return {\n    json: {\n      Nombre: intent.displayName,\n      prioridad: intent.priority,\n      colorPrioridad: prioridadInfo.emoji,\n      textoPrioridad: prioridadInfo.texto\n    }\n  };\n});\n\n// 4️⃣ Devolvemos el array de items para que n8n los procese.\n// Cada item será una fila independiente si lo conectas, por ejemplo, a Google Sheets.\nreturn intents;\n"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5b987344-93a5-44ed-a9d7-77206db9ee97",
  "connections": {
    "2ee1d52e-e143-47e1-b3bc-22d0fd17528e": {
      "main": [
        [
          {
            "node": "72b44433-2b77-4bc3-a31b-cbc04f3ecfd5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4e8fe8a7-13e3-4cd9-9670-6e5a720da072": {
      "main": [
        [
          {
            "node": "730f58b8-bb78-471b-bde0-ba1a10ee8b24",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ca22c2d9-821a-4f15-8011-2e9f02361cc6": {
      "main": [
        [
          {
            "node": "778342fd-e973-4c30-b1d6-6fbd79187c5d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a383d91d-134c-43c1-b48b-e5d8024ff831",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "778342fd-e973-4c30-b1d6-6fbd79187c5d": {
      "main": [
        [
          {
            "node": "ac3bf08d-e601-445d-9e48-13bb6a676f36",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "72b44433-2b77-4bc3-a31b-cbc04f3ecfd5": {
      "main": [
        [
          {
            "node": "ca22c2d9-821a-4f15-8011-2e9f02361cc6",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "7d18b6fa-39c1-46c4-8578-f90b357f3f36",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ac3bf08d-e601-445d-9e48-13bb6a676f36": {
      "main": [
        [
          {
            "node": "4e8fe8a7-13e3-4cd9-9670-6e5a720da072",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 文書抽出

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数13
カテゴリー1
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Eddy Medina

Eddy Medina

@troguis

Soy un apasionado de la tecnología. Me entusiasma el desarrollo y la implementación de chatbots y automatizaciones. Disfruto simplificando procesos y mejorando la experiencia del usuario.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34