{
  "name": "Create playlists and control your Spotify player with GPT-4",
  "nodes": [
    {
      "id": "339943be-a10f-4749-8329-5e5b0322b7da",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        800,
        1820
      ]
    },
    {
      "id": "b3e4c3c9-7c39-457f-821a-588108b5a80d",
      "name": "Get track IDs",
      "type": "n8n-nodes-base.set",
      "position": [
        2020,
        1600
      ]
    },
    {
      "id": "79061ff4-a47d-430e-b964-80a3bf3945b5",
      "name": "Create playlist",
      "type": "n8n-nodes-base.spotify",
      "position": [
        1140,
        1600
      ]
    },
    {
      "id": "983f116f-9542-469e-8e09-7da7fe510c5b",
      "name": "Ideate playlist",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        780,
        1600
      ]
    },
    {
      "id": "b82072f8-6326-4a13-871d-6bfe31e88ed3",
      "name": "Split out tracks",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1580,
        1600
      ]
    },
    {
      "id": "0a6bc27b-77a0-4140-9169-c169f7d63f73",
      "name": "Get tracks array",
      "type": "n8n-nodes-base.set",
      "position": [
        1360,
        1600
      ]
    },
    {
      "id": "a46ab606-6c84-4d48-bec6-cccac01c36d3",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        760,
        1100
      ]
    },
    {
      "id": "26b67f87-659e-4e4c-a205-4b3d93288825",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        580,
        780
      ]
    },
    {
      "id": "27e65e5e-a9cf-4a02-89a5-c392ca4307e3",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1040,
        1040
      ]
    },
    {
      "id": "21e3ed29-0a45-4d70-9aa5-b61f696491aa",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        560,
        1600
      ]
    },
    {
      "id": "d506e762-782e-4bc2-bbf6-c3d1b44c5bf1",
      "name": "Add track to playlist",
      "type": "n8n-nodes-base.spotify",
      "position": [
        2240,
        1600
      ]
    },
    {
      "id": "b1c48119-9e70-4424-8bad-34a347275ca8",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        920,
        1820
      ]
    },
    {
      "id": "b7e89f85-4ad3-4675-bcec-06573f708842",
      "name": "Spotify Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1040,
        780
      ]
    },
    {
      "id": "ac1dcb16-a396-4d7f-b8f4-a3a4b5825fec",
      "name": "Get the final playlist",
      "type": "n8n-nodes-base.spotify",
      "position": [
        2460,
        1600
      ]
    },
    {
      "id": "58581a2e-d7c1-45a7-bca7-c81ef11e6361",
      "name": "Clean data to share with agent",
      "type": "n8n-nodes-base.code",
      "position": [
        2680,
        1600
      ]
    },
    {
      "id": "8769da3a-d7dc-4c4c-b80d-1f0360ab8b08",
      "name": "Play a playlist",
      "type": "n8n-nodes-base.spotifyTool",
      "position": [
        1240,
        1040
      ]
    },
    {
      "id": "7054d5c8-97a0-45e9-8473-c9da361f3d07",
      "name": "Pause player",
      "type": "n8n-nodes-base.spotifyTool",
      "position": [
        1360,
        1040
      ]
    },
    {
      "id": "a28c277d-4c52-40ba-baac-e0539951fa88",
      "name": "Resume player",
      "type": "n8n-nodes-base.spotifyTool",
      "position": [
        1480,
        1040
      ]
    },
    {
      "id": "61d01ce7-fbf6-4471-8f1e-05690592c644",
      "name": "Next song",
      "type": "n8n-nodes-base.spotifyTool",
      "position": [
        1600,
        1040
      ]
    },
    {
      "id": "6d5b125c-9be0-4020-8fe5-17a4653bc5ca",
      "name": "Get user playlists",
      "type": "n8n-nodes-base.spotifyTool",
      "position": [
        1720,
        1040
      ]
    },
    {
      "id": "95b32527-6992-4e04-b029-72b12eb424df",
      "name": "Create new playlist",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1840,
        1040
      ]
    },
    {
      "id": "c212fc80-f3c7-4af7-a684-7263786b5cf6",
      "name": "Search the track",
      "type": "n8n-nodes-base.spotify",
      "position": [
        1800,
        1600
      ]
    },
    {
      "id": "31f5d94d-537c-4884-8b47-e92855dc4c74",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        640
      ],
      "parameters": {
        "width": 500,
        "height": 820,
        "content": "## Try It Out!\n\nThis n8n template provides a powerful AI-powered chatbot that acts as your personal Spotify DJ. Simply tell the chatbot what kind of music you're in the mood for, and it will intellige"
      }
    },
    {
      "id": "28f5c61a-e68a-480a-8397-07859e22bfec",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        640
      ],
      "parameters": {
        "width": 260,
        "height": 300,
        "content": "## Chat trigger and interface"
      }
    },
    {
      "id": "4d5cf43a-adbf-48b7-9d03-6829ebc3df06",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        1000
      ],
      "parameters": {
        "width": 760,
        "height": 280,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Agent tools"
      }
    },
    {
      "id": "808d74d1-2cb5-40a1-a676-48ed0b96eb2f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        640
      ],
      "parameters": {
        "width": 760,
        "height": 280,
        "content": "## AI agent tools\n\nThis agent is the engine of the workflow. Its system instructions define how to call the different tool to interact with Spotify"
      }
    },
    {
      "id": "c732f125-979f-4b7a-a6cd-c0da989e3f35",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        1420
      ],
      "parameters": {
        "width": 300,
        "height": 500,
        "content": "## AI step to plan the playlist\n\nThis AI node decides for the tracks to include into the playlist and choses the playlist name."
      }
    },
    {
      "id": "eaa0799a-c0e4-47d6-95ab-5f6f22d4cd58",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        1340
      ],
      "parameters": {
        "width": 2400,
        "height": 660,
        "content": "## Playlist creation sub-workflow"
      }
    },
    {
      "id": "ff704841-7686-485b-b53f-afb220c809a5",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1540,
        1460
      ],
      "parameters": {
        "width": 840,
        "height": 320,
        "content": "## For each track\nEach track gets searched in Spotify to get their specific IDs to then add them one by one to the playlist."
      }
    }
  ],
  "connections": {
    "Next song": {
      "ai_tool": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Pause player": {
      "ai_tool": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get track IDs": {
      "main": [
        [
          {
            "node": "Add track to playlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Resume player": {
      "ai_tool": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Create playlist": {
      "main": [
        [
          {
            "node": "Get tracks array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ideate playlist": {
      "main": [
        [
          {
            "node": "Create playlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Play a playlist": {
      "ai_tool": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get tracks array": {
      "main": [
        [
          {
            "node": "Split out tracks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search the track": {
      "main": [
        [
          {
            "node": "Get track IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split out tracks": {
      "main": [
        [
          {
            "node": "Search the track",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get user playlists": {
      "ai_tool": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Ideate playlist",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create new playlist": {
      "ai_tool": [
        [
          {
            "node": "Spotify Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Add track to playlist": {
      "main": [
        [
          {
            "node": "Get the final playlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the final playlist": {
      "main": [
        [
          {
            "node": "Clean data to share with agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Ideate playlist",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Spotify Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Ideate playlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}