Task: Add liked songs to a Spotify monthly playlist

n8n workflow JSON:
{"id":1,"name":"Spotify","nodes":[{"name":"IF","type":"n8n-nodes-base.if","position":[1680,630],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"playlistId\"]}}","value2":"=null","operation":"notEqual"}]}},"typeVersion":1},{"name":"Get current date","type":"n8n-nodes-base.function","position":[1080,830],"parameters":{"functionCode":"const monthNames = [\n  'January',\n  'February',\n  'March',\n  'April',\n  'May',\n  'June',\n  'July',\n  'August',\n  'September',\n  'October',\n  'November',\n  'December',\n]\n\nconst date = new Date()\nconst year = date.getFullYear()\nconst month = date.getMonth()\n\nlet currentDate = {\n  month: month,\n  year: year,\n  text: `${monthNames[month]} '${year.toString().slice(-2)}`\n}\n\nitems[0].json.currentDate = currentDate\n\nreturn items\n"},"typeVersion":1},{"name":"Get liked tracks","type":"n8n-nodes-base.spotify","position":[1080,1030],"parameters":{"resource":"library"},"credentials":{"spotifyOAuth2Api":{"id":"2","name":"Spotify account"}},"typeVersion":1},{"name":"Get playlists","type":"n8n-nodes-base.spotify","position":[1080,620],"parameters":{"resource":"playlist","operation":"getUserPlaylists","returnAll":true},"credentials":{"spotifyOAuth2Api":{"id":"2","name":"Spotify account"}},"typeVersion":1},{"name":"Merge liked tracks","type":"n8n-nodes-base.merge","position":[1280,930],"parameters":{"mode":"multiplex"},"typeVersion":1},{"name":"Merge playlists","type":"n8n-nodes-base.merge","position":[1280,630],"parameters":{"mode":"multiplex"},"typeVersion":1},{"name":"Create playlist","type":"n8n-nodes-base.spotify","position":[1880,730],"parameters":{"name":"={{$node[\"Get current date\"].json[\"currentDate\"][\"text\"]}}","resource":"playlist","operation":"create","additionalFields":{}},"credentials":{"spotifyOAuth2Api":{"id":"2","name":"Spotify account"}},"typeVersion":1},{"name":"Get created playlist ID","type":"n8n-nodes-base.function","position":[2030,730],"parameters":{"functionCode":"output= [{ json: {playlistId: items[0].json.id} }]\nreturn output\n\n\n/*return items.map(item => {\n  let playlistName = item.json.name\n  if (item.json.currentDate.text === playlistName) {\n    return {json: {id: item.json.id}}\n  }\n})*/\n"},"typeVersion":1},{"name":"Get playlist ID","type":"n8n-nodes-base.function","position":[1480,630],"parameters":{"functionCode":"let playlistId\nlet playlist = items.find(item => item.json.name === item.json.currentDate.text)\n\nif (playlist === undefined) playlistId = \"null\"\nelse playlistId = playlist.json.id\n\noutput= [{ json: {playlistId: playlistId} }]\nreturn output\n\n\n/*return items.map(item => {\n  let playlistName = item.json.name\n  if (item.json.currentDate.text === playlistName) {\n    return {json: {id: item.json.id}}\n  }\n})*/\n"},"typeVersion":1},{"name":"Get last liked tracks","type":"n8n-nodes-base.function","position":[1480,920],"parameters":{"functionCode":"return items.filter(item => {\n  let date = new Date(item.json.added_at)\n  let currentMonth= date.getMonth()\n  if (item.json.currentDate.month === currentMonth) {\n    return {json: item.json}\n  }\n})"},"typeVersion":1,"alwaysOutputData":false},{"name":"Merge","type":"n8n-nodes-base.merge","position":[2180,930],"parameters":{"mode":"multiplex"},"typeVersion":1},{"name":"Merge1","type":"n8n-nodes-base.merge","position":[2080,580],"parameters":{},"typeVersion":1},{"name":"Get tracks in playlist","type":"n8n-nodes-base.spotify","position":[1880,480],"parameters":{"id":"={{$json[\"playlistId\"]}}","resource":"playlist","operation":"getTracks","returnAll":true},"credentials":{"spotifyOAuth2Api":{"id":"2","name":"Spotify account"}},"typeVersion":1,"alwaysOutputData":true},{"name":"IF1","type":"n8n-nodes-base.if","position":[2380,580],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"result\"]}}","value2":"null"}]}},"typeVersion":1},{"name":"NoOp","type":"n8n-nodes-base.noOp","position":[2580,580],"parameters":{},"typeVersion":1},{"name":"Merge2","type":"n8n-nodes-base.merge","position":[2530,730],"parameters":{"mode":"multiplex"},"typeVersion":1},{"name":"Interval","type":"n8n-nodes-base.interval","position":[880,830],"parameters":{"unit":"minutes","interval":5},"typeVersion":1,"alwaysOutputData":false},{"name":"Add to created playlist","type":"n8n-nodes-base.spotify","position":[2330,930],"parameters":{"id":"={{$json[\"playlistId\"]}}","trackID":"={{$json[\"track\"][\"uri\"]}}","resource":"playlist","additionalFields":{}},"credentials":{"spotifyOAuth2Api":{"id":"2","name":"Spotify account"}},"typeVersion":1},{"name":"Get new track URI","type":"n8n-nodes-base.function","position":[2220,580],"parameters":{"functionCode":"let result\nlet output= []\nlet tracks = items;\n\nlet tracksUri = tracks.filter(track => track.json.track != undefined).map(track => track.json.track.uri)\n\nlet newTracks = tracksUri.filter(uri=> {\n  return tracksUri.indexOf(uri) === tracksUri.lastIndexOf(uri)\n});\n\nif (newTracks.length === 0) output.push({json: {result: \"null\"}})\nelse {\n  newTracks.forEach(uri=> {\n    output.push({json: {uri: uri}})\n  })\n}\n//else result = newTracks.map(track => ({uri: track}))\n\nreturn output\n\n\n\n"},"typeVersion":1},{"name":"Add to playlist","type":"n8n-nodes-base.spotify","position":[2680,730],"parameters":{"id":"={{$json[\"playlistId\"]}}","trackID":"={{$json[\"uri\"]}}","resource":"playlist","additionalFields":{}},"credentials":{"spotifyOAuth2Api":{"id":"2","name":"Spotify account"}},"typeVersion":1}],"active":true,"settings":{},"connections":{"IF":{"main":[[{"node":"Get tracks in playlist","type":"main","index":0}],[{"node":"Create playlist","type":"main","index":0}]]},"IF1":{"main":[[{"node":"NoOp","type":"main","index":0}],[{"node":"Merge2","type":"main","index":0}]]},"Merge":{"main":[[{"node":"Add to created playlist","type":"main","index":0}]]},"Merge1":{"main":[[{"node":"Get new track URI","type":"main","index":0}]]},"Merge2":{"main":[[{"node":"Add to playlist","type":"main","index":0}]]},"Interval":{"main":[[{"node":"Get playlists","type":"main","index":0},{"node":"Get current date","type":"main","index":0},{"node":"Get liked tracks","type":"main","index":0}]]},"Get playlists":{"main":[[{"node":"Merge playlists","type":"main","index":0}]]},"Create playlist":{"main":[[{"node":"Get created playlist ID","type":"main","index":0}]]},"Get playlist ID":{"main":[[{"node":"IF","type":"main","index":0},{"node":"Merge2","type":"main","index":1}]]},"Merge playlists":{"main":[[{"node":"Get playlist ID","type":"main","index":0}]]},"Get current date":{"main":[[{"node":"Merge liked tracks","type":"main","index":0},{"node":"Merge playlists","type":"main","index":1}]]},"Get liked tracks":{"main":[[{"node":"Merge liked tracks","type":"main","index":1}]]},"Get new track URI":{"main":[[{"node":"IF1","type":"main","index":0}]]},"Merge liked tracks":{"main":[[{"node":"Get last liked tracks","type":"main","index":0}]]},"Get last liked tracks":{"main":[[{"node":"Merge","type":"main","index":1},{"node":"Merge1","type":"main","index":1}]]},"Get tracks in playlist":{"main":[[{"node":"Merge1","type":"main","index":0}]]},"Get created playlist ID":{"main":[[{"node":"Merge","type":"main","index":0}]]}}}