Publicar WorkFlows
Marketing
Aitor
(@TuXeD)
Copiar
Este workflow automatiza la publicación de nuevos workflows en Telegram. Consulta un feed RSS cada minuto, filtra las publicaciones recientes y genera mensajes personalizados con íconos, títulos, resúmenes limpios y autores. Luego, envía el mensaje al canal con un botón que enlaza directamente al workflow. Simplifica la difusión de novedades en tiempo real desde la comunidad n8n.
Creado: 2024-11-30
4 nodos
{
"name": "Publicar WorkFlows",
"nodes": [
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"feedUrl": "https://workflows.comunidad-n8n.com/rss/workflows.rss"
},
"type": "n8n-nodes-base.rssFeedReadTrigger",
"typeVersion": 1,
"position": [
-660,
-40
],
"id": "d79c22d8-de37-4590-95d4-1df9c4dc50ce",
"name": "RSS"
},
{
"parameters": {
"jsCode": "var current_date = new Date();\nvar current_date_time = current_date.getTime();\n\n// Ajusta el rango a los \u00faltimos minutos\nvar previous_date = new Date();\nprevious_date.setMinutes(previous_date.getMinutes() - 1); // Cambia el rango a 1 minuto\nvar previous_date_time = previous_date.getTime();\n\n// Filtra las publicaciones dentro del rango del \u00faltimo minuto\nreturn items.filter(function(item) {\n if (!item.json.isoDate) {\n return false; // Ignorar si no tiene fecha\n }\n \n var item_date = new Date(item.json.isoDate);\n var item_date_time = item_date.getTime();\n \n return item_date_time > previous_date_time && \n item_date_time <= current_date_time; // <= asegura incluir las del instante actual\n});\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-440,
-40
],
"id": "9d6bc8b8-328f-4636-a211-090ba6de95e8",
"name": "Al Minuto",
"notesInFlow": true,
"notes": "Revisar que no se haya publicado hace 1 minuto"
},
{
"parameters": {
"jsCode": "const icons = {\n ai: '\ud83e\udd16',\n secops: '\ud83d\udee1\ufe0f',\n sales: '\ud83d\udcc8',\n itops: '\ud83d\udda5\ufe0f',\n marketing: '\ud83d\udce3',\n engineering: '\u2699\ufe0f',\n devops: '\ud83d\udcbb',\n buildingblocks: '\ud83c\udfd7\ufe0f',\n design: '\ud83c\udfa8',\n finance: '\ud83d\udcb0',\n hr: '\ud83d\udc65',\n other: '\ud83d\udd04',\n product: '\ud83d\udce6',\n support: '\ud83c\udfa7',\n};\n\nconst data = $json;\nconst categoryIcon = icons[data.categories[0]] || '\ud83d\udccc';\n\n// Elimina la parte de \"Publicado por\" del contenido\nconst contentCleaned = data.content.replace(/Publicado por:.*$/, '').trim();\n\nreturn [\n {\n message: `${categoryIcon} ${data.title} \\n\\n${contentCleaned} \\n\\n\n\ud83d\udd8b\ufe0f Autor: ${data.creator} `,\n link: data.link, // Enlace para enviar como bot\u00f3n o tarjeta\n },\n];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-200,
-40
],
"id": "2db754b2-76c7-43e6-be14-184a50e720bf",
"name": "GenerarMensaje"
},
{
"parameters": {
"chatId": "@comunidadn8n",
"text": "={{ $json.message }}",
"replyMarkup": "inlineKeyboard",
"inlineKeyboard": {
"rows": [
{
"row": {
"buttons": [
{
"text": "\ud83d\udd17 Ver Workflow",
"additionalFields": {
"url": "={{ $json.link }}"
}
}
]
}
}
]
},
"additionalFields": {
"appendAttribution": false,
"parse_mode": "HTML",
"message_thread_id": 25718
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
60,
-40
],
"id": "b5eee32a-b8b1-4bf9-a283-ca93ceee78de",
"name": "PublicarMensaje",
"credentials": {
"telegramApi": {
"id": "XRxLwjG0J2NHRst1",
"name": "Greeg"
}
}
}
],
"pinData": {},
"connections": {
"RSS": {
"main": [
[
{
"node": "Al Minuto",
"type": "main",
"index": 0
}
]
]
},
"Al Minuto": {
"main": [
[
{
"node": "GenerarMensaje",
"type": "main",
"index": 0
}
]
]
},
"GenerarMensaje": {
"main": [
[
{
"node": "PublicarMensaje",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "e16071b4-ff53-4ae5-8609-ed18b757b19d",
"meta": {
"instanceId": "33738330930e3881dd5571eca013f36ddf8aab20e4ea5c1f2ebaf4a2b4668ac6"
},
"id": "21NMAfLq3S7a6zrM",
"tags": []
}