What This Agent Does
This powerful Spotify Playlist Generator agent transforms simple text requests into fully-populated Spotify playlists in seconds. When you send a message via Telegram describing your desired music vibe, the agent intelligently generates 25-40 track suggestions using AI, searches for each track on Spotify, and automatically adds them to a brand-new playlist—all without manual intervention.
Key benefits and time savings:
-
Eliminate manual playlist creation: What typically takes 30-45 minutes of searching and adding tracks now happens automatically in under 2 minutes
-
AI-powered curation: Leverage GPT-4o-mini's music expertise to discover tracks that perfectly match your mood or theme
-
Seamless integration: Control everything through Telegram—no need to switch between apps
-
Reliable automation: Built-in error handling ensures tracks are only added if they exist on Spotify
Target use cases:
- Creating themed playlists for parties, workouts, or study sessions
- Generating mood-based music collections (e.g., "upbeat summer vibes," "chill lo-fi beats")
- Building genre-specific playlists with AI-curated recommendations
- Sharing playlist creation as a service or bot feature
Who Is It For
This agent is ideal for:
-
Music enthusiasts who want to create playlists faster than manual curation allows
-
Content creators building soundtracks for videos or streams
-
Bot developers looking to add music automation to their Telegram communities
-
Playlist curators who want AI assistance in discovering new tracks
-
Anyone seeking convenience: If you love music but hate the tedious process of searching and adding tracks individually, this agent is your solution
Required Integrations
Telegram
Why it's needed: Telegram serves as your primary interface for this agent. Users send playlist requests via Telegram messages, and the agent responds with the generated playlist link, creating a conversational, user-friendly experience.
Setup steps:
- Open Telegram and search for BotFather (official Telegram bot creation tool)
- Send the command
/start and follow the prompts
- Create a new bot by sending
/newbot
- Choose a name for your bot (e.g., "Spotify Playlist Generator")
- Choose a username (must end with "bot")
- BotFather will provide your Bot Token—save this securely
- In TaskAGI, navigate to Integrations → Telegram
- Paste your Bot Token in the authentication field
- Enable webhook mode and note your webhook URL
- Return to BotFather and set the webhook URL using
/setwebhook
How to obtain credentials:
- Bot Token: Provided immediately by BotFather after bot creation
- Chat ID: Send a test message to your bot, then check the Telegram Bot API to retrieve your Chat ID
Configuration in TaskAGI:
- Store Bot Token in secure credentials
- Enable webhook listening for incoming messages
- Set message parsing to extract user text content
Spotify
Why it's needed: Spotify is the music platform where playlists are created and tracks are added. This integration enables playlist creation, track searching, and track addition—the core functionality of this agent.
Setup steps:
- Visit Spotify Developer Dashboard
- Log in with your Spotify account (create one if needed)
- Accept the terms and create an app
- Name your app (e.g., "TaskAGI Playlist Generator")
- Accept the service agreement and create the app
- You'll receive a Client ID and Client Secret—store these securely
- In TaskAGI, navigate to Integrations → Spotify
- Enter your Client ID and Client Secret
- Authorize the integration by clicking Connect to Spotify
- Grant permission for playlist creation and modification
How to obtain credentials:
- Client ID and Client Secret: Available in your Spotify Developer Dashboard under app settings
- These credentials authenticate all Spotify API calls
Configuration in TaskAGI:
- Enable scopes:
playlist-modify-public, playlist-modify-private, user-read-private
- Set default playlist visibility (public or private)
- Configure rate limiting to respect Spotify's API limits
OpenAI
Why it's needed: OpenAI's GPT-4o-mini model generates intelligent, contextually-relevant track suggestions based on user input. This AI layer ensures playlists are curated with expertise rather than random selection.
Setup steps:
- Visit OpenAI Platform
- Sign up or log in to your account
- Navigate to API Keys in your account settings
- Click Create new secret key
- Copy your API key immediately (you won't see it again)
- In TaskAGI, navigate to Integrations → OpenAI
- Paste your API key in the authentication field
- Select GPT-4o-mini as your default model
- Set usage limits if desired (optional but recommended)
How to obtain credentials:
- API Key: Generated in your OpenAI account settings
- Ensure your OpenAI account has available credits or an active billing method
Configuration in TaskAGI:
- Model:
gpt-4o-mini
- Temperature:
0.7 (balances creativity with consistency)
- Max tokens:
1500 (sufficient for 25-40 track suggestions)
- Enable cost tracking to monitor API usage
Configuration Steps
Node-by-Node Configuration Guidance
1. Telegram Message Received (Trigger Node)
This webhook node listens for incoming Telegram messages. No configuration needed beyond integration setup—it automatically captures user messages and passes them to the next node.
2. Create Spotify Playlist (Node 5)
-
Playlist Name: Use dynamic data from the Telegram message. Example:
{message_text}_Playlist or AI Generated Playlist
-
Description: Set to something like
"Created by TaskAGI Spotify Generator"
-
Public: Choose
true for shareable playlists or false for private playlists
-
Output: Captures the
playlist_id for use in subsequent nodes
3. Send Playlist URL to User (Node 6)
-
Chat ID: Extract from the Telegram webhook data
-
Message: Use template:
"Your playlist is ready! 🎵 [Spotify Link]"
-
Link Format:
https://open.spotify.com/playlist/{playlist_id}
-
Timing: Sends immediately after playlist creation (before tracks are added)
4. Generate Track Suggestions (Node 7)
-
Prompt: Pre-configured to
"You are a music expert DJ. Generate 25-40 track suggestions for: {user_message}. Format: Artist - Track Name, one per line."
-
Model:
gpt-4o-mini
-
Temperature:
0.7 (creative but consistent)
-
Output: Raw text list of track suggestions
5. Parse Track List (Node 8)
-
Input: OpenAI completion output
-
Parse Method: Split by newline (
\n)
-
Output: Array of individual track strings (e.g.,
["Artist1 - Track1", "Artist2 - Track2", ...])
6. Loop Through Tracks (Node 9)
-
Array Input: Parsed track list from Node 8
-
Loop Variable:
current_track
-
Iteration: Processes each track individually
-
Output: Passes one track at a time to the search node
7. Search Track on Spotify (Node 10)
-
Query:
{current_track} (e.g., "The Weeknd - Blinding Lights")
-
Search Type:
track
-
Limit:
1 (return only the top result)
-
Output: Track ID if found, or null if not found
8. Check If Track Found (Node 11)
-
Condition:
track_id != null
-
True Path: Proceeds to add track to playlist
-
False Path: Skips to next iteration (handles tracks not on Spotify gracefully)
9. Add Track to Playlist (Node 12)
-
Playlist ID: From Node 5
-
Track IDs:
[{track_id}] (array format)
-
Position: Leave empty (appends to end)
10. Wait 1 Second (Node 13)
-
Duration:
1000 milliseconds
-
Purpose: Respects Spotify API rate limits and prevents throttling
-
Loop Back: Returns to Node 9 for next track
Testing Your Agent
Step 1: Initial Setup Verification
- Ensure all three integrations (Telegram, Spotify, OpenAI) show Connected status
- Verify your Telegram bot is active by sending a test message
- Check that your Spotify app credentials are valid by attempting a test playlist creation
Step 2: Run Test Execution
- In TaskAGI, navigate to your workflow and click Test Run
- Send a test message to your Telegram bot:
"Create a chill lo-fi study playlist"
- Monitor the execution in real-time using the Execution Log
Step 3: Verify Each Step
-
Node 4 (Telegram): Confirm message received and text extracted
-
Node 5 (Create Playlist): Verify playlist created in your Spotify account
-
Node 6 (Send Message): Check that you received the playlist link via Telegram
-
Node 7 (Generate Suggestions): Review the AI-generated track list in logs
-
Node 8 (Parse): Confirm tracks split into individual items
-
Nodes 9-13 (Loop): Watch tracks being searched and added in real-time
Step 4: Expected Results and Success Indicators
✅ Success looks like:
- Playlist appears in your Spotify account within 30 seconds
- Telegram message received with clickable playlist link
- 20-35 tracks successfully added to the playlist
- Execution completes without errors
⚠️ Common issues and solutions:
-
No tracks added: Verify track names are spelled correctly in AI output; some obscure tracks may not exist on Spotify
-
Slow execution: Normal—the 1-second wait between tracks prevents API throttling
-
Playlist created but empty: Check OpenAI API key and ensure sufficient credits
Your agent is now ready to transform music requests into instant playlists! 🎵