Add actions

To get more information about the current item type (track, album, and so on), the listener selects the ellipsis (...) to display the Info View. The Info View is a screen with actions listeners can select for the current item type. The Info View is available for most item types but we'll show only a few examples.

The following screens display the Info View for an album and a song while browsing an album.

Browsing album Info View within an album

Browsing album Info View within an album

Browsing track Info View within an album

Browsing track Info View within an album

The following screen displays the Info View for a playing song:

For a streaming station:

The actions listeners can select are grouped as default actions and custom actions. You can provide custom actions but you cannot modify the default actions.


Default actions

Default actions are built-in to the Sonos app and display automatically. The Sonos default actions that display depend on the content's itemType and viewing mode, either browse or now-playing. Default actions display at the beginning of the Info View.

Some of the default actions are listed below.  Sonos may add other actions in the future.

  • Add Song to My Sonos
  • Add to Sonos Playlist
  • Play in Another Room...
  • Play Next
  • Add to End of Queue
  • More
  • Add Song to My Sonos
  • Add Song to Sonos Playlist

Custom actions

You can add optional custom actions to the Info View to provide features in the Sonos app that are specific to your service. For example, custom actions for a song:

Custom actions for an album:

Custom actions include the following:

Custom ActionExampleDescription
Show album informationAlbum InfoDisplays a list of all the songs of an album. For example, this displays when browsing or playing a track.
Show artist informationBrowse the ArtistDisplays information about the artist such as a list of albums, depending on your service offerings.
See related textAbout the ArtistDisplays text information related to the current itemType such as comments or other descriptions about it. To provide formatted and complex content, see the Open URL custom action.
Browse to related itemRelated SongsThe listener can browse your service's content that you determine is related to the current item.
Play related itemStart RadioThe listener can play a radio stream that you determine is related to the current item.
Open URLConcertsThe listener can open a URL in a browser or app to provide rich related information.
Make an HTTP RequestSave to My Acme MusicSonos can make an HTTP REST request to your service. For example, use this to implement favorites as described in the separate tutorial, Add favorites.
Edit playlistAdd Song to My PlaylistProviding your own playlists require more complex implementation than the other custom actions. See Add playlists for details.

You can implement many custom actions but be aware that the listener may have to scroll the Info View. Provide custom actions dynamically, depending on the context of the current itemType. For example, if you do not have any content for a related browse action, do not provide it for that Info View. Legacy desktop controllers do not display open URL or HTTP request actions.

Adding custom actions involves the following key tasks: provide the Info View display text and implement getExtendedMetadata responses.

Provide the Info View display text

Create a localization file with the text strings, such as an i18next file, and upload the file to your Integration Submission form. See Localization for details. The text values in your i18next file for the examples above might look like the following. Sonos provides default text strings for some custom actions.

{
    "en-US":{
      "common":{
          ...
          },
      "integration":{
        "ABOUT_ARTIST": "About the Artist",
        "RELATED_SONGS": "Related Songs",
        "START_RADIO": "Start Radio",
        "CONCERTS": "Concerts",
				"SAVE_MUSIC": "Save to My Acme Music"
        ...
      }
    },
}

Implement getExtendedMetadata responses

Your getExtendedMetadata responses for custom actions need to include XML elements indicated in the table below. See the related section for implementation details.

Custom ActionKey XML ElementsSection
Show album informationtrackMetadata & albumIdAlbum & artist
Show artist informationtrackMetadata & artistId mediaCollection & artistIdAlbum & artist
See related textrelatedTextRelated text
Browse to related itemrelatedBrowseRelated browse
Play related itemrelatedPlayRelated play
Open URLrelatedActions action actionType & openUrl openUrlActionWeb page
Make an HTTP RequestrelatedActions action actionType & simpleHttpRequest simpleHttpRequestActionREST request