YouTube新着動画→自動リンク投稿をSlackへ

中級

これはSocial Media, Multimodal AI分野の自動化ワークフローで、6個のノードを含みます。主にCode, Cron, Slack, HttpRequestなどのノードを使用。 YouTubeの動画通知をSlackへ自動送信

前提条件
  • Slack Bot Token または Webhook URL
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "name": "YouTube New Video → Auto-Post Link to Slack",
  "nodes": [
    {
      "id": "setup-instructions",
      "name": "セットアップ手順",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        80
      ],
      "parameters": {
        "width": 280,
        "height": 220,
        "content": "🎬 **SETUP REQUIRED:**\n\n1. **Get YouTube Channel RSS:**\n   - Go to channel → View Page Source\n   - Find: channel/UC[CHANNEL_ID]\n   - RSS URL: youtube.com/feeds/videos.xml?channel_id=[ID]\n   - Replace in HTTP Request node\n\n2. **Slack Connection:**\n   - Connect Slack OAuth\n   - Update channel in final node\n\n3. **Timing:**\n   - Runs every 30 minutes\n   - Adjust cron if needed\n\n✨ Tracks last video to avoid duplicates!"
      },
      "typeVersion": 1
    },
    {
      "id": "youtube-check-trigger",
      "name": "30分ごとに確認",
      "type": "n8n-nodes-base.cron",
      "position": [
        200,
        300
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "*/30 * * * *"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fetch-youtube-rss",
      "name": "YouTube RSSを取得",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        300
      ],
      "parameters": {
        "url": "https://www.youtube.com/feeds/videos.xml?channel_id=YOUR_CHANNEL_ID_HERE",
        "options": {}
      },
      "typeVersion": 4.1
    },
    {
      "id": "parse-rss-data",
      "name": "RSS解析と新着動画チェック",
      "type": "n8n-nodes-base.code",
      "position": [
        600,
        300
      ],
      "parameters": {
        "jsCode": "// Parse YouTube RSS feed and extract video data\nconst rssData = $input.first().json;\nconst xmlContent = rssData;\n\n// Simple XML parsing for YouTube RSS\nconst entries = [];\nconst entryMatches = xmlContent.matchAll(/<entry[\\s\\S]*?<\\/entry>/g);\n\nfor (const match of entryMatches) {\n  const entry = match[0];\n  \n  // Extract video data using regex\n  const titleMatch = entry.match(/<title><!\\[CDATA\\[([^\\]]+)\\]\\]><\\/title>/);\n  const linkMatch = entry.match(/<link rel=\"alternate\" href=\"([^\"]+)\"\\/?>/);\n  const publishedMatch = entry.match(/<published>([^<]+)<\\/published>/);\n  const descriptionMatch = entry.match(/<media:description><!\\[CDATA\\[([^\\]]+)\\]\\]><\\/media:description>/);\n  const videoIdMatch = entry.match(/watch\\?v=([^&]+)/);\n  \n  if (titleMatch && linkMatch && publishedMatch) {\n    entries.push({\n      title: titleMatch[1],\n      link: linkMatch[1],\n      published: publishedMatch[1],\n      description: descriptionMatch ? descriptionMatch[1].substring(0, 200) + '...' : '',\n      video_id: videoIdMatch ? videoIdMatch[1] : '',\n      published_timestamp: new Date(publishedMatch[1]).getTime()\n    });\n  }\n}\n\n// Sort by publication date (newest first)\nentries.sort((a, b) => b.published_timestamp - a.published_timestamp);\n\n// Get the most recent video\nconst latestVideo = entries[0];\n\nif (!latestVideo) {\n  console.log('No videos found in RSS feed');\n  return null;\n}\n\n// Check if this video is new (published within last 2 hours)\nconst twoHoursAgo = Date.now() - (2 * 60 * 60 * 1000);\nconst isNewVideo = latestVideo.published_timestamp > twoHoursAgo;\n\nconst normalizedData = {\n  ...latestVideo,\n  is_new_video: isNewVideo,\n  channel_name: 'Your Channel', // Will be extracted from RSS in real implementation\n  formatted_date: new Date(latestVideo.published).toLocaleDateString()\n};\n\nconsole.log('Latest video data:', {\n  title: normalizedData.title,\n  published: normalizedData.formatted_date,\n  is_new: normalizedData.is_new_video\n});\n\n// Only proceed if it's a new video\nif (!isNewVideo) {\n  console.log('No new videos to announce');\n  return null;\n}\n\nreturn {\n  json: normalizedData\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "format-slack-message",
      "name": "Slackメッセージを整形",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        300
      ],
      "parameters": {
        "jsCode": "// Format video announcement for Slack\nconst video = $input.first().json;\n\n// Create rich Slack message\nconst slackMessage = {\n  text: `🎬 New Video Alert!`,\n  channel: '#general', // Change to your preferred channel\n  username: 'YouTube Bot',\n  icon_emoji: ':tv:',\n  blocks: [\n    {\n      \"type\": \"section\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": `🎬 *New Video Published!*\\n\\n*${video.title}*\\n\\n📅 Published: ${video.formatted_date}\\n\\n${video.description}`\n      }\n    },\n    {\n      \"type\": \"actions\",\n      \"elements\": [\n        {\n          \"type\": \"button\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"🎥 Watch Now\",\n            \"emoji\": true\n          },\n          \"url\": video.link,\n          \"style\": \"primary\"\n        }\n      ]\n    },\n    {\n      \"type\": \"context\",\n      \"elements\": [\n        {\n          \"type\": \"mrkdwn\",\n          \"text\": `📺 ${video.channel_name} | 🔗 <${video.link}|${video.video_id}>`\n        }\n      ]\n    }\n  ]\n};\n\nconsole.log('Formatted Slack message for video:', video.title);\n\nreturn {\n  json: slackMessage\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "post-to-slack",
      "name": "Slackに投稿",
      "type": "n8n-nodes-base.slack",
      "position": [
        1000,
        300
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "channel": "={{ $json.channel }}",
        "resource": "message",
        "operation": "post",
        "otherOptions": {
          "blocks": "={{ JSON.stringify($json.blocks) }}",
          "username": "={{ $json.username }}",
          "icon_emoji": "={{ $json.icon_emoji }}"
        },
        "authentication": "oAuth2"
      },
      "typeVersion": 2.1
    }
  ],
  "active": true,
  "settings": {
    "timezone": "UTC"
  },
  "versionId": "1",
  "connections": {
    "fetch-youtube-rss": {
      "main": [
        [
          {
            "node": "parse-rss-data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "format-slack-message": {
      "main": [
        [
          {
            "node": "post-to-slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "youtube-check-trigger": {
      "main": [
        [
          {
            "node": "fetch-youtube-rss",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse-rss-data": {
      "main": [
        [
          {
            "node": "format-slack-message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級 - ソーシャルメディア, マルチモーダルAI

有料ですか?

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

関連ワークフロー

毎朝のカンツー啓発文言をSlackチャンネルへ配信
ZenQuotesからの毎日の励志名言をSlackチャンネルに送信
Code
Cron
Slack
+
Code
Cron
Slack
5 ノードDavid Olusola
個人の生産性
ビットコインとイーサリアムの下落アラート(Telegram、Slack、SMS)
Telegram、Slack、SMS 経由でビットコインとイーサリアムの下落アラートを送信
If
Code
Slack
+
If
Code
Slack
8 ノードDavid Olusola
仮想通貨取引
Gemini AI と Blotato を使って WordPress 記事を自動のにソーシャルメディアに投稿する
Gemini AI と Blotato を使って WordPress 記事を自動のにソーシャルメディアに投稿する
If
Code
Split Out
+
If
Code
Split Out
11 ノードDavid Olusola
ソーシャルメディア
Geminiを使ってWordPressからAI駆動型の週次メールニュースを生成
Geminiを使ってWordPressからAI駆動の週次メールニュースレターへ生成する
If
Code
Email Send
+
If
Code
Email Send
8 ノードDavid Olusola
ソーシャルメディア
NewsAPIとGoogle Geminiを使用してテクノロジーニュースブログ記事を自動生成し、WordPressに公開
NewsAPIとGoogle Geminiを使用して自動のにテクノロジーニュースブログ記事を生成し、WordPressに投稿
Code
Wordpress
Http Request
+
Code
Wordpress
Http Request
9 ノードDavid Olusola
コンテンツ作成
Zoom の録画を Google ドライブに保存し、Airtable にメーティング記録を加える
Zoom 録画を Google ドライブに自動保存し、Airtable でメッセージを記録
Code
Webhook
Airtable
+
Code
Webhook
Airtable
7 ノードDavid Olusola
ファイル管理
ワークフロー情報
難易度
中級
ノード数6
カテゴリー2
ノードタイプ5
難易度説明

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

作成者
David Olusola

David Olusola

@dae221

I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34