Spotify
The Spotify piece in ZBrain Flow provides integration with Spotify's music streaming platform, allowing you to control playback, manage playlists, and access music data directly from your workflows. This powerful connector enables you to automate interactions with your Spotify account without manual intervention. With Spotify integration, you can build automations that search for music, control playback states, manage playlists, track favorite songs, and synchronize music information with other systems. This piece is ideal for creating personalized audio experiences, automated DJ setups, playlist management tools, and music-based workflow automations.
How to Use Spotify in ZBrain Flow
Select Spotify as Your Connection
Click on the '+' button in the Flow and search for Spotify.
Select Spotify.
Decide on the action you need, then select it. ZBrain Flow provides numerous options:
Search – Find tracks, artists, albums, and playlists.
Playback Control: Get Playback State, Play/Resume, Pause, Set Volume
Playlist Management: Get Playlists, Get Playlist Info, Get Playlist Items, Create Playlist, Update Playlist
Content Operations: Add items to playlist, Remove items from playlist, Reorder playlist, Get Saved Tracks
Custom API Call – Make specialized requests to the Spotify API.
How to Connect to Your Spotify Account
Before using any Spotify actions in ZBrain Flow, you'll need to set up a connection to your Spotify account. This is a one-time setup that will allow you to access your music streaming functionality securely.
To create your Spotify connection:
From any Spotify action, click on the connection dropdown and select 'Create connection'.
In the popup window that appears, you'll need to:
Enter a descriptive 'Connection Name' to identify this Spotify connection
Note the 'Redirect URL' provided by ZBrain (you'll need this for setting up your Spotify Developer app)
Enter your Spotify 'Client ID' from your Spotify Developer dashboard
Enter your Spotify 'Client Secret' from your Spotify Developer dashboard
Click 'Connect' to authenticate with your Spotify account
Click 'Save' to store this connection
How to Find Music Content in Spotify
Step 1: Enter Search Query
In the 'Search Text' field, enter the keywords or phrase you want to search for. This could be a song title, artist name, album, or any combination of search terms.
Step 2: Specify Content Type
From the 'Object Types' dropdown, select what kind of content you're looking for:
album - music albums
artist - musicians and bands
playlist - collections of tracks
track - individual songs
select all - select all options to search across different categories simultaneously.
Step 3: Configure Results Options (Optional)
In the 'Limit' field, enter the maximum number of results to return.
In the 'Offset' field, specify how many results to skip (useful for pagination).
How to Get Playback State in Spotify
To get the playback state in Spotify, simply connect your account by following the steps in "How to Connect to Your Spotify Account."
How to Control (Play/Resume) Music Playback
Step 1: Select Playback Device
From the 'Device' dropdown, select which Spotify-connected device should play the music. This could be your computer, phone, smart speaker, or other Spotify-enabled devices.
Step 2: Choose What to Play (Option 1)
In the 'Context URI' field, optionally enter a Spotify URI for an album, artist, or playlist. Spotify URIs look like: spotify:album:1234... or spotify:playlist:5678... This will play the entire context from the beginning.
Step 3: Choose What to Play (Option 2)
Click 'Add Item' in the 'Tracks' section to specify individual songs to play. Add multiple track URIs to create a temporary queue of specific songs.
Step 4: Set Playback Position (Optional)
In the 'Position' field, optionally enter a position in milliseconds. This determines where in the track to start playback (e.g., 30000 for 30 seconds in).
How to Stop Music Playback
Step 1: Select Playback Device
From the 'Device' dropdown, select which Spotify-connected device you want to pause. Leave this field empty to pause playback on the currently active device.
How to Adjust Audio Volume
Step 1: Specify Volume Level
In the 'Volume' field, enter a number between 0 and 100. 0 is silent, 100 is maximum volume.
Step 2: Select Playback Device
From the 'Device' dropdown, select which Spotify-connected device to adjust. Leave this field empty to change the volume on the currently active device.
How to Fetch Your Playlist Collection
Step 1: Configure Pagination (Option 1)
In the 'Offset' field, optionally enter how many playlists to skip.
In the 'Limit' field, optionally specify the maximum number of playlists to retrieve.
These options are useful when you have many playlists and want to retrieve them in batches.
Step 2: Retrieve Complete Collection (Option 2)
Toggle 'All' on to fetch your entire playlist library in a single request. This overrides the Offset and Limit parameters.
Be cautious with this option if you have a very large number of playlists.
How to Get Playlist Information
Step 1: Select Target Playlist
From the 'Playlist' dropdown, select which Spotify playlist you want to get information about. This will show all playlists that you've created or followed.
How to Get Playlist Items
Step 1: Select Target Playlist
From the 'Playlist' dropdown, select which Spotify playlist you want to explore. This will show all playlists that you've created or followed.
Step 2: Configure Pagination (Option 1)
In the 'Offset' field, optionally enter how many tracks to skip.
In the 'Limit' field, optionally specify the maximum number of tracks to retrieve.
These options are useful for large playlists when you only need specific portions.
Step 3: Retrieve Complete Track List (Option 2)
Toggle 'All' on to fetch the entire playlist content in a single request. This overrides the Offset and Limit parameters.
How to Get Saved Tracks
To get your saved tracks, follow the same steps as in "How to Fetch Your Playlist Collection."
How to Create a Playlist
Step 1: Define Playlist Basics
In the 'Name' field, enter a title for your new playlist.
In the 'Description' field, optionally add details about the playlist's theme or purpose.
Step 2: Set Visibility and Collaboration Options
Toggle 'Public' on to make the playlist visible to other Spotify users, or off to keep it private.
Toggle 'Collaborative' on if you want to allow other users to add or remove tracks, or off for sole control.
How to Modify an Existing Playlist
Step 1: Select Target Playlist
From the 'Playlist' dropdown, select which Spotify playlist you want to modify. This will show all playlists that you've created.
Step 2: Update Playlist Properties
For updating the playlist name, description, and visibility settings, follow the same steps as in the "How to Create a Playlist" section above.
How to Add Items to a Playlist
Step 1: Select Target Playlist
From the 'Playlist' dropdown, select which Spotify playlist you want to add items to. This will show all playlists that you've created or collaborative playlists you can edit.
Step 2: Specify Songs to Add
Click 'Add Item' in the 'Items' section to enter Spotify URIs for tracks or episodes.
Add multiple items by clicking 'Add Item' again for each track.
Step 3: Set Insertion Position (Optional)
In the 'Position' field, optionally enter the zero-based index where items should be inserted. For example, 0 will add items at the beginning, and 5 will add them after the fifth track.
Leave blank to add items at the end of the playlist.
How to Delete Items from Playlists
Step 1: Select Target Playlist
From the 'Playlist' dropdown, select which Spotify playlist you want to remove items from. This will show all playlists that you've created or collaborative playlists you can edit.
Step 2: Specify Songs to Remove
Click 'Add Item' in the 'Items' section to enter Spotify URIs for tracks or episodes to delete.
Add multiple items by clicking 'Add Item' again for each track you want to remove.
How to Reorder Items in a Playlist
Step 1: Select Target Playlist
From the 'Playlist' dropdown, select which Spotify playlist you want to reorganize. This will show all playlists that you've created or collaborative playlists you can edit.
Step 2: Define Movement Parameters
In the 'From Position' field, enter the current position (zero-based index) of the first item to move.
In the 'To Position' field, enter the new position where the items should be moved to.
In the 'Amount of Items' field, specify how many consecutive tracks to move as a group.
How to Make a Custom API Call to Spotify
Step 1: Specify API Endpoint
In the 'URL' field, enter the Spotify API base URL with the specific endpoint you want to access.
Step 2: Select Request Method
From the 'Method' dropdown, choose the appropriate HTTP method (GET, POST, PUT, DELETE, etc.).
Step 3: Configure Headers (Optional)
Click 'Add Item' in the 'Headers' section to add any custom headers. Note that authorization headers are automatically injected from your connection.
Step 4: Add Query Parameters (Optional)
Click 'Add Item' in the 'Query Parameters' section to add URL parameters.
Step 5: Provide Request Body (Optional)
For POST, PUT, or DELETE requests, enter the JSON data to send in the 'Body' field.
Step 6: Set Error Handling (Optional)
Enable 'No Error on Failure' if you want the flow to continue even if the API request fails.
Set a 'Timeout' value in seconds to limit the request duration.
Last updated