Copia de seguridad y restauración de flujos de trabajo n8n
Este es unautomatización que contiene 28 nodos.Utiliza principalmente nodos como If, N8n, Code, Wait, Telegram. Respaldar y restaurar flujos de trabajo de n8n usando Telegram, Google Drive y carga de formularios
- •Bot Token de Telegram
- •Credenciales de API de Google Drive
Nodos utilizados (28)
Categoría
{
"meta": {
"instanceId": "3d7eb9567ae690bf8c9bba1cb43396e6e40c18e15eb5889cf9673ed1713da6db",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "5b97598a-3366-4294-b76d-273c00ef1fdd",
"name": "Activador manual",
"type": "n8n-nodes-base.manualTrigger",
"position": [
6000,
1040
],
"parameters": {},
"typeVersion": 1
},
{
"id": "33b8396b-2889-4daf-8ffb-bc11a4324448",
"name": "Activador de copia programada",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
5984,
560
],
"parameters": {
"rule": {
"interval": [
{
"daysInterval": 3
}
]
}
},
"typeVersion": 1.2
},
{
"id": "81c12768-16bd-4103-a1eb-24af472c457a",
"name": "Nota: Activador programado",
"type": "n8n-nodes-base.stickyNote",
"position": [
5904,
352
],
"parameters": {
"color": 6,
"width": 376,
"height": 176,
"content": "## ⏰ Schedule Backup Trigger\n\n**Purpose:** Initiates automated workflow export every 3 days.\n\n**Note:** Adjust interval in node settings for custom frequency (e.g., daily)."
},
"typeVersion": 1
},
{
"id": "290dfccd-f8a1-467d-a65f-9f5774e2d8ee",
"name": "Obtener todos los flujos de trabajo",
"type": "n8n-nodes-base.n8n",
"position": [
6208,
560
],
"parameters": {
"filters": {},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "YsSsp8tsvvN7Eau2",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "58f2ba7e-aa94-43fe-a103-9ef22e1d2f2a",
"name": "Nota: Obtener flujos",
"type": "n8n-nodes-base.stickyNote",
"position": [
5952,
720
],
"parameters": {
"color": 5,
"width": 488,
"height": 144,
"content": "## 🔍 Fetch All Workflows\n\n**Purpose:** Retrieves complete list of n8n workflows via API.\n\n**Note:** Requires n8n API credential; outputs JSON array for aggregation."
},
"typeVersion": 1
},
{
"id": "9d9356c3-9683-47a9-9a21-7ba579cbb280",
"name": "Agregar flujos de trabajo",
"type": "n8n-nodes-base.aggregate",
"position": [
6416,
560
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "03200b93-3f13-47f8-a0ff-700e17e2fe6b",
"name": "Nota: Agregar datos",
"type": "n8n-nodes-base.stickyNote",
"position": [
6352,
368
],
"parameters": {
"color": 3,
"width": 360,
"height": 176,
"content": "## 📊 Aggregate Workflows\n\n**Purpose:** Combines fetched workflows into single JSON array.\n\n**Note:** Uses 'aggregateAllItemData' to prepare for file conversion."
},
"typeVersion": 1
},
{
"id": "862faac9-bfd8-4b11-a467-2eeb0d54292d",
"name": "Convertir a archivo de respaldo",
"type": "n8n-nodes-base.convertToFile",
"position": [
6640,
560
],
"parameters": {
"options": {},
"operation": "toText",
"sourceProperty": "data"
},
"typeVersion": 1.1
},
{
"id": "ade96952-54bc-444c-9bdd-57fd4a798169",
"name": "Nota: Convertir archivo",
"type": "n8n-nodes-base.stickyNote",
"position": [
6528,
720
],
"parameters": {
"color": 3,
"width": 472,
"height": 144,
"content": "## 📄 Convert to Backup File\n\n**Purpose:** Transforms JSON array to downloadable text file.\n\n**Note:** Sources 'data' property; sets filename to 'All-n8n-workflows.txt'."
},
"typeVersion": 1
},
{
"id": "f2b52a80-00ad-4316-aa6f-4bef50626826",
"name": "Enviar respaldo a Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
6848,
560
],
"webhookId": "8398a972-7215-47ec-8178-193bd910b5e3",
"parameters": {
"chatId": "{{your_chat_id}}",
"operation": "sendDocument",
"binaryData": true,
"additionalFields": {
"fileName": "All-n8n-workflows.txt"
}
},
"credentials": {
"telegramApi": {
"id": "Elo6BLaLpBDVgeLW",
"name": "LinkedIn Post"
}
},
"typeVersion": 1.2
},
{
"id": "b33de46e-16c6-4939-b9dd-ad181bb6d1b2",
"name": "Nota: Enviar a Telegram",
"type": "n8n-nodes-base.stickyNote",
"position": [
7136,
560
],
"parameters": {
"color": 6,
"width": 344,
"height": 176,
"content": "## 📤 Send Backup to Telegram\n\n**Purpose:** Delivers backup file to specified chat.\n\n**Note:** Replace '{{your_chat_id}}' with your Telegram chat ID; requires bot credential."
},
"typeVersion": 1
},
{
"id": "72b820a1-4af5-45c2-bb43-e061d8d44177",
"name": "Descargar respaldo desde Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
6240,
1040
],
"parameters": {
"fileId": "{{your_file_id}}",
"options": {
"fileName": "all_workflows"
},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "ojkPtWn622t1FPAy",
"name": "Ewere"
}
},
"typeVersion": 3
},
{
"id": "75ebfa45-7372-41a6-868e-73c7ea4df4bc",
"name": "Nota: Descargar desde Drive",
"type": "n8n-nodes-base.stickyNote",
"position": [
6352,
896
],
"parameters": {
"color": 6,
"width": 280,
"height": 208,
"content": "## 📥 Download Backup from Drive\n\n**Purpose:** Fetches backup text file from Google Drive.\n\n**Note:** Set '{{your_file_id}}' from Drive URL; requires OAuth credential."
},
"typeVersion": 1
},
{
"id": "437b283a-1f3e-4297-be0d-60d9aa5a1e3b",
"name": "Activador de restauración por formulario",
"type": "n8n-nodes-base.formTrigger",
"position": [
6224,
1264
],
"webhookId": "308ea5b0-fbea-4364-8c08-5237e4f7058f",
"parameters": {
"options": {},
"formTitle": "Upload Backup File",
"formFields": {
"values": [
{
"fieldType": "file",
"fieldLabel": "data"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "dfe569ab-8a3d-4665-9217-0239fb82cad2",
"name": "Nota: Activador de formulario",
"type": "n8n-nodes-base.stickyNote",
"position": [
5952,
1424
],
"parameters": {
"color": 6,
"width": 280,
"height": 192,
"content": "## 📝 Form Restore Trigger\n\n**Purpose:** Enables direct file upload for restore.\n\n**Note:** Use n8n form to submit local backup; connects to extraction."
},
"typeVersion": 1
},
{
"id": "319499bc-5aab-4608-a53f-14681ff37879",
"name": "Extraer texto del respaldo",
"type": "n8n-nodes-base.extractFromFile",
"position": [
6400,
1184
],
"parameters": {
"options": {},
"operation": "text"
},
"typeVersion": 1
},
{
"id": "8c8b6f65-2265-4d5e-ae5d-64e060c18a17",
"name": "Nota: Extraer texto",
"type": "n8n-nodes-base.stickyNote",
"position": [
6304,
1424
],
"parameters": {
"color": 3,
"width": 392,
"height": 192,
"content": "## 📖 Extract Backup Text\n\n**Purpose:** Reads text content from downloaded or uploaded file.\n\n**Note:** Outputs raw JSON string to 'data' property for parsing."
},
"typeVersion": 1
},
{
"id": "c364c0f4-956c-4893-8cfa-2c3f49b87d53",
"name": "Analizar JSON de respaldo",
"type": "n8n-nodes-base.code",
"position": [
6576,
1184
],
"parameters": {
"jsCode": "// The input from the previous node is an array of items. We'll work with the first item.\nconst item = items[0];\n\n// --- IMPORTANT ---\n// The 'Extract from File' node will place the file's content into a property.\n// You may need to adjust 'fileContent' to match the actual property name from that node.\nconst jsonString = item.json.data;\n\nif (!jsonString) {\n throw new Error(\"The property 'fileContent' was not found in the input data. Please check the output of the 'Extract from File' node and update the property name in this code.\");\n}\n\n// Parse the large JSON string into an array of individual workflow objects.\nconst workflows = JSON.parse(jsonString);\n\n// List of settings properties that are not supported by the n8n API\nconst unsupportedSettingsProperties = [\n 'executionOrder',\n 'callerPolicy', \n 'errorWorkflow',\n 'timeSavedPerExecution',\n 'executionTimeout',\n 'maxExecutionTimeout'\n];\n\n// Return each workflow as a separate item.\n// For each item, convert the workflow object back into a string\n// and place it in a property called 'data'.\nreturn workflows.map(workflow => {\n // Extract workflow name and ID for easier reference\n const workflowName = workflow.name || 'Unnamed Workflow';\n const workflowId = workflow.id || 'No ID';\n \n // Create a cleaned copy of the workflow\n const cleanedWorkflow = { ...workflow };\n \n // Clean up the settings object by removing unsupported properties\n if (cleanedWorkflow.settings) {\n const cleanedSettings = { ...cleanedWorkflow.settings };\n \n // Remove unsupported properties\n unsupportedSettingsProperties.forEach(prop => {\n delete cleanedSettings[prop];\n });\n \n cleanedWorkflow.settings = cleanedSettings;\n }\n \n // Remove properties that shouldn't be included when creating new workflows\n delete cleanedWorkflow.id; // Let n8n assign a new ID\n delete cleanedWorkflow.createdAt; // Will be set by n8n\n delete cleanedWorkflow.updatedAt; // Will be set by n8n\n delete cleanedWorkflow.versionId; // Will be set by n8n\n delete cleanedWorkflow.shared; // Will be handled by n8n\n delete cleanedWorkflow.triggerCount; // Will be reset by n8n\n \n // Clean up staticData - remove if empty or clean node-specific data\n if (cleanedWorkflow.staticData) {\n const cleanedStaticData = { ...cleanedWorkflow.staticData };\n // Remove any node-specific data that might reference old node IDs\n Object.keys(cleanedStaticData).forEach(key => {\n if (key.startsWith('node:')) {\n delete cleanedStaticData[key];\n }\n });\n // Remove staticData entirely if it's empty after cleaning\n if (Object.keys(cleanedStaticData).length === 0) {\n delete cleanedWorkflow.staticData;\n } else {\n cleanedWorkflow.staticData = cleanedStaticData;\n }\n }\n \n // Keep pinData as it contains important test/development data\n // Only remove pinData if it's undefined, but preserve empty objects\n \n // Clean up meta object - remove or clean problematic properties\n if (cleanedWorkflow.meta) {\n const cleanedMeta = { ...cleanedWorkflow.meta };\n // Remove properties that might cause issues with new workflow creation\n delete cleanedMeta.templateCredsSetupCompleted;\n delete cleanedMeta.instanceId;\n \n // Remove meta entirely if it's empty after cleaning\n if (Object.keys(cleanedMeta).length === 0) {\n delete cleanedWorkflow.meta;\n } else {\n cleanedWorkflow.meta = cleanedMeta;\n }\n }\n \n // Clean webhook IDs from nodes that might conflict\n if (cleanedWorkflow.nodes) {\n cleanedWorkflow.nodes = cleanedWorkflow.nodes.map(node => {\n const cleanedNode = { ...node };\n \n // Remove webhookId property that might reference old webhook instances\n if (cleanedNode.webhookId) {\n delete cleanedNode.webhookId;\n }\n \n return cleanedNode;\n });\n }\n \n return {\n json: {\n data: JSON.stringify(cleanedWorkflow),\n workflowName: workflowName,\n originalId: workflowId,\n // Additional metadata for debugging\n hasSettings: !!workflow.settings,\n nodeCount: workflow.nodes ? workflow.nodes.length : 0\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "05297227-aff4-4c99-a45d-c73f7c4c15fa",
"name": "Nota: Analizar JSON",
"type": "n8n-nodes-base.stickyNote",
"position": [
6752,
1424
],
"parameters": {
"color": 3,
"width": 456,
"height": 176,
"content": "## 🔄 Parse Backup JSON\n\n**Purpose:** Cleans and splits JSON into individual workflow items.\n\n**Note:** Removes IDs, unsupported settings; outputs one item per workflow with metadata."
},
"typeVersion": 1
},
{
"id": "8b7750d5-5edb-4e1c-8abf-6124bc5de56a",
"name": "Procesar cada flujo de trabajo",
"type": "n8n-nodes-base.splitInBatches",
"position": [
6752,
1024
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "2c33e527-7e91-4f55-be2e-92d6b2cbbeec",
"name": "Nota: Bucle de flujos",
"type": "n8n-nodes-base.stickyNote",
"position": [
7104,
864
],
"parameters": {
"color": 5,
"width": 360,
"height": 192,
"content": "## 🔄 Process Each Workflow\n\n**Purpose:** Loops over parsed items for sequential API calls.\n\n**Note:** Uses SplitInBatches to handle one workflow at a time; returns to loop after processing."
},
"typeVersion": 1
},
{
"id": "74eaf063-91e3-4bfd-a52e-4284fe317a89",
"name": "Verificar existencia del flujo",
"type": "n8n-nodes-base.n8n",
"position": [
6944,
1088
],
"parameters": {
"filters": {
"name": "={{ $json.workflowName }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "YsSsp8tsvvN7Eau2",
"name": "n8n account"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "a7d3a105-06bb-47de-90ce-f0c63ac6f99b",
"name": "Si el flujo existe",
"type": "n8n-nodes-base.if",
"position": [
7104,
1088
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b384d46d-cd29-4362-8e36-e1b563329156",
"operator": {
"type": "string",
"operation": "notExists",
"singleValue": true
},
"leftValue": "={{ $json.name }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ff3a4413-c015-4b89-a5b8-02b4329669a0",
"name": "Crear nuevo flujo de trabajo",
"type": "n8n-nodes-base.n8n",
"onError": "continueErrorOutput",
"position": [
7504,
1200
],
"parameters": {
"operation": "create",
"requestOptions": {},
"workflowObject": "={{ $('Process Each Workflow').item.json.data }}"
},
"credentials": {
"n8nApi": {
"id": "YsSsp8tsvvN7Eau2",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "12136a58-7361-4693-ae20-09f29c5c2357",
"name": "Actualizar flujo existente",
"type": "n8n-nodes-base.n8n",
"position": [
7280,
1216
],
"parameters": {
"operation": "update",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.id }}"
},
"requestOptions": {},
"workflowObject": "={{ $('Process Each Workflow').item.json.data }}"
},
"credentials": {
"n8nApi": {
"id": "YsSsp8tsvvN7Eau2",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "f9de86be-f71a-449d-8968-1353d04dd32c",
"name": "Esperar finalización",
"type": "n8n-nodes-base.wait",
"position": [
7696,
1216
],
"webhookId": "a6cb7280-b53e-465a-b61d-3b4ef03928db",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "9a316313-8f57-4376-90d4-1c5d68f03a7a",
"name": "Nota: Retardo de espera",
"type": "n8n-nodes-base.stickyNote",
"position": [
7680,
1008
],
"parameters": {
"color": 2,
"width": 328,
"height": 176,
"content": "## ⏳ Wait for Completion\n\n**Purpose:** Pauses between API calls to avoid rate limits.\n\n**Note:** Default 1s delay; increase to 5-10s for large batches."
},
"typeVersion": 1
},
{
"id": "9c3e12fb-9375-4c5c-b19e-e67c7a717599",
"name": "Nota general 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
5280,
368
],
"parameters": {
"color": 4,
"width": 600,
"height": 1256,
"content": "# Automated n8n Workflow Backup & Multi-Path Restore\n\n## 📋 What This Template Does\nThis template automates backing up all n8n workflows to a Telegram-delivered text file every 3 days and restores them via Google Drive download or direct form upload using create-or-update logic.\n\n## 🔧 Prerequisites\n- Active n8n instance with API access\n- Telegram bot and chat ID\n- Google Drive account (for Drive restores)\n\n## 🔑 Required Credentials\n\n### n8n API Setup\n1. Settings → n8n API → Enable & generate key\n2. Add as 'n8n API' credential\n\n### Telegram API Setup\n1. @BotFather → Create bot → Get token\n2. Note chat ID via @userinfobot\n3. Add as 'Telegram API' credential\n\n### Google Drive OAuth2 API Setup\n1. Google Cloud → Credentials → OAuth Client ID\n2. Enable Drive API, add redirect URI\n3. Connect as 'Google Drive OAuth2 API'\n\n## ⚙️ Configuration Steps\n1. Import JSON to n8n\n2. Assign credentials to nodes\n3. Set Telegram chat ID\n4. Update Drive file ID (if using Drive path)\n5. Test backup via Schedule execution\n6. Test restore via manual or form trigger\n\n## 🎯 Use Cases\n- Backup production workflows to Telegram for sharing\n- Restore from Drive after migrations\n- Sync templates across instances via upload\n- Archive educational automations for reuse\n\n## ⚠️ Troubleshooting\n- Empty backups: Check API read permissions\n- Parse errors: Validate JSON in file\n- Rate limits: Extend Wait duration\n- Upload fails: Use small test file first"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"5b97598a-3366-4294-b76d-273c00ef1fdd": {
"main": [
[
{
"node": "72b820a1-4af5-45c2-bb43-e061d8d44177",
"type": "main",
"index": 0
}
]
]
},
"c364c0f4-956c-4893-8cfa-2c3f49b87d53": {
"main": [
[
{
"node": "8b7750d5-5edb-4e1c-8abf-6124bc5de56a",
"type": "main",
"index": 0
}
]
]
},
"a7d3a105-06bb-47de-90ce-f0c63ac6f99b": {
"main": [
[
{
"node": "ff3a4413-c015-4b89-a5b8-02b4329669a0",
"type": "main",
"index": 0
}
],
[
{
"node": "12136a58-7361-4693-ae20-09f29c5c2357",
"type": "main",
"index": 0
}
]
]
},
"9d9356c3-9683-47a9-9a21-7ba579cbb280": {
"main": [
[
{
"node": "862faac9-bfd8-4b11-a467-2eeb0d54292d",
"type": "main",
"index": 0
}
]
]
},
"ff3a4413-c015-4b89-a5b8-02b4329669a0": {
"main": [
[
{
"node": "f9de86be-f71a-449d-8968-1353d04dd32c",
"type": "main",
"index": 0
}
],
[
{
"node": "8b7750d5-5edb-4e1c-8abf-6124bc5de56a",
"type": "main",
"index": 0
}
]
]
},
"319499bc-5aab-4608-a53f-14681ff37879": {
"main": [
[
{
"node": "c364c0f4-956c-4893-8cfa-2c3f49b87d53",
"type": "main",
"index": 0
}
]
]
},
"290dfccd-f8a1-467d-a65f-9f5774e2d8ee": {
"main": [
[
{
"node": "9d9356c3-9683-47a9-9a21-7ba579cbb280",
"type": "main",
"index": 0
}
]
]
},
"f9de86be-f71a-449d-8968-1353d04dd32c": {
"main": [
[
{
"node": "8b7750d5-5edb-4e1c-8abf-6124bc5de56a",
"type": "main",
"index": 0
}
]
]
},
"437b283a-1f3e-4297-be0d-60d9aa5a1e3b": {
"main": [
[
{
"node": "319499bc-5aab-4608-a53f-14681ff37879",
"type": "main",
"index": 0
}
]
]
},
"8b7750d5-5edb-4e1c-8abf-6124bc5de56a": {
"main": [
[],
[
{
"node": "74eaf063-91e3-4bfd-a52e-4284fe317a89",
"type": "main",
"index": 0
}
]
]
},
"862faac9-bfd8-4b11-a467-2eeb0d54292d": {
"main": [
[
{
"node": "f2b52a80-00ad-4316-aa6f-4bef50626826",
"type": "main",
"index": 0
}
]
]
},
"33b8396b-2889-4daf-8ffb-bc11a4324448": {
"main": [
[
{
"node": "290dfccd-f8a1-467d-a65f-9f5774e2d8ee",
"type": "main",
"index": 0
}
]
]
},
"74eaf063-91e3-4bfd-a52e-4284fe317a89": {
"main": [
[
{
"node": "a7d3a105-06bb-47de-90ce-f0c63ac6f99b",
"type": "main",
"index": 0
}
]
]
},
"12136a58-7361-4693-ae20-09f29c5c2357": {
"main": [
[
{
"node": "8b7750d5-5edb-4e1c-8abf-6124bc5de56a",
"type": "main",
"index": 0
}
]
]
},
"72b820a1-4af5-45c2-bb43-e061d8d44177": {
"main": [
[
{
"node": "319499bc-5aab-4608-a53f-14681ff37879",
"type": "main",
"index": 0
}
]
]
}
}
}¿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
¿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.
Flujos de trabajo relacionados recomendados
Daniel Nkencho
@daniel-automatesAI Automation Consultant | Helping Business Owners Implement AI Systems for Growth and Lead Gen
Compartir este flujo de trabajo