Flujo de trabajo de monitoreo de Twitter

Intermedio

Este es unMarket Research, AI Summarizationflujo de automatización del dominio deautomatización que contiene 15 nodos.Utiliza principalmente nodos como If, Set, Slack, Switch, HttpRequest. Automatizar el análisis de sentimiento en Twitter con OpenAI, Google Sheets y recordatorios de Slack

Requisitos previos
  • Bot Token de Slack o URL de Webhook
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Credenciales de API de Google Sheets
  • 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": "GHDkm5yryfu6FoXN",
  "meta": {
    "instanceId": "fcb622cbd5234c565b9b78babeaf0ea2455df9d2aad0d1adff7c1ef99583e685",
    "templateCredsSetupCompleted": true
  },
  "name": "Twitter Monitoring Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9",
      "name": "Recorrer elementos",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -60,
        210
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "dec03e00-a5fa-44eb-b269-b486259ac1aa",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1380,
        -220
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={{ $('Set Field for Loop').item.json.tweet_text }}"
            },
            {
              "role": "system",
              "content": "=You are a professional Twitter social media user replying to the original poster (admin).\n\nAnalyze the sentiment of the tweet below. If the sentiment is positive, write a short, thoughtful reply **from a user's perspective**, directed to the person who posted it.\n\nThe reply should:\n- Show appreciation, agreement, or excitement\n- Be friendly, intelligent, and relevant to tech or AI fields\n- Use no emojis\n- Be under 160 characters\n- Address the original poster directly as a real person would\n\nTweet:\n\"\"\"\nuse a user prompt\n\"\"\""
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "ga54eHkT3k6225Zq",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "a6ebd6b7-29a4-4d02-ab90-5e74235485ea",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1020,
        180
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\"category\": \"neutral\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "c725e544-b9c4-4b5f-9e48-3e4ca1e8aec1",
      "name": "Get Post Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        -40
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.id }}",
              "lookupColumn": "ID"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1040262065,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E/edit#gid=1040262065",
          "cachedResultName": "Twitter(hashtag)"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E/edit?usp=drivesdk",
          "cachedResultName": "Google Map Scraper"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "cOspDa8h1hkwDLvX",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
      "name": "Sentiment Analyst",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        740,
        -80
      ],
      "parameters": {
        "text": "={{ $('Loop Over Items').item.json.tweet_text }}",
        "options": {
          "systemMessage": "You are a helpful AI assistant.Perfectly analyze the sentiment of this tweet_text and tell me in one word it is Positive, Neutral, or Negative."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "bc3fdb44-6588-4607-8e22-27a9bdf9ce9c",
      "name": "Interruptor According Analyst",
      "type": "n8n-nodes-base.switch",
      "position": [
        1180,
        -40
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Positive",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "394765f1-3f6b-484c-88ac-6eb699acd292",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "Positive"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Nagative",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d102e916-73dc-4774-81eb-7ca7e6e1033e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "Negative"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Neutral",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9e383471-7b1b-4311-9fab-92ce4db0301f",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output.category }}",
                    "rightValue": "Neutral"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "ce1e35b7-df4a-4969-81ed-21d8967cc834",
      "name": "Add Post Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1700,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('Set Field for Loop').item.json.id }}",
            "TweetUrl": "={{ $('Set Field for Loop').item.json.tweet_url }}",
            "TweetText": "={{ $('Set Field for Loop').item.json.tweet_text }}",
            "Post Reply": "={{ $json.message.content }}",
            "Sentiment ": "={{ $('Switch According Analyst').item.json.output.category }}"
          },
          "schema": [
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TweetUrl",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "TweetUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "TweetText",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "TweetText",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sentiment ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Post Reply",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Post Reply",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1040262065,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E/edit#gid=1040262065",
          "cachedResultName": "Twitter(hashtag)"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E/edit?usp=drivesdk",
          "cachedResultName": "Google Map Scraper"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "cOspDa8h1hkwDLvX",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": false
    },
    {
      "id": "0ac588c7-2612-482e-91c2-e2622840ec5e",
      "name": "Disparador programado",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -940,
        220
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b84b9a8a-e13e-41bf-96d0-aeb36c13c4be",
      "name": "Establecer Field for Loop",
      "type": "n8n-nodes-base.set",
      "position": [
        -280,
        210
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "56262d1d-f624-4e77-a03f-a0f2230070a6",
              "name": "id",
              "type": "string",
              "value": "={{ $json.postId }}"
            },
            {
              "id": "a32fc77b-7378-4ac4-a0af-193ae7092ae3",
              "name": "tweet_url",
              "type": "string",
              "value": "={{ $json.postUrl }}"
            },
            {
              "id": "f744541d-80db-46c6-91ad-3747ebac2c49",
              "name": "tweet_text",
              "type": "string",
              "value": "={{ $json.postText }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3e8a8b36-69c8-42dd-86c2-fdda0259184c",
      "name": "Send negative post message on slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1440,
        -60
      ],
      "webhookId": "ea8f7d60-91af-4452-adfa-2e00cf80acc6",
      "parameters": {
        "text": "=Received a Negative retweet on {{ $('Check Duplicate').item.json.TweetUrl }}. Consider if a response or clarification is needed.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C090F70N52M",
          "cachedResultName": "website-uptime"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "rURgzu95YUHybmaa",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "31469921-4053-435f-9909-ab5a7eb85204",
      "name": "Request for Twitter Post via Apify",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -720,
        220
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/scraper_one~x-posts-search/run-sync?token=api_key",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"query\": \"LaraconIn\",\n    \"resultsCount\": 5,\n    \"searchType\": \"latest\",\n    \"lang\":\"en\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "10774b92-a390-43de-a7a5-62ce25587e3e",
      "name": "Get Requested Post from Apify",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -500,
        200
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/scraper_one~x-posts-search/runs/last/dataset/items?token=api_key",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "31525bf2-922d-413e-bad7-9ea8b9099880",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -460
      ],
      "parameters": {
        "width": 800,
        "height": 560,
        "content": "## Sample Output Sheet\n- https://docs.google.com/spreadsheets/d/1sOxYQtX-O6p35FCNSRsovKEHL4w4GsfF-ylMVcwpb_E/edit?usp=sharing\n\n\n## Workflow Summary\nThis n8n workflow is designed to automate the collection, sentiment analysis, and response process for trending content. It uses the Apify API(https://apify.com/) to fetch trending data, performs sentiment analysis, and takes conditional actions based on the results. All outcomes are logged in a Google Sheet for record-keeping and future insights.\n\n## How to Use Apify API in n8n for Trending Data\n ### API Endpoint\n**Use this Apify Actor to fetch trending data via a POST request**\n*https://api.apify.com/v2/acts/scraper_one~x-posts-search/run-sync?token=YOUR_API_TOKEN*\nImportant: Replace YOUR_API_TOKEN with your actual Apify API token.\n\n### Request Body Format\n{\n  \"search\": \"YOUR TOPIC\", \n  \"mode\": \"latest\",\n  \"maxItems\": 10\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "29960d67-1378-49b3-9174-ac26aef71ad9",
      "name": "Modelo de chat OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        760,
        140
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "ga54eHkT3k6225Zq",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8bd4d3f7-9020-43c6-bf0e-788075c5ec6f",
      "name": "If Duplicate",
      "type": "n8n-nodes-base.if",
      "position": [
        380,
        -40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6f5c821d-8b4b-40ab-a025-1b7fcc42c78d",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.ID }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "09a99040-3fec-411f-a270-2f73092e0c8d",
  "connections": {
    "dec03e00-a5fa-44eb-b269-b486259ac1aa": {
      "main": [
        [
          {
            "node": "ce1e35b7-df4a-4969-81ed-21d8967cc834",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8bd4d3f7-9020-43c6-bf0e-788075c5ec6f": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ce1e35b7-df4a-4969-81ed-21d8967cc834": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c725e544-b9c4-4b5f-9e48-3e4ca1e8aec1": {
      "main": [
        [
          {
            "node": "8bd4d3f7-9020-43c6-bf0e-788075c5ec6f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "c725e544-b9c4-4b5f-9e48-3e4ca1e8aec1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "31469921-4053-435f-9909-ab5a7eb85204",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46": {
      "main": [
        [
          {
            "node": "Switch According Analyst",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Field for Loop": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a6ebd6b7-29a4-4d02-ab90-5e74235485ea": {
      "ai_outputParser": [
        [
          {
            "node": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Switch According Analyst": {
      "main": [
        [
          {
            "node": "dec03e00-a5fa-44eb-b269-b486259ac1aa",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3e8a8b36-69c8-42dd-86c2-fdda0259184c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ce1e35b7-df4a-4969-81ed-21d8967cc834",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "10774b92-a390-43de-a7a5-62ce25587e3e": {
      "main": [
        [
          {
            "node": "Set Field for Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "31469921-4053-435f-9909-ab5a7eb85204": {
      "main": [
        [
          {
            "node": "10774b92-a390-43de-a7a5-62ce25587e3e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3e8a8b36-69c8-42dd-86c2-fdda0259184c": {
      "main": [
        [
          {
            "node": "ce1e35b7-df4a-4969-81ed-21d8967cc834",
            "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?

Intermedio - Investigación de mercado, Resumen de IA

¿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
Intermedio
Número de nodos15
Categoría2
Tipos de nodos13
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
InfyOm Technologies

InfyOm Technologies

@infyom

We are an AI Automation Agency focusing on various AI Automation Services like, workflow automation, shopify automation, chatbot developerment, custom ai agent development and more.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34