ZBrain Documentation
  • ZBrain Documentation
    • Components of ZBrain
    • Getting started with ZBrain
    • 📚Knowledge base
      • How to create a knowledge base?
      • Knowledge source
      • Information schema
      • File summary
      • Automated reasoning
      • Retrieval testing
      • Knowledge base settings
    • 📱APP
      • How to create a new app?
      • How to set up and customize your app?
      • How to access the app reporting dashboard?
    • 🤖ZBrain AI agents
      • Get started with agents on ZBrain
      • Deploying pre-built agents
      • Creating custom AI agents
        • Agent setup
        • Define input sources
        • Define Flow
          • Key elements of a Flow
          • Flow Components
            • Activepieces Platform
            • AITable
            • Airtable
            • Amazon S3
            • Amazon SNS
            • Amazon SQS
            • Amazon Textract
            • Apify
            • Apollo
            • Approval
            • Asana
            • Azure Communication Services
            • Azure Cosmos DB
            • Azure Document Intelligence
            • Azure OpenAI
            • Azure Translation
            • Bannerbear
            • Baserow
            • Beamer
            • Bedrock Claude
            • Bettermode
            • Binance
            • Bing Search
            • Blackbaud
            • Bonjoro
            • Box
            • Brevo
            • Brilliant Directories
            • Bubble
            • CSV
            • Calendly
            • Certopus
            • Clearout
            • Clockodo
            • Code
            • Confluence
            • Connections
            • Constant Contact
            • Contiguity
            • Contentful
            • Customer.io
            • Crypto
            • Databricks
            • Data Mapper
            • Date Helper
            • DeepL
            • Delay
            • Discord
            • Discourse
            • Drip
            • Dropbox
            • Dust
            • Facebook Pages
            • Figma
            • Files Helper
            • Flowise
            • Flowlu
            • Formbricks
            • Frame
            • Freshdesk
            • Freshsales
            • GCloud Pub/Sub
            • GenerateBanners
            • GhostCMS
            • GitHub
            • GitLab
            • Gmail
            • Google Calendar
            • Google Contacts
            • Google Docs
            • Google Drive
            • Google Forms
            • Google Gemini
            • Google My Business
            • Google Search
            • Google Search Console
            • Google Sheets
            • Google Tasks
            • Groq
            • Hacker News
            • Heartbeat
            • HubSpot
            • HTTP
            • Image Helper
            • Inputs
            • Instagram for Business
            • Intercom
            • Invoice Ninja
            • Jira Cloud
            • Jotform
            • Kimai
            • Kizeo Forms
            • LeadConnector
            • Line Bot
            • Linear
            • LinkedIn
            • LinkedIn Actions
            • LLMRails
            • Lusha
            • MailerLite
            • Mailchimp
            • Mautic
            • Microsoft Dynamics 365 Business Central
            • Microsoft Dynamics CRM
            • Microsoft Excel 365
            • Microsoft OneDrive
            • Microsoft Outlook Calendar
            • Microsoft Teams
            • Mixpanel
            • MongoDB
            • Notion
            • Odoo
            • OpenAI
            • OpenRouter
            • Pastebin
            • PDF
            • Postgres
            • PostHog
            • Pushover
            • Qdrant
            • Queue
            • Razorpay
            • Router
            • Salesforce
            • SendGrid
            • ServiceNow
            • SFTP
            • SharePoint
            • Slack
            • SMTP
            • Snowflake
            • SOAP
            • Spotify
            • Stability AI
            • Stable Diffusion Web UI
            • Storage
            • Stripe
            • SurrealDB
            • SurveyMonkey
            • Taskade
            • Telegram Bot
            • Text Helper
            • Trello
            • Twilio
            • Twitter
            • Utilities
            • WhatsApp Business
            • WordPress
            • XML
            • YouTube
            • ZBrain
            • Zendesk
            • ZeroBounce
            • Zoho Books
            • Zoho CRM
            • Zoho Invoice
            • Zoom
          • How to Define a Flow?
          • How to Test Each Step in the Flow?
        • Configure Additional Settings
        • Test and Deploy Agents
        • How to access, monitor, and manage agent performance and tasks?
    • Settings
    • 📖API Tutorials
      • 📚Knowledge base
        • Automated Reasoning
      • 📱APP
      • 🤖Agents
Powered by GitBook
On this page
  1. ZBrain Documentation
  2. ZBrain AI agents
  3. Creating custom AI agents
  4. Define Flow
  5. Flow Components

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.

PreviousSOAPNextStability AI

Last updated 28 days ago

🤖