Comentarios automáticos de LinkedIn - Centro de creadores

Avanzado

Este es unSocial Media, Multimodal AIflujo de automatización del dominio deautomatización que contiene 39 nodos.Utiliza principalmente nodos como If, Set, Code, Wait, ConvertToFile. Interacción automática de comentarios en LinkedIn con GPT-4o y Phantombuster

Requisitos previos
  • 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": "rkxGxBa9TAlFHrSd",
  "meta": {
    "instanceId": "2cf742429c2e3ee4e5a20069d3d8a75208519303b864f026a79464efa726bd95",
    "templateCredsSetupCompleted": true
  },
  "name": "LinkedIn Auto Commenting - Creators Hub",
  "tags": [],
  "nodes": [
    {
      "id": "ca0ddcb6-eac0-4dd6-ba06-7b2dafdebe0c",
      "name": "Esperar",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1152,
        -1200
      ],
      "webhookId": "034ce185-00da-45f3-8695-9624d3467de1",
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "15a3b305-304c-443f-aee8-53bad10415e9",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1424,
        -656
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "chatgpt-4o-latest"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "E4PFATctY0kV00hl",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a17410db-8f35-4a32-9411-f94dd68267c3",
      "name": "Esperar1",
      "type": "n8n-nodes-base.wait",
      "position": [
        -320,
        -800
      ],
      "webhookId": "5123048c-4e3b-4596-926b-8a26dd943b0f",
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "bfb60257-2e4b-42d5-80cd-2626cb3d114c",
      "name": "Ejecutar Agente",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -1360,
        -1200
      ],
      "parameters": {
        "agentId": "={{ $json.id }}",
        "jsonParameters": true,
        "additionalFields": {
          "argumentsJson": "={\n  \"category\": \"Content\",\n\"connectionDegreesToScrape\": [\"2\", \"3+\"],\n  \"numberOfLinesPerLaunch\": {{$('Set ENV Variables').item.json.ENV_SEARCH_RESULTS_PER_LAUNCH}},\n\"numberOfResultsPerLaunch\": {{$('Set ENV Variables').item.json.ENV_SEARCH_RESULTS_PER_LAUNCH}},\n\"numberOfResultsPerSearch\": {{$('Set ENV Variables').item.json.ENV_SEARCH_RESULTS_PER_LAUNCH}},\n  \"searchType\": \"keywords\",\n\"enrichLeadsWithAdditionalInformation\": true,\n  \"linkedInSearchUrl\": \"https://www.linkedin.com/search/results/all/\",\n  \"identityId\": \"8677906884862411\",\n  \"sessionCookie\": \"{{$('Set ENV Variables').item.json.ENV_SESSION_COOKIE}}\",\n  \"keywords\": \"{{$('Set ENV Variables').item.json.ENV_SEARCH_TERM}}\"\n}"
        }
      },
      "credentials": {
        "phantombusterApi": {
          "id": "Zf0AAqqdjBFfyW4W",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a2789353-cb54-40d9-b02c-28ec853e2859",
      "name": "Obtener Publicación Aleatoria",
      "type": "n8n-nodes-base.code",
      "position": [
        -2688,
        -800
      ],
      "parameters": {
        "jsCode": "const data = $input.all().map(item => item.json);\n\nif (!data || data.length === 0) {\n  throw new Error('No Instagram posts data found');\n}\n\n// Get a random post\nconst randomPost = data[Math.floor(Math.random() * data.length)];\n\n// Return only postUrl and description\nreturn {\n  json: {\n    postUrl: randomPost.postUrl,\n    description: randomPost.textContent\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "85ccb579-aa24-4819-aa8b-68885e82306b",
      "name": "Crear Comentario",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1424,
        -800
      ],
      "parameters": {
        "text": "=Du bist ein spezialisierter Social Media Content Creator.\n\n**AUFGABE:** {{ $('Set ENV Variables').first().json.ENV_COMMENT_PROMPT }}\n\n**KOMMENTAR RICHTLINIEN:**\n- Antworte NUR auf {{ $('Set ENV Variables').first().json.ENV_COMMENT_LANGUAGE }}\n- Maximal 150 Zeichen (LinkedIn-optimiert)\n- Beziehe dich subtil auf den Original-Post Inhalt\n\n**POST-INHALT FÜR KOMMENTAR:**\n{{ $('Get Random Post').first().json.description }} \n\nErstelle einen perfekten LinkedIn-Kommentar.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "452b162d-1a7d-49e7-a76b-dc484dd9f94e",
      "name": "Crear Binario CSV",
      "type": "n8n-nodes-base.code",
      "position": [
        -1104,
        -800
      ],
      "parameters": {
        "jsCode": "// Extract correct values\nconst postUrl = $('Get Random Post').first().json.postUrl + \"/?&actorCompanyId=\" + $('Set ENV Variables').first().json.ENV_COMPANY_ID_LINKEDIN;\nconst commentText = $input.first().json.output;\n\n// Clean utility\nconst clean = str => String(str || \"\").replace(/[\\u200B-\\u200D\\uFEFF]/g, \"\").trim();\n\n// Escape and quote single data row\nconst row = [\n  `\"${clean(postUrl).replace(/\"/g, '\"\"')}\"`,\n  `\"${clean(commentText).replace(/\"/g, '\"\"')}\"`\n];\n\n// Convert to buffer without header or BOM\nconst csvBuffer = Buffer.from(row.join(\",\") + \"\\n\", \"utf8\");\n\n// Return binary file\nreturn [\n  {\n    binary: {\n      data: {\n        data: csvBuffer,\n        mimeType: \"text/csv\",\n        fileName: \"phantombuster_clean.csv\"\n      }\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "002902d4-7228-4a45-8a7d-0ac89b7cd002",
      "name": "Subir CSV",
      "type": "n8n-nodes-base.microsoftSharePoint",
      "position": [
        -960,
        -800
      ],
      "parameters": {
        "site": {
          "__rl": true,
          "mode": "list",
          "value": "plemeo.sharepoint.com,f304c34c-1252-4b99-a852-059c2036c718,c3bf26ab-bf44-4334-8e5b-e8b680bb9e1d",
          "cachedResultName": "plemeo"
        },
        "folder": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWAY4RSXX7PGSC5CL27V2Y7XYSNQZ",
          "cachedResultName": "Phantombuster"
        },
        "fileName": "linkedin_posts_to_comment.csv",
        "operation": "upload",
        "fileContents": "data",
        "requestOptions": {}
      },
      "credentials": {
        "microsoftSharePointOAuth2Api": {
          "id": "jZkLTQXyVEzxtmp3",
          "name": "Microsoft SharePoint account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cb09abc7-128f-46b9-9757-bf4634adc9aa",
      "name": "Obtener Agente de Autocomentario",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -720,
        -800
      ],
      "parameters": {
        "agentId": "5630833318534903",
        "operation": "get"
      },
      "credentials": {
        "phantombusterApi": {
          "id": "Zf0AAqqdjBFfyW4W",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e8b8b531-e2b9-4ae7-86f2-e7425899ec0c",
      "name": "Obtener Publicaciones",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -976,
        -1200
      ],
      "parameters": {
        "agentId": "1609454338224846",
        "operation": "getOutput",
        "additionalFields": {}
      },
      "credentials": {
        "phantombusterApi": {
          "id": "Zf0AAqqdjBFfyW4W",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6a40123b-2583-420f-a5c7-be371d238c82",
      "name": "Ejecutar Agente de AC",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -512,
        -800
      ],
      "parameters": {
        "agentId": "5630833318534903",
        "jsonParameters": true,
        "additionalFields": {
          "argumentsJson": "={\n  \"numberOfLinesPerLaunch\": 1,\n  \"sessionCookie\": \"{{$('Set ENV Variables').first().json.ENV_SESSION_COOKIE}}\",\n  \"spreadsheetUrl\": \"{{ $('Upload CSV').item.json['@content.downloadUrl'] }}\"\n}"
        }
      },
      "credentials": {
        "phantombusterApi": {
          "id": "Zf0AAqqdjBFfyW4W",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "02649ff0-8f07-4ac0-bfe2-dc0c5f97f78c",
      "name": "Obtener Respuesta",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -128,
        -800
      ],
      "parameters": {
        "agentId": "5630833318534903",
        "operation": "getOutput",
        "additionalFields": {}
      },
      "credentials": {
        "phantombusterApi": {
          "id": "Zf0AAqqdjBFfyW4W",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3a931925-82d0-4d6e-a518-68a47737a0c0",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2128,
        -1344
      ],
      "parameters": {
        "color": 5,
        "width": 1300,
        "height": 400,
        "content": "## Get LinkedIn Posts By Search Keyword\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9bc3959d-9de7-48ad-ba9e-d767f4480284",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2896,
        -928
      ],
      "parameters": {
        "color": 3,
        "width": 2068,
        "height": 364,
        "content": "## Process Posts and Generate Comment \n"
      },
      "typeVersion": 1
    },
    {
      "id": "f1e33aa2-258e-484b-bf51-3a6640ea45a9",
      "name": "Nota Adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -928
      ],
      "parameters": {
        "width": 948,
        "height": 368,
        "content": "## Launch Autocomment Agent to Post Comment\n"
      },
      "typeVersion": 1
    },
    {
      "id": "98ef2702-956a-4885-9ce1-9bc999328f04",
      "name": "Obtener Agente de Búsqueda",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -1552,
        -1200
      ],
      "parameters": {
        "agentId": "1609454338224846",
        "operation": "get"
      },
      "credentials": {
        "phantombusterApi": {
          "id": "Zf0AAqqdjBFfyW4W",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "67dafef7-8e3f-4534-b794-c67256491d40",
      "name": "Establecer Variables de Entorno",
      "type": "n8n-nodes-base.set",
      "position": [
        -1760,
        -1200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e24e8c1a-c6c9-4ae2-a0ef-e0e7369dc262",
              "name": "ENV_SEARCH_TERM",
              "type": "string",
              "value": "={{ $json.output.parseJson().search_term }}"
            },
            {
              "id": "cf050595-8ad9-4f78-bca4-f463e8b9982e",
              "name": "ENV_SESSION_COOKIE",
              "type": "string",
              "value": "={{ $('Select Cookie').first().json.output.parseJson().session_cookie }}"
            },
            {
              "id": "29cce2e6-90ae-419c-8f2c-9cd310726183",
              "name": "ENV_SEARCH_RESULTS_PER_LAUNCH",
              "type": "string",
              "value": "5"
            },
            {
              "id": "6c337012-3bd9-49b9-86a4-b8e9795eb8f7",
              "name": "ENV_COMMENT_PROMPT",
              "type": "string",
              "value": "Erstelle einen ansprechenden LinkedIn-Kommentar basierend auf dem gegebenen Post-Inhalt."
            },
            {
              "id": "eee1f029-fa62-439b-a52f-4d8820e55be4",
              "name": "ENV_COMMENT_LANGUAGE",
              "type": "string",
              "value": "Deutsch"
            },
            {
              "id": "6e8e7b08-ffa6-4411-a143-e8e7ec70d191",
              "name": "ENV_COMPANY_ID_LINKEDIN",
              "type": "string",
              "value": "78274663"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e6c2b43e-1e74-42c2-82ac-e299d3398f08",
      "name": "Generar Término de Búsqueda Aleatorio",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2112,
        -1200
      ],
      "parameters": {
        "text": "=Can you create a single random search term related to Artificial Intelligence and Business Process Automation, suitable for fetching LinkedIn posts?\nThe search term should be human like. Something like \"AIBizAutomation\" is not realistic.\nYou can be very vague and also use IT companies as search terms.\nTry to be as random as possible because I can't track with search terms you already generated and I can use a search term only once.\n\nPlease respond only with a **valid, raw JSON object**, like this:\n{\n  \"search_term\": \"Automation\"\n}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "89eb5d65-6a89-4031-90ee-866330f479b9",
      "name": "Activador Programado",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1984,
        -1600
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fc10ed9b-2f5b-4b0d-9795-e47e609c6f8a",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2096,
        -1056
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "chatgpt-4o-latest"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "E4PFATctY0kV00hl",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "216af711-09a5-4e01-aa3f-a43e31337a67",
      "name": "Actualizar Archivo",
      "type": "n8n-nodes-base.microsoftSharePoint",
      "position": [
        -1568,
        -800
      ],
      "parameters": {
        "file": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWA36Y6B5NNKSCFHLCZIRBXOG5NCW",
          "cachedResultName": "linkedin_posts_already_commented.csv"
        },
        "site": {
          "__rl": true,
          "mode": "list",
          "value": "plemeo.sharepoint.com,f304c34c-1252-4b99-a852-059c2036c718,c3bf26ab-bf44-4334-8e5b-e8b680bb9e1d",
          "cachedResultName": "plemeo"
        },
        "folder": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWAY4RSXX7PGSC5CL27V2Y7XYSNQZ",
          "cachedResultName": "Phantombuster"
        },
        "fileName": "linkedin_posts_already_commented.csv",
        "operation": "update",
        "fileContents": "data",
        "requestOptions": {},
        "changeFileContent": true
      },
      "credentials": {
        "microsoftSharePointOAuth2Api": {
          "id": "jZkLTQXyVEzxtmp3",
          "name": "Microsoft SharePoint account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6801929d-4ad1-4603-92de-6f773fe2c6cf",
      "name": "Descargar Archivo",
      "type": "n8n-nodes-base.microsoftSharePoint",
      "position": [
        -2528,
        -800
      ],
      "parameters": {
        "file": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWA36Y6B5NNKSCFHLCZIRBXOG5NCW",
          "cachedResultName": "linkedin_posts_already_commented.csv"
        },
        "site": {
          "__rl": true,
          "mode": "list",
          "value": "plemeo.sharepoint.com,f304c34c-1252-4b99-a852-059c2036c718,c3bf26ab-bf44-4334-8e5b-e8b680bb9e1d",
          "cachedResultName": "plemeo"
        },
        "folder": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWAY4RSXX7PGSC5CL27V2Y7XYSNQZ",
          "cachedResultName": "Phantombuster"
        },
        "requestOptions": {}
      },
      "credentials": {
        "microsoftSharePointOAuth2Api": {
          "id": "jZkLTQXyVEzxtmp3",
          "name": "Microsoft SharePoint account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "27a4bc94-8859-48c5-94c5-c98a1bd817ce",
      "name": "Verificar si está en Lista",
      "type": "n8n-nodes-base.code",
      "position": [
        -2208,
        -800
      ],
      "parameters": {
        "jsCode": "const randomPost = normalizeUrl($('Get Random Post').first().json.postUrl);\nconst allItems = $('Extract from File').all();\n\nif (!allItems || allItems.length === 0) {\n  return [{ json: { isDuplicate: false } }];\n}\n\nfunction normalizeUrl(url) {\n  if (typeof url !== 'string') {\n    console.log(\"🚨 NOT A STRING:\", url);\n    return '';\n  }\n  return url.trim().toLowerCase().replace(/\\/$/, '');\n}\n\n// Helper function to get postUrl value regardless of BOM\nfunction getPostUrl(item) {\n  const json = item.json;\n  // Try normal field name first\n  if (json.postUrl) return json.postUrl;\n  \n  // Look for any field containing \"postUrl\"\n  const postUrlKey = Object.keys(json).find(key => key.includes('postUrl'));\n  return postUrlKey ? json[postUrlKey] : null;\n}\n\nconsole.log(\"✅ randomPost:\", randomPost);\nconsole.log(\"✅ allItems:\", allItems);\n\nlet isDuplicate = false;\n\nfor (const item of allItems) {\n  const candidateRaw = getPostUrl(item);\n  const candidate = normalizeUrl(candidateRaw);\n\n  console.log(`🟠 Comparing:\\n→ raw: ${candidateRaw}\\n→ normalized: ${candidate}\\n→ target: ${randomPost}`);\n\n  if (candidate === randomPost) {\n    isDuplicate = true;\n    break;\n  }\n}\n\nreturn [{ json: { isDuplicate } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "34a9d026-17b9-4f8b-bdf1-22c10b0bd71c",
      "name": "Si",
      "type": "n8n-nodes-base.if",
      "position": [
        -2064,
        -800
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bcef43b3-e773-45ba-b245-19ab3fc1e508",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Check if in List').first().json.isDuplicate }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "111cacd8-845a-4886-be50-b59d0fd3cc5d",
      "name": "Esperar2",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2848,
        -800
      ],
      "webhookId": "df99f781-2d6d-4a98-9846-97843180f9e7",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "9988cda7-1734-4c89-a2a0-664a8cbd8119",
      "name": "Preparar Datos Actualizados",
      "type": "n8n-nodes-base.code",
      "position": [
        -1888,
        -800
      ],
      "parameters": {
        "jsCode": "const existingUrls = $('Extract from File').all().map(item => {\n  // Get the first key (which has the BOM) and use its value\n  const firstKey = Object.keys(item.json)[0];\n  return { postUrl: item.json[firstKey] };\n});\n\nconsole.log(\"existingUrls: \", existingUrls);\n\nconst randomPost = $('Get Random Post').first().json.postUrl;\nconsole.log(\"randomPost: \", randomPost);\n\nreturn [\n  ...existingUrls,\n  { postUrl: randomPost }\n].map(entry => ({ json: entry }));"
      },
      "typeVersion": 2
    },
    {
      "id": "65e3d941-304a-4aec-ba3d-416254a6159d",
      "name": "Extraer de Archivo",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -2368,
        -800
      ],
      "parameters": {
        "options": {
          "headerRow": true
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "eca4b1a3-d938-4e77-a7ac-237b831140e3",
      "name": "Convertir a Archivo",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -1728,
        -800
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "d1eddbdf-1fde-4f2d-b6b1-b77aa9fc07a9",
      "name": "Obtener Cookies de Sesión Disponibles",
      "type": "n8n-nodes-base.microsoftSharePoint",
      "position": [
        -1808,
        -1600
      ],
      "parameters": {
        "file": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWA6IR6PTZ4EFZVH2XP5XGQ2MVXRW",
          "cachedResultName": "linkedin_session_cookies.txt"
        },
        "site": {
          "__rl": true,
          "mode": "list",
          "value": "plemeo.sharepoint.com,f304c34c-1252-4b99-a852-059c2036c718,c3bf26ab-bf44-4334-8e5b-e8b680bb9e1d",
          "cachedResultName": "plemeo"
        },
        "folder": {
          "__rl": true,
          "mode": "list",
          "value": "01M45PWAY4RSXX7PGSC5CL27V2Y7XYSNQZ",
          "cachedResultName": "Phantombuster"
        },
        "requestOptions": {}
      },
      "credentials": {
        "microsoftSharePointOAuth2Api": {
          "id": "jZkLTQXyVEzxtmp3",
          "name": "Microsoft SharePoint account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6e7b0891-dfb0-427a-b1cf-898ee211b00d",
      "name": "Extraer Cookies",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1600,
        -1600
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1
    },
    {
      "id": "64342664-102c-4861-990d-b08b4ad990ac",
      "name": "Seleccionar Cookie",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1376,
        -1600
      ],
      "parameters": {
        "text": "=##################  PROMPT  ##################\n\n**ROLE:**  You are a session-cookie selector.\n\n**CURRENT BERLIN TIME**  \nDate & time : {{ $now.setZone('Europe/Berlin').format('DD HH:mm:ss') }}  \nHour (00-23): {{ $now.setZone('Europe/Berlin').format('HH') }}\n\n**SESSION COOKIES (keep order):**  \n{{ $json.data }}\n\n**SELECTION LOGIC**\n\n1. Let  \n   • N = number of cookies in the list (2 ≤ N ≤ 4).  \n   • H = current hour as an integer (0–23).  \n   • W = 24 ÷ N  (the width of each time slice in hours, always an integer).\n\n2. Determine the slice index:  \n   sliceIndex = floor(H ÷ W)  // 0-based\n\n3. Choose the cookie at position *(sliceIndex + 1)* in the list.  \n   • Example when N = 4 (W = 6):  \n     00-05 → 1st, 06-11 → 2nd, 12-17 → 3rd, 18-23 → 4th  \n   • Example when N = 3 (W = 8):  \n     00-07 → 1st, 08-15 → 2nd, 16-23 → 3rd  \n   • Example when N = 2 (W = 12):  \n     00-11 → 1st, 12-23 → 2nd\n\n**OUTPUT FORMAT**  \nReturn only the selected session cookie value in a valid JSON-Field called \"session_cookie\", nothing else.\n\n##############################################",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "eda83bef-559d-4b03-8ab6-45b42e053242",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1376,
        -1456
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "chatgpt-4o-latest"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "E4PFATctY0kV00hl",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f49fb8ab-8e40-4cfb-86b5-0228308c9d3f",
      "name": "Nota Adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2128,
        -1728
      ],
      "parameters": {
        "color": 6,
        "width": 1300,
        "height": 368,
        "content": "## Get LinkedIn Posts By Search Keyword\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5fddace1-4fc4-449a-bc5b-b581ccc9fd6f",
      "name": "Nota Adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -1728
      ],
      "parameters": {
        "width": 432,
        "height": 288,
        "content": "### 1) Cookie & Search Term Selection  \n**What it does**  \n• Downloads cookie list ➜ **Select Cookie** picks one by time slice.  \n• **Generate Random Search Term** (GPT-4o) outputs a keyword.\n\n**Credentials**  \nOpenAI + SharePoint OAuth2.\n\n**Tweaks**  \n• Edit the prompt for a different niche.  \n• Add/remove cookies in SharePoint file."
      },
      "typeVersion": 1
    },
    {
      "id": "f684ca9c-3656-4496-bdab-f2c240ceb5c1",
      "name": "Nota Adhesiva5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2544,
        -1344
      ],
      "parameters": {
        "width": 400,
        "height": 272,
        "content": "### 2) Scrape LinkedIn Posts  \n**What it does**  \n• **LinkedIn Search Agent** fetches posts for the keyword.  \n• **Get Posts** passes raw results downstream.\n\n**Credentials**  \nPhantombuster API.\n\n**Tweaks**  \n• Change `ENV_SEARCH_RESULTS_PER_LAUNCH`.  \n• Adjust search filters in the agent UI."
      },
      "typeVersion": 1
    },
    {
      "id": "8bbe5f78-b384-453b-b9a6-b2c92c013908",
      "name": "Nota Adhesiva6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2896,
        -544
      ],
      "parameters": {
        "width": 512,
        "height": 272,
        "content": "### 3) Comment Generation  \n**What it does**  \n• **Get Random Post** selects one post and extracts its text.  \n• **Create Comment** (GPT-4o) returns a ≤150-char reply in the specified language.\n\n**Credentials**  \nOpenAI.\n\n**Tweaks**  \n• Edit language or style in **Set ENV Variables** / prompt text.  \n• Increase character limit in the prompt if desired."
      },
      "typeVersion": 1
    },
    {
      "id": "2170e6f3-7006-40f3-8e8d-bbb29efa8f02",
      "name": "Nota Adhesiva7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2064,
        -544
      ],
      "parameters": {
        "width": 464,
        "height": 272,
        "content": "### 4) CSV Upload & Auto-comment  \n**What it does**  \n• Builds one-row CSV (post URL + comment).  \n• Uploads to SharePoint.  \n• **Auto-comment Agent** posts the reply on LinkedIn.\n\n**Credentials**  \nSharePoint OAuth2 + Phantombuster API.\n\n**Tweaks**  \n• Change company ID in **Set ENV Variables**.  \n• Replace SharePoint with Drive/Dropbox for hosting the CSV."
      },
      "typeVersion": 1
    },
    {
      "id": "de072d11-7806-4b91-886a-0d12e3aa8cde",
      "name": "Nota Adhesiva8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -544
      ],
      "parameters": {
        "width": 496,
        "height": 272,
        "content": "### 5) Deduplication  \n**What it does**  \n• Downloads `linkedin_posts_already_commented.csv`.  \n• **Check if in List** prevents commenting twice on the same URL.  \n• On success, appends the new URL and re-uploads the file.\n\n**Credentials**  \nSharePoint OAuth2.\n\n**Tweaks**  \n• Modify duplicate logic if you store extra columns.  \n• Switch to Google Sheets for manual review."
      },
      "typeVersion": 1
    },
    {
      "id": "cf384719-df40-43a8-8e26-ec74fc80bdb0",
      "name": "Nota Adhesiva9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -928
      ],
      "parameters": {
        "width": 464,
        "height": 240,
        "content": "### 6) Rate Limiting & Scheduling  \n**What it does**  \n• Hourly cron + **Wait** nodes keep totals near 120 comments/day\n  (24 launches × 5 posts).\n\n**Credentials**  \nNone\n\n**Tweaks**  \n• Edit cron rule or wait durations to match your plan limits.  \n• Raise `numberOfLinesPerLaunch` for more comments per run."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "df5d712c-3422-4b8a-bb75-95d1b61e7461",
  "connections": {
    "34a9d026-17b9-4f8b-bdf1-22c10b0bd71c": {
      "main": [
        [
          {
            "node": "111cacd8-845a-4886-be50-b59d0fd3cc5d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "9988cda7-1734-4c89-a2a0-664a8cbd8119",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ca0ddcb6-eac0-4dd6-ba06-7b2dafdebe0c": {
      "main": [
        [
          {
            "node": "e8b8b531-e2b9-4ae7-86f2-e7425899ec0c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a17410db-8f35-4a32-9411-f94dd68267c3": {
      "main": [
        [
          {
            "node": "02649ff0-8f07-4ac0-bfe2-dc0c5f97f78c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "111cacd8-845a-4886-be50-b59d0fd3cc5d": {
      "main": [
        [
          {
            "node": "a2789353-cb54-40d9-b02c-28ec853e2859",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e8b8b531-e2b9-4ae7-86f2-e7425899ec0c": {
      "main": [
        [
          {
            "node": "111cacd8-845a-4886-be50-b59d0fd3cc5d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "002902d4-7228-4a45-8a7d-0ac89b7cd002": {
      "main": [
        [
          {
            "node": "cb09abc7-128f-46b9-9757-bf4634adc9aa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "216af711-09a5-4e01-aa3f-a43e31337a67": {
      "main": [
        [
          {
            "node": "85ccb579-aa24-4819-aa8b-68885e82306b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bfb60257-2e4b-42d5-80cd-2626cb3d114c": {
      "main": [
        [
          {
            "node": "ca0ddcb6-eac0-4dd6-ba06-7b2dafdebe0c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6801929d-4ad1-4603-92de-6f773fe2c6cf": {
      "main": [
        [
          {
            "node": "65e3d941-304a-4aec-ba3d-416254a6159d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "64342664-102c-4861-990d-b08b4ad990ac": {
      "main": [
        [
          {
            "node": "e6c2b43e-1e74-42c2-82ac-e299d3398f08",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "85ccb579-aa24-4819-aa8b-68885e82306b": {
      "main": [
        [
          {
            "node": "452b162d-1a7d-49e7-a76b-dc484dd9f94e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "eca4b1a3-d938-4e77-a7ac-237b831140e3": {
      "main": [
        [
          {
            "node": "216af711-09a5-4e01-aa3f-a43e31337a67",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6e7b0891-dfb0-427a-b1cf-898ee211b00d": {
      "main": [
        [
          {
            "node": "64342664-102c-4861-990d-b08b4ad990ac",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a2789353-cb54-40d9-b02c-28ec853e2859": {
      "main": [
        [
          {
            "node": "6801929d-4ad1-4603-92de-6f773fe2c6cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6a40123b-2583-420f-a5c7-be371d238c82": {
      "main": [
        [
          {
            "node": "a17410db-8f35-4a32-9411-f94dd68267c3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "27a4bc94-8859-48c5-94c5-c98a1bd817ce": {
      "main": [
        [
          {
            "node": "34a9d026-17b9-4f8b-bdf1-22c10b0bd71c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "98ef2702-956a-4885-9ce1-9bc999328f04": {
      "main": [
        [
          {
            "node": "bfb60257-2e4b-42d5-80cd-2626cb3d114c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "89eb5d65-6a89-4031-90ee-866330f479b9": {
      "main": [
        [
          {
            "node": "d1eddbdf-1fde-4f2d-b6b1-b77aa9fc07a9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "452b162d-1a7d-49e7-a76b-dc484dd9f94e": {
      "main": [
        [
          {
            "node": "002902d4-7228-4a45-8a7d-0ac89b7cd002",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "65e3d941-304a-4aec-ba3d-416254a6159d": {
      "main": [
        [
          {
            "node": "27a4bc94-8859-48c5-94c5-c98a1bd817ce",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "15a3b305-304c-443f-aee8-53bad10415e9": {
      "ai_languageModel": [
        [
          {
            "node": "85ccb579-aa24-4819-aa8b-68885e82306b",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "67dafef7-8e3f-4534-b794-c67256491d40": {
      "main": [
        [
          {
            "node": "98ef2702-956a-4885-9ce1-9bc999328f04",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fc10ed9b-2f5b-4b0d-9795-e47e609c6f8a": {
      "ai_languageModel": [
        [
          {
            "node": "e6c2b43e-1e74-42c2-82ac-e299d3398f08",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "eda83bef-559d-4b03-8ab6-45b42e053242": {
      "ai_languageModel": [
        [
          {
            "node": "64342664-102c-4861-990d-b08b4ad990ac",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "9988cda7-1734-4c89-a2a0-664a8cbd8119": {
      "main": [
        [
          {
            "node": "eca4b1a3-d938-4e77-a7ac-237b831140e3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cb09abc7-128f-46b9-9757-bf4634adc9aa": {
      "main": [
        [
          {
            "node": "6a40123b-2583-420f-a5c7-be371d238c82",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e6c2b43e-1e74-42c2-82ac-e299d3398f08": {
      "main": [
        [
          {
            "node": "67dafef7-8e3f-4534-b794-c67256491d40",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d1eddbdf-1fde-4f2d-b6b1-b77aa9fc07a9": {
      "main": [
        [
          {
            "node": "6e7b0891-dfb0-427a-b1cf-898ee211b00d",
            "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.

Flujos de trabajo relacionados recomendados

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

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

Autor
plemeo

plemeo

@plemeo

Hi, I'm Gerhard from Plemeo. At plemeo.ai, we focus on AI-driven automation and workflow optimization. Our deep expertise with n8n enables us to streamline processes and boost efficiency in software development. This allows us to deliver real, measurable improvements. Curious how plemeo.ai and n8n can benefit your business? Reach out at info@plemeo.de or visit plemeo.ai.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34