Twitter監視ワークフロー

中級

これはMarket Research, AI Summarization分野の自動化ワークフローで、15個のノードを含みます。主にIf, Set, Slack, Switch, HttpRequestなどのノードを使用。 OpenAI、Googleスプレッドシート、Slackアラートを使用したTwitter感情分析の自動化

前提条件
  • Slack Bot Token または Webhook URL
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報
  • OpenAI API Key

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "GHDkm5yryfu6FoXN",
  "meta": {
    "instanceId": "fcb622cbd5234c565b9b78babeaf0ea2455df9d2aad0d1adff7c1ef99583e685",
    "templateCredsSetupCompleted": true
  },
  "name": "Twitter Monitoring Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9",
      "name": "アイテムのループ処理",
      "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": "構造化出力パーサー",
      "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": "投稿データの取得",
      "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": "感情分析担当",
      "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": "分析担当による切り替え",
      "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": "投稿データの追加",
      "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": "スケジュールトリガー",
      "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": "ループ用フィールドの設定",
      "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": "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": "Apify経由でのTwitter投稿リクエスト",
      "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": "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": "付箋メモ",
      "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": "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": "重複チェック",
      "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": "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ce1e35b7-df4a-4969-81ed-21d8967cc834": {
      "main": [
        [
          {
            "node": "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c725e544-b9c4-4b5f-9e48-3e4ca1e8aec1": {
      "main": [
        [
          {
            "node": "8bd4d3f7-9020-43c6-bf0e-788075c5ec6f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9": {
      "main": [
        [],
        [
          {
            "node": "c725e544-b9c4-4b5f-9e48-3e4ca1e8aec1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0ac588c7-2612-482e-91c2-e2622840ec5e": {
      "main": [
        [
          {
            "node": "31469921-4053-435f-9909-ab5a7eb85204",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "29960d67-1378-49b3-9174-ac26aef71ad9": {
      "ai_languageModel": [
        [
          {
            "node": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46": {
      "main": [
        [
          {
            "node": "bc3fdb44-6588-4607-8e22-27a9bdf9ce9c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b84b9a8a-e13e-41bf-96d0-aeb36c13c4be": {
      "main": [
        [
          {
            "node": "8fa04bf9-68e5-43b7-81f2-ee5f2355abd9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a6ebd6b7-29a4-4d02-ab90-5e74235485ea": {
      "ai_outputParser": [
        [
          {
            "node": "1def5fb1-e928-4c9e-bb7a-4f1ea5658d46",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "bc3fdb44-6588-4607-8e22-27a9bdf9ce9c": {
      "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": "b84b9a8a-e13e-41bf-96d0-aeb36c13c4be",
            "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
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 市場調査, AI要約

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数15
カテゴリー2
ノードタイプ13
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
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.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34