Replicador automático de Telegram

Avanzado

Este es unSocial Media, Multimodal AIflujo de automatización del dominio deautomatización que contiene 19 nodos.Utiliza principalmente nodos como If, Set, Code, Html, Telegram. Copia y traducción automáticas de contenido de canales de Telegram basadas en GPT-4o-mini

Requisitos previos
  • Bot Token de Telegram
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Clave de API de OpenAI
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": "VjbCxJ8Hgo44WZdf",
  "meta": {
    "instanceId": "f5aa635d637faa7cf397adde51f1a02fdf8ac6454c1c6457738ffd11609a900c"
  },
  "name": "TelegramAutoCopier",
  "tags": [],
  "nodes": [
    {
      "id": "aeb0620d-095c-4238-8dd0-0232c4905e19",
      "name": "Programación Diaria",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Triggers the workflow daily at 9 AM. Adjust the time according to your needs.",
      "position": [
        -1220,
        -60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3ea234cc-4f02-4216-8013-554eb1fba0fd",
      "name": "Obtener Página del Canal",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Fetches the HTML content of the source Telegram channel",
      "position": [
        -780,
        -60
      ],
      "parameters": {
        "url": "=https://t.me/s/{{ $('Set Telegram Channels').item.json.sourceChannel }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "eb0d33be-2e66-43cc-90fa-d1b9878615d9",
      "name": "Extraer Contenido de la Publicación",
      "type": "n8n-nodes-base.html",
      "notes": "Extracts text, images, and videos from the latest Telegram post",
      "position": [
        -560,
        -60
      ],
      "parameters": {
        "options": {
          "trimValues": false,
          "cleanUpText": false
        },
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "post",
              "cssSelector": "div.tgme_widget_message_wrap:last-of-type div.js-message_text"
            },
            {
              "key": "postId",
              "cssSelector": "div.tgme_widget_message_wrap:last-of-type div.tgme_widget_message_info span.tgme_widget_message_meta"
            },
            {
              "key": "video",
              "attribute": "src",
              "cssSelector": "div.tgme_widget_message_wrap:last-of-type div.tgme_widget_message_bubble a div.tgme_widget_message_video_wrap > video",
              "returnValue": "attribute"
            },
            {
              "key": "photo",
              "attribute": "style",
              "cssSelector": "div.tgme_widget_message_wrap:last-of-type div.tgme_widget_message_bubble div.media_supported_cont > a.tgme_widget_message_photo_wrap",
              "returnValue": "attribute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "715418a9-9598-460a-817e-e2b681f336c4",
      "name": "Limpiar Contenido de la Publicación",
      "type": "n8n-nodes-base.code",
      "notes": "Removes original channel signature and cleans up the text",
      "position": [
        -340,
        -60
      ],
      "parameters": {
        "jsCode": "// Clean up the post content by removing original channel signature\nif ($input.first().json.post) {\n  let cleanPost = $input.first().json.post    \n    .replaceAll($('Set Telegram Channels').first().json.channelSignature, '')\n    .trim();\n  \n  $input.first().json.post = cleanPost;\n}\n\nreturn $input.all();"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "31508b88-fd99-4b7c-abb7-52084caf9373",
      "name": "Traducir Texto",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "notes": "Uses OpenAI to translate the post content to the target language",
      "position": [
        -120,
        -60
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Translate the following text to {{ $('Set Telegram Channels').item.json.targetLanguage }} in a friendly, natural style.\nReturn only the translated text without any additional commentary or formatting.\n\nText to translate:\n{{ $json.post }}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "hjq9L6ppDLFMNOcE",
          "name": "OpenAi account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.8
    },
    {
      "id": "e0017199-a33a-4866-9fa8-3be34fbf20e8",
      "name": "Procesar URLs de Medios",
      "type": "n8n-nodes-base.code",
      "notes": "Extracts clean URLs from CSS style attributes for images",
      "position": [
        256,
        -60
      ],
      "parameters": {
        "jsCode": "// Process photo URL from CSS style attribute\nif ($('Extract Post Content').first().json.photo) {\n  const styleAttr = $('Extract Post Content').first().json.photo;\n  const urlMatch = styleAttr.match(/background-image:url\\('([^']+)'\\)/);\n  \n  if (urlMatch && urlMatch[1]) {\n    $input.first().json.photo = urlMatch[1];\n  } else {\n    // Fallback: try to extract from quotes\n    const arr = styleAttr.split(\"'\");\n    if (arr.length >= 2) {\n      $input.first().json.photo = arr[arr.length - 2];\n    }\n  }\n}\n\nreturn $input.all();"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "8f05161f-776b-4684-9acc-d2cc426ad78c",
      "name": "¿Tiene Foto?",
      "type": "n8n-nodes-base.if",
      "notes": "Checks if the post contains a photo",
      "position": [
        476,
        -260
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "202a35e0-040c-47d2-9aaa-2f7d295ac2dd",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.photo }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "70c14a77-b297-4ac2-9ec4-a9d7124b7ce4",
      "name": "¿Tiene Video?",
      "type": "n8n-nodes-base.if",
      "notes": "Checks if the post contains a video",
      "position": [
        476,
        140
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "95dcac89-39c4-4a0a-8c1c-e1c560be755f",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Extract Post Content').item.json.video }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "11abbf2e-043b-4129-b15b-f625bb12802a",
      "name": "¿Solo Texto?",
      "type": "n8n-nodes-base.if",
      "position": [
        476,
        -60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7d0504ca-12c6-4496-8879-3f7d295ac2dd",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $('Extract Post Content').item.json.video }}",
              "rightValue": ""
            },
            {
              "id": "3cca8e10-546a-4b42-ac6f-0cc91773949c",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $('Extract Post Content').item.json.photo }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "926e4cca-4028-43bf-98ae-4f1e6f38fc08",
      "name": "Descargar Foto",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Downloads the photo from Telegram servers",
      "position": [
        696,
        -260
      ],
      "parameters": {
        "url": "={{ $json.photo }}",
        "options": {
          "timeout": 30000
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "a2349dfe-45f9-4688-a915-0af0587a0e48",
      "name": "Descargar Video",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Downloads the video from Telegram servers",
      "position": [
        696,
        140
      ],
      "parameters": {
        "url": "={{ $('Extract Post Content').item.json.video }}",
        "options": {
          "timeout": 60000
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "28a45272-c1a7-44cc-b396-aa40485baf37",
      "name": "Enviar Foto al Canal",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends the translated post with photo to target channel",
      "position": [
        916,
        -260
      ],
      "webhookId": "d72b2e9d-c37c-4bbe-985b-8b1699bce9b3",
      "parameters": {
        "chatId": "={{ $('Set Telegram Channels').item.json.targetChannel }}",
        "operation": "sendPhoto",
        "binaryData": true,
        "additionalFields": {
          "caption": "={{ $json.message.content }}\\n{{ $('Set Telegram Channels').item.json.channelSignature }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "XfNUxlQY3eiC3bFY",
          "name": "TelegramAIWriterBot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cd3f5b26-0250-4a12-9dec-2b82891b1daf",
      "name": "Enviar Video al Canal",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends the translated post with video to target channel",
      "position": [
        916,
        140
      ],
      "webhookId": "c532eafe-875d-4ac2-8d77-52f5dd84c3c5",
      "parameters": {
        "chatId": "={{ $('Set Telegram Channels').item.json.targetChannel }}",
        "operation": "sendVideo",
        "binaryData": true,
        "additionalFields": {
          "caption": "={{ $json.message.content }}\\n{{ $('Set Telegram Channels').item.json.channelSignature }}"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "XCmO6hPfws6PgHMt",
          "name": "TelegramBotCryptoApp"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2737cc48-5c12-442a-8f6f-15a4e77f91c4",
      "name": "Enviar Texto al Canal",
      "type": "n8n-nodes-base.telegram",
      "notes": "Sends text-only translated posts to target channel",
      "position": [
        696,
        -60
      ],
      "webhookId": "c58b24f7-3799-4021-be07-fe74705ef7c3",
      "parameters": {
        "text": "={{ $json.message.content }}\\n{{ $('Set Telegram Channels').item.json.channelSignature }}",
        "chatId": "={{ $('Set Telegram Channels').item.json.targetChannel }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9cc2d449-c59a-460f-bb50-236cd914783c",
      "name": "📖 Instrucciones de Configuración",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1400,
        -760
      ],
      "parameters": {
        "width": 500,
        "height": 620,
        "content": "## Telegram Channel Content Copier & Translator\n**Automatically copies and translates content from one Telegram channel to another**\n\n### What this workflow does:\n- 📅 Runs daily at a scheduled time\n- 🔍 Fetches the latest post from a source Telegram channel\n- 🌐 Translates the content using OpenAI\n- 📤 Republishes to your target channel\n- 🖼️ Supports text, images, and videos\n\n### Setup Instructions:\n1. **Configure channels** in the 'Set Source Channel' node\n2. **Set up Telegram Bot** credentials\n3. **Add OpenAI API** credentials\n4. **Adjust schedule** as needed\n\n### Required Credentials:\n- Telegram Bot API\n- OpenAI API\n\n[Documentation & Support](https://n8n.io/integrations/telegram/)"
      },
      "typeVersion": 1
    },
    {
      "id": "5900c319-3a6f-4057-ab5c-209ceb0d9d61",
      "name": "Configurar Canales Telegram",
      "type": "n8n-nodes-base.set",
      "notes": "Configure your source channel, target channel, and other settings here",
      "position": [
        -1000,
        -60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "source_channel",
              "name": "sourceChannel",
              "type": "string",
              "value": "channel_username"
            },
            {
              "id": "target_channel",
              "name": "targetChannel",
              "type": "string",
              "value": "@channel_username"
            },
            {
              "id": "target_language",
              "name": "targetLanguage",
              "type": "string",
              "value": "Persian"
            },
            {
              "id": "channel_signature",
              "name": "channelSignature",
              "type": "string",
              "value": "@channel_username"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "7902b67b-24f5-4d7b-b54e-85b22e97c073",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1020,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 220,
        "content": "## 1. Get the html content of the source Telegram channel\nIn this part of the workflow we fetch the html content of source channel and then extract text, images, and videos from the latest Telegram post.\nRemoves original channel signatures and cleans up the text"
      },
      "typeVersion": 1
    },
    {
      "id": "5c68259a-a22d-4c35-8bbb-7853233e3cb8",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -180
      ],
      "parameters": {
        "color": 7,
        "width": 360,
        "content": "## 2. Use AI for translation\n\nUses OpenAI to translate the post content to the target language"
      },
      "typeVersion": 1
    },
    {
      "id": "56690988-fe75-43b6-9919-2e7d52a66bc6",
      "name": "Nota Adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        226,
        -420
      ],
      "parameters": {
        "color": 7,
        "width": 600,
        "height": 720,
        "content": "## 3. Extract Media URLs and Identify Media Type\nTelegram uses different methods for handling image and video content. In this step, we identify the type of media included in the post.\n\nIf the post contains an image or video, the corresponding media file is downloaded."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6d57d267-bda4-417a-b3f5-3be54a01e92d",
  "connections": {
    "8f05161f-776b-4684-9acc-d2cc426ad78c": {
      "main": [
        [
          {
            "node": "926e4cca-4028-43bf-98ae-4f1e6f38fc08",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "70c14a77-b297-4ac2-9ec4-a9d7124b7ce4": {
      "main": [
        [
          {
            "node": "a2349dfe-45f9-4688-a915-0af0587a0e48",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "11abbf2e-043b-4129-b15b-f625bb12802a": {
      "main": [
        [
          {
            "node": "2737cc48-5c12-442a-8f6f-15a4e77f91c4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "aeb0620d-095c-4238-8dd0-0232c4905e19": {
      "main": [
        [
          {
            "node": "5900c319-3a6f-4057-ab5c-209ceb0d9d61",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "926e4cca-4028-43bf-98ae-4f1e6f38fc08": {
      "main": [
        [
          {
            "node": "28a45272-c1a7-44cc-b396-aa40485baf37",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a2349dfe-45f9-4688-a915-0af0587a0e48": {
      "main": [
        [
          {
            "node": "cd3f5b26-0250-4a12-9dec-2b82891b1daf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "31508b88-fd99-4b7c-abb7-52084caf9373": {
      "main": [
        [
          {
            "node": "e0017199-a33a-4866-9fa8-3be34fbf20e8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "715418a9-9598-460a-817e-e2b681f336c4": {
      "main": [
        [
          {
            "node": "31508b88-fd99-4b7c-abb7-52084caf9373",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3ea234cc-4f02-4216-8013-554eb1fba0fd": {
      "main": [
        [
          {
            "node": "eb0d33be-2e66-43cc-90fa-d1b9878615d9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e0017199-a33a-4866-9fa8-3be34fbf20e8": {
      "main": [
        [
          {
            "node": "8f05161f-776b-4684-9acc-d2cc426ad78c",
            "type": "main",
            "index": 0
          },
          {
            "node": "70c14a77-b297-4ac2-9ec4-a9d7124b7ce4",
            "type": "main",
            "index": 0
          },
          {
            "node": "11abbf2e-043b-4129-b15b-f625bb12802a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eb0d33be-2e66-43cc-90fa-d1b9878615d9": {
      "main": [
        [
          {
            "node": "715418a9-9598-460a-817e-e2b681f336c4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5900c319-3a6f-4057-ab5c-209ceb0d9d61": {
      "main": [
        [
          {
            "node": "3ea234cc-4f02-4216-8013-554eb1fba0fd",
            "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 - Redes sociales, 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 nodos19
Categoría2
Tipos de nodos9
Descripción de la dificultad

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

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34