Spotify情感转新闻卡片生成器(APITemplate.io + Slack)
高级
这是一个Content Creation, AI Summarization领域的自动化工作流,包含 21 个节点。主要使用 Set, Code, Slack, Spotify, RssFeedRead 等节点。 使用LLM、谷歌新闻和APITemplate.io从Spotify情感生成新闻卡片
前置要求
- •Slack Bot Token 或 Webhook URL
使用的节点 (21)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "OMGFOlTIKsAAAwUG",
"meta": {
"instanceId": "15d6057a37b8367f33882dd60593ee5f6cc0c59310ff1dc66b626d726083b48d",
"templateCredsSetupCompleted": true
},
"name": "Spotify Emotion-to-News Card Generator (APITemplate.io + Slack)",
"tags": [],
"nodes": [
{
"id": "773130e9-c130-4276-b4f5-6fa0cd79ba91",
"name": "Emotion Analyzer",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
304,
-16
],
"parameters": {
"text": "=You are an emotion analyst.\nGiven the following song title and artist, infer the main emotion it conveys \n(e.g., joyful, nostalgic, melancholic, energetic, angry, romantic).\nReturn JSON.\n\nInput:\n\"{{ $json.track.name }} - {{ $json.track.album.artists[0].name }}\"\n\nOutput:\n{\n \"emotion\": \"nostalgic\",\n \"reason\": \"The song's tone and lyrics evoke reflection and memory.\"\n}\n",
"options": {},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "734a0e4f-1a01-4bfd-8877-4629ef89d1a4",
"name": "Start on Schedule (Cron)",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-144,
-16
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1
},
{
"id": "3c9cf5ff-747e-436c-b47d-8d55b2fdde40",
"name": "Fetch Spotify Recently Played",
"type": "n8n-nodes-base.spotify",
"position": [
80,
-16
],
"parameters": {
"operation": "recentlyPlayed"
},
"credentials": {
"spotifyOAuth2Api": {
"id": "NBaU7bOuJl4YNkeB",
"name": "Spotify account 3"
}
},
"typeVersion": 1
},
{
"id": "e051c66b-fdfb-4ef7-860a-9a14c9c29f9e",
"name": "LLM: Infer Emotion from Track",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
384,
208
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "fMR5QJezr3tD108w",
"name": "簡易デモ"
}
},
"typeVersion": 1
},
{
"id": "ee6e19e5-8843-4669-87e6-432d0c944db7",
"name": "For Each Track (Batch)",
"type": "n8n-nodes-base.splitInBatches",
"position": [
656,
-16
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "282fbf38-97c2-4510-bed4-08072dea9f71",
"name": "Build Google News RSS Query",
"type": "n8n-nodes-base.set",
"position": [
880,
-16
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={{\n (() => {\n const raw =\n $json.emotion ||\n (JSON.parse($json.output || '{}').emotion) ||\n 'music';\n const clean = String(raw).replace(/\\s+/g,' ').replace(/\\u3000/g,' ').trim();\n const base = 'https://news.google.com/rss/search?hl=en-US&gl=US&ceid=US%3Aen&q=';\n return { feedUrl: base + encodeURIComponent(clean) }; // ← オブジェクトで返す\n })()\n}}\n"
},
"typeVersion": 3.4
},
{
"id": "1636d83b-5ff3-4360-b70c-c469691e7d15",
"name": "Fetch Google News RSS",
"type": "n8n-nodes-base.rssFeedRead",
"position": [
1104,
-16
],
"parameters": {
"url": "={{\n (() => {\n const emotionRaw =\n $json.emotion ||\n (JSON.parse($json.output || '{}').emotion) ||\n 'music';\n\n const q = encodeURIComponent(String(emotionRaw).trim());\n const url = `https://news.google.com/rss/search?hl=en-US&gl=US&ceid=US%3Aen&q=${q}`;\n return url.trim();\n })()\n}}\n",
"options": {}
},
"typeVersion": 1.2
},
{
"id": "89aab605-b6bb-4206-8866-c6bb97f269e5",
"name": "Pick Top News & Format",
"type": "n8n-nodes-base.code",
"position": [
1328,
-16
],
"parameters": {
"jsCode": "return items.slice(0, 1);"
},
"typeVersion": 2
},
{
"id": "20707f6c-fbec-45a8-94e0-a42574e9c90e",
"name": "Generate News Card (APITemplate)",
"type": "n8n-nodes-base.apiTemplateIo",
"position": [
1552,
-16
],
"parameters": {
"overridesJson": "={{ JSON.stringify([\n { \"name\": \"text_emotion\", \"text\": $json.emotion ?? \"neutral\" },\n { \"name\": \"text_url\", \"text\": $json.link ?? \"https://example.com\" },\n { \"name\": \"text_1\", \"text\": $json.contentSnippet ?? \"Unknown source\" },\n { \"name\": \"text_2\", \"text\": $json.title ?? \"No title\" }\n]) }}\n",
"jsonParameters": true,
"imageTemplateId": "="
},
"credentials": {
"apiTemplateIoApi": {
"id": "whAPW33pjYrGW6Cb",
"name": "APITemplate.io account 2"
}
},
"typeVersion": 1
},
{
"id": "abed781e-894c-4239-8f89-34532fe17022",
"name": "Post to Slack (Title + Link + Card URL)",
"type": "n8n-nodes-base.slack",
"position": [
1776,
-16
],
"webhookId": "b33a2d51-5fd8-460f-8ea8-0fabfdcf359b",
"parameters": {
"text": "={{\n $(\"Pick Top News & Format\").item.json.title + \"\\n\" +\n $(\"Pick Top News & Format\").item.json.link + \"\\n\" +\n \"📰 ニュースカード\\n\" +\n ( $(\"Generate News Card (APITemplate)\").item.json.download_url_png || $(\"Generate News Card (APITemplate)\").item.json.download_url )\n}}\n",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "CKUCBTG0H",
"cachedResultName": "general"
},
"otherOptions": {
"unfurl_links": false,
"unfurl_media": false
},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "2kyw7TSL5VT4S3md",
"name": "Slack account 8"
}
},
"typeVersion": 2.3
},
{
"id": "259a3bb9-d297-442c-b998-ea7aed02d1d1",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
-352
],
"parameters": {
"width": 416,
"height": 1344,
"content": "## 📄 Workflow Overview\n\nTitle: Spotify Emotion-to-News Card Generator (APITemplate.io + Slack)\n\n## What it does:\nThis workflow analyzes the emotion of your recently played Spotify track using OpenRouter (LLM), fetches a related trending Google News article, generates a visual news card with APITemplate.io, and posts it to Slack.\n\n## 👥 Who’s it for\n\nMusic lovers, marketers, and developers who want to automatically turn their listening mood into a visual daily digest or Slack update.\n\n## ⚙️ How it works\n\nSpotify Trigger — Fetch your recently played tracks.\n\nLLM (Emotion Analyzer) — Infer the main emotion from the track title and artist.\n\nGoogle News Query — Build an RSS URL based on the emotion keyword.\n\nRSS Reader — Retrieve trending news headlines.\n\nAPITemplate.io — Render the top article into an image card.\n\nSlack — Post title, link, and card image into your channel.\n\n## 🧰 Requirements\n\nSpotify API credentials\n\nOpenRouter API key\n\nAPITemplate.io account (with template ID)\n\nSlack OAuth2 connection\n\n## 🪄 How to customize\n\nReplace the APITemplate.io template ID with your own.\n\nAdjust the RSS URL language (hl=en-US → hl=ja-JP for Japanese news).\n\nModify the Slack message text for your preferred channel tone.\n\n## ⚠️ Disclaimer\n\nIf you use community nodes (LangChain), this template is for self-hosted n8n only."
},
"typeVersion": 1
},
{
"id": "930501ea-23fc-4014-b2e1-8547d609680e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
-240
],
"parameters": {
"color": 7,
"content": "## Start on Schedule (Cron)\n“Triggers this workflow on a fixed schedule. You can adjust interval in node settings.”"
},
"typeVersion": 1
},
{
"id": "4b84f0fc-1f3f-4ebf-934e-3092759aae9f",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
192
],
"parameters": {
"color": 7,
"height": 176,
"content": "## Fetch Spotify Recently Played\n“Retrieves your last played Spotify tracks. Requires Spotify OAuth2 credentials.”"
},
"typeVersion": 1
},
{
"id": "8fe180e8-594c-470b-9b1d-fa754582ae19",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
304,
-208
],
"parameters": {
"color": 7,
"height": 128,
"content": "## Emotion Analyzer\n“Uses LLM (OpenRouter) to infer the dominant emotion from song title and artist.”"
},
"typeVersion": 1
},
{
"id": "7017bd67-3219-492c-9334-16883310c843",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
560,
160
],
"parameters": {
"color": 7,
"height": 176,
"content": "## For Each Track (Batch)\n“Processes each track individually for emotion-to-news mapping.”"
},
"typeVersion": 1
},
{
"id": "c0ad00c2-c320-41c2-ad1e-982c192fc81c",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
816,
-256
],
"parameters": {
"color": 7,
"height": 176,
"content": "## Build Google News RSS Query\n“Converts emotion into a Google News RSS query string. Modify hl and gl for language/country.”"
},
"typeVersion": 1
},
{
"id": "ab9563f1-d47a-49fc-ba02-149b251e8a0e",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1056,
160
],
"parameters": {
"color": 7,
"content": "## Fetch Google News RSS\n“Reads top articles matching the emotion keyword.”"
},
"typeVersion": 1
},
{
"id": "1d92ea4b-bba2-4be9-8401-1174cbefef9a",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1280,
-240
],
"parameters": {
"color": 7,
"content": "## Pick Top News & Format\n“Selects the first article from RSS feed and prepares title/link/snippet.”"
},
"typeVersion": 1
},
{
"id": "afe292e6-24aa-42c8-9de5-e1d78b7acf30",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
1504,
176
],
"parameters": {
"color": 7,
"height": 208,
"content": "## Generate News Card (APITemplate)\n“Creates a news card image using APITemplate.io. Replace template ID with yours.”"
},
"typeVersion": 1
},
{
"id": "9914e9fa-6135-40ce-abf3-053a3c798c03",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
1712,
-208
],
"parameters": {
"color": 7,
"content": "## Post to Slack (Title + Link + Card URL)\n“Posts the generated card, title, and link to Slack. Unfurling disabled for clean appearance.”"
},
"typeVersion": 1
},
{
"id": "842092ca-795b-4330-b1c8-b83b6c8652e8",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-304
],
"parameters": {
"color": 7,
"width": 288,
"height": 752,
"content": "## Setup (Step-by-Step)\n\nGoal: Analyze your recent Spotify listening history, infer the emotional tone, and generate a matching news image card that’s automatically posted to Slack.\nPrerequisites: n8n (Cloud or Self-hosted), and active accounts for Spotify, Slack, APITemplate.io, and OpenRouter.\n\n1) Create Credentials (Required)\n\nSpotify OAuth2 — Go to Settings → Credentials → New → Spotify OAuth2, create a credential, and assign it to the “Fetch Spotify Recently Played” node.\n\nSlack OAuth2 — Create it under Settings → Credentials, and assign it to “Post to Slack.”\n\nAPITemplate.io — Create it under Settings → Credentials, and assign it to “Generate News Card (APITemplate).”\n\nOpenRouter API (LLM) — Create it under Settings → Credentials, and assign it to “Infer Emotion from Track (LLM).”\nIf you’re concerned about Cloud compatibility, refer to the “Self-host / Cloud” alternative described below."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "b0b1e713-4148-491c-ba26-71d4520280bf",
"connections": {
"773130e9-c130-4276-b4f5-6fa0cd79ba91": {
"main": [
[
{
"node": "ee6e19e5-8843-4669-87e6-432d0c944db7",
"type": "main",
"index": 0
}
]
]
},
"1636d83b-5ff3-4360-b70c-c469691e7d15": {
"main": [
[
{
"node": "89aab605-b6bb-4206-8866-c6bb97f269e5",
"type": "main",
"index": 0
}
]
]
},
"ee6e19e5-8843-4669-87e6-432d0c944db7": {
"main": [
[],
[
{
"node": "282fbf38-97c2-4510-bed4-08072dea9f71",
"type": "main",
"index": 0
}
]
]
},
"89aab605-b6bb-4206-8866-c6bb97f269e5": {
"main": [
[
{
"node": "20707f6c-fbec-45a8-94e0-a42574e9c90e",
"type": "main",
"index": 0
}
]
]
},
"734a0e4f-1a01-4bfd-8877-4629ef89d1a4": {
"main": [
[
{
"node": "3c9cf5ff-747e-436c-b47d-8d55b2fdde40",
"type": "main",
"index": 0
}
]
]
},
"282fbf38-97c2-4510-bed4-08072dea9f71": {
"main": [
[
{
"node": "1636d83b-5ff3-4360-b70c-c469691e7d15",
"type": "main",
"index": 0
}
]
]
},
"3c9cf5ff-747e-436c-b47d-8d55b2fdde40": {
"main": [
[
{
"node": "773130e9-c130-4276-b4f5-6fa0cd79ba91",
"type": "main",
"index": 0
}
]
]
},
"e051c66b-fdfb-4ef7-860a-9a14c9c29f9e": {
"ai_languageModel": [
[
{
"node": "773130e9-c130-4276-b4f5-6fa0cd79ba91",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"20707f6c-fbec-45a8-94e0-a42574e9c90e": {
"main": [
[
{
"node": "abed781e-894c-4239-8f89-34532fe17022",
"type": "main",
"index": 0
}
]
]
},
"abed781e-894c-4239-8f89-34532fe17022": {
"main": [
[]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, AI 摘要总结
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用Perplexity和GPT为WordPress创建SEO优化博客,包含关键词和媒体
使用Perplexity和GPT为WordPress创建SEO优化博客,包含关键词和媒体
Set
Code
Limit
+
Set
Code
Limit
124 节点Paul
内容创作
使用特定工具为WordPress创建SEO优化博客
使用特定工具为WordPress创建SEO优化博客
Set
Code
Limit
+
Set
Code
Limit
124 节点Paul
内容创作
AI驱动博客自动化
AI驱动博客自动化:使用GPT-4生成并发布SEO文章至WordPress和Twitter
If
Set
Code
+
If
Set
Code
144 节点Jay Emp0
内容创作
基于AI的会议研究与每日议程(Google日历、Attio CRM和Slack)
基于AI的会议研究与每日议程:使用Google日历、Attio CRM和Slack
If
Set
Code
+
If
Set
Code
30 节点Harry Siggins
AI 摘要总结
使用Slack和Asana的虚拟Scrum Master
基于AI的Scrum Master助手,集成OpenAI、Slack和Asana
Set
Code
Html
+
Set
Code
Html
35 节点Łukasz
项目管理
RSS源智能中心与每日Slack摘要
使用Gemini AI为RSS源自动化新闻智能,推送至Notion和Slack
Set
Code
Sort
+
Set
Code
Sort
29 节点Takuya Ojima
市场调研