Spotify 感情をニュースカードジェネレーター(APITemplate.io + Slack)

上級

これはContent Creation, AI Summarization分野の自動化ワークフローで、21個のノードを含みます。主にSet, Code, Slack, Spotify, RssFeedReadなどのノードを使用。 LLM、Googleニュース、APITemplate.ioを使用してSpotifyの感情からニュースカードを生成

前提条件
  • Slack Bot Token または Webhook URL
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下の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": "感情分析器",
      "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": "スケジュール起動 (Cron)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -144,
        -16
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3c9cf5ff-747e-436c-b47d-8d55b2fdde40",
      "name": "Spotify最近再生した曲を取得",
      "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: 楽曲から感情を推論",
      "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": "各楽曲を処理 (バッチ)",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        656,
        -16
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "282fbf38-97c2-4510-bed4-08072dea9f71",
      "name": "GoogleニュースRSSクエリを構築",
      "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": "Googleニュース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": "トップニュースを選択・整形",
      "type": "n8n-nodes-base.code",
      "position": [
        1328,
        -16
      ],
      "parameters": {
        "jsCode": "return items.slice(0, 1);"
      },
      "typeVersion": 2
    },
    {
      "id": "20707f6c-fbec-45a8-94e0-a42574e9c90e",
      "name": "ニュースカード生成 (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": "Slackへ投稿 (タイトル + リンク + カード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": "付箋",
      "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": "付箋1",
      "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": "付箋2",
      "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": "付箋3",
      "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": "付箋4",
      "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": "付箋5",
      "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": "付箋6",
      "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": "付箋7",
      "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": "付箋8",
      "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": "付箋9",
      "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": "付箋10",
      "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など)は別途料金が発生する場合があります。

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

上級者向け、16ノード以上の複雑なワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34