Automate Spotify Playback Using Telegram & n8n

Discover how to use n8n to control your Spotify music from a Telegram chat with AI-powered track recognition. This workflow simplifies song selection and playback, saving you time and enhancing your music experience.
telegramTrigger
openAi
spotify
+5
Workflow Identifier: 2282
NODES in Use: Telegram Trigger, OpenAI, Spotify, Set, If, Merge, Telegram, Sticky Note
Automate Spotify with n8n and Telegram

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow listens for messages sent to a Telegram bot with a song description or name.
It uses AI from OpenAI to find the artist and song name from the message.
Then it searches Spotify for that track and adds it to the playback queue.
It also skips to play the added track and sends back a confirmation to Telegram.
This solves the problem of having to manually search and play music on Spotify by typing or speaking in Telegram.


Who should use this workflow

This is good for anyone who uses Spotify and Telegram and wants to control music without leaving a chat app.
It helps users who forget song details or want fast hands-free music control via text.


Tools / services used

  • Telegram Bot API: receives messages from users.
  • OpenAI GPT-4o-mini: extracts artist and song name from text.
  • Spotify API: searches tracks, adds songs to queue, controls playback.
  • n8n workflow automation: connects all the steps.

How this workflow works (Inputs → Processing → Output)

Inputs

User sends a message to Telegram bot with a song description or name.

Processing Steps

  • Telegram Trigger node catches the new message.
  • OpenAI (LangChain) node runs AI to get artist and song name.
  • Spotify Search Track node looks up the track with the AI result.
  • If a track is found, the workflow adds the song to Spotify queue.
  • Spotify Next Song and Resume Play nodes start playback.
  • Spotify Currently Playing node fetches current song info.
  • Set and Merge nodes build a confirmation message.
  • Telegram node sends success or error message back to the user.

Output

A Spotify song is added and played.
Telegram user gets a message showing song playing or an error if not found.


Beginner step-by-step: How to use this workflow in n8n

Importing and Setup

  1. Download the workflow file using the Download button on this page.
  2. In the n8n editor, click on “Import from File” and select the downloaded file.
  3. Open the imported workflow and add your Telegram Bot API credentials in the Telegram Trigger node.
  4. Add your OpenAI API key to the OpenAI (LangChain) node.
  5. Add your Spotify OAuth credentials to all Spotify nodes.
  6. Check any IDs or parameters and update if needed (usually IDs auto-fill from AI or Spotify nodes).

Testing and Activation

  1. Test the workflow by sending a message to your Telegram bot describing a song.
  2. See if the workflow adds and plays the song on Spotify and returns a confirmation message.
  3. If it works, activate the workflow so it runs automatically for all messages.

The workflow is ready to help control Spotify music from Telegram chat.
If using self hosting n8n, refer to self-host n8n for setup support.


Common issues and how to fix

  • Spotify add song fails: Check Spotify OAuth tokens are set and valid. Confirm track ID format starts with “spotify:track:”.
  • Telegram trigger not firing: Make sure Telegram bot webhook URL is set to the Telegram Bot via BotFather. Confirm bot permissions to read messages.
  • OpenAI parsing wrong: Review the AI prompt in OpenAI node. Adjust model to gpt-4 if available for better results.

Ideas to customize

  • Switch OpenAI model to stronger one like gpt-4 for better song recognition.
  • Add voice message support in Telegram and convert speech to text for AI processing.
  • Return multiple search results and add several songs for playlist queuing.
  • Add language detection or specify language in OpenAI prompt for multilingual users.
  • Add controls for pause, shuffle, or repeat using more Spotify nodes triggered by Telegram commands.

Summary

✓ Adds songs to Spotify queue from Telegram chat.
✓ Uses AI to understand song requests from text.
✓ Controls playback without switching apps.
✓ Sends confirmation back on Telegram.

Automate Spotify with n8n and Telegram

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

Currently, the workflow is set up for Telegram Bot API. Adaptation to other apps like WhatsApp or Slack needs additional integration nodes and is not provided.
Yes, each message sent to OpenAI for processing uses API tokens and counts as an API call according to the model used.
Spotify access uses OAuth2 authentication. Credentials are handled securely within n8n, but users must keep API keys and tokens private.
The workflow is designed for single song requests. Customization is required to handle bulk or playlist processing.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.