Nouvelles vidéos YouTube → publication automatique des liens sur Slack
Ceci est unSocial Media, Multimodal AIworkflow d'automatisation du domainecontenant 6 nœuds.Utilise principalement des nœuds comme Code, Cron, Slack, HttpRequest. Notifications automatisées de vidéos YouTube envoyées vers Slack
- •Token Bot Slack ou URL Webhook
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
Nœuds utilisés (6)
Catégorie
{
"name": "YouTube New Video → Auto-Post Link to Slack",
"nodes": [
{
"id": "setup-instructions",
"name": "Instructions de configuration",
"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": "Vérifier toutes les 30 minutes",
"type": "n8n-nodes-base.cron",
"position": [
200,
300
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "*/30 * * * *"
}
]
}
},
"typeVersion": 1
},
{
"id": "fetch-youtube-rss",
"name": "Récupérer le flux RSS YouTube",
"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": "Analyser le RSS et vérifier les nouvelles vidéos",
"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": "Formater le message 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": "Publier sur 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
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Intermédiaire - Réseaux sociaux, IA Multimodale
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
David Olusola
@dae221I 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
Partager ce workflow