# Problems with Spotify Workflow

**URL:** <https://community.n8n.io/t/problems-with-spotify-workflow/3141>\
**Category:** Questions\
**Created:** [November 23, 2020, 11:02pm UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141 "2020-11-23T23:02:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_Cameron](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/colin_cameron/32/2282_2.png) [@Colin\_Cameron](https://community.n8n.io/u/Colin_Cameron)\
**Post date:** [November 23, 2020, 11:02pm UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/1 "2020-11-23T23:02:41Z")

</div>

I have the attached workflow that I am having issues with. Everything works as expected until it gets to the final Spotify step which is to add the songs that match the IF statements to the specified playlist “Dance”. There should be 12 matching songs from this weeks Discover Weekly playlist but it only adds the first one for some reason. I thought it was only adding one in testing but I let the workflow trigger at its normal time this morning and the same thing occurred. Any insight would be greatly appreciated.

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/c/c547ab98961a38db2ea37d9eeabaeedd813ed614.png)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [November 23, 2020, 11:20pm UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/2 "2020-11-23T23:20:33Z")

</div>

Do not understand where the problem is. If you say “There should be 12 matching songs from this weeks Discover Weekly playlist” are there then actually 12 songs, so 12 items in n8n?

Or let’s ask differently:  
Is the problem that it does not return 12 songs or is the problem that there are 12 songs in n8n but only 1 gets added?

---

<div class="post-metadata">

**Author:** ![Colin\_Cameron](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/colin_cameron/32/2282_2.png) [@Colin\_Cameron](https://community.n8n.io/u/Colin_Cameron)\
**Post date:** [November 24, 2020, 12:55am UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/3 "2020-11-24T00:55:51Z")

</div>

The IF statement correctly finds 12 songs but only one gets added to the playlist.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [November 24, 2020, 7:06am UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/4 "2020-11-24T07:06:21Z")

</div>

How many items does the Track-Node contain? Because if it only contains one that would cause an issue like this.

In this case the node would execute 12 times, once for every item. For each of them it would look for the correct item on both in the expression referenced nodes. For Playlist it would find data for all 12. For Track it would then only find data for the first one.

For it to work you have to tell n8n to always use the data of the first item (the item with index `0`) which you can do by changing the expression for “Track ID” on the Node “Spotify1” to this value:

```javascript
{{ $item(0).$node["Track"].json["Track"] }}

```

---

<div class="post-metadata">

**Author:** ![Colin\_Cameron](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/colin_cameron/32/2282_2.png) [@Colin\_Cameron](https://community.n8n.io/u/Colin_Cameron)\
**Post date:** [November 24, 2020, 7:02pm UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/5 "2020-11-24T19:02:37Z")

</div>

Had to change the Merge2 Node to Multiplex it to get it to work. Issue seemed to be that Playlist was only passing 1 result and Track was passing 12.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [November 24, 2020, 11:16pm UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/6 "2020-11-24T23:16:59Z")

</div>

Yes, exactly that is another possibility. But to be complete also then the expression would still need to get changed. In this case to:

```javascript
{{ $json["Track"] }}

```

---

<div class="post-metadata">

**Author:** ![Colin\_Cameron](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/colin_cameron/32/2282_2.png) [@Colin\_Cameron](https://community.n8n.io/u/Colin_Cameron)\
**Post date:** [November 25, 2020, 2:16am UTC](https://community.n8n.io/t/problems-with-spotify-workflow/3141/7 "2020-11-25T02:16:10Z")

</div>

Yeah, that is the expression being used.
