Is there an API call to start playback from a Music Service?

  • 20 October 2023
  • 1 reply

I’m trying to automate Spotify playing music on my Sonos speakers when I scan a NFC tag.

I thought I could use Tasker to automate the necessary API calls...

However, Sonos only supports the OAuth flow “Authorization code”, which makes it impossible to automate the task, since I have to show a webpage to the user for that to work.

Is it possible to authenticate in any non-interactive way (Client credentials) or can I automate the Sonos app somehow? (e.g. Android intent?)


Best answer by controlav 21 October 2023, 15:42

View original

This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

1 reply

Userlevel 7
Badge +23

Sure, AVTransport.SetAVTransportURI is the call you need to make on the Coordinator. The hard part is figuring out the resource and the metadata to get it to work - sniff a call from the controller with Netmon. Buried in those args is the id of the item to play, wrapped in a url that is cracked on the speaker into the required SMAPI calls and the music service endpoint.

At this level you don’t need to auth anything - the players contain the tokens, and this API just requires args.