Skip to main content

Telegram to Spotify with OpenAI

Workflow preview

Workflow preview
100%
Telegram to Spotify with OpenAI preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Search music and play to Spotify from Telegram This workflow is a simple demonstration on accessing a message model from Telegram and it makes searching for songs an easy task even if you can't rem...

Best for

  • Personal Productivity automation workflows
  • AI Chatbot automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegramtrigger, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.spotify, n8n-nodes-base.stickynote, n8n-nodes-base.merge, n8n-nodes-base.if, n8n-nodes-base.set, n8n-nodes-base.telegram

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Alexander Bentlund.

Original n8n.io source

1.1 Workflow description

Title
Telegram to Spotify with OpenAI
Workflow name
Telegram to Spotify with OpenAI

Search music and play to Spotify from Telegram

This workflow is a simple demonstration on accessing a message model from Telegram and it makes searching for songs an easy task even if you can't remember the artist or song name. An OpenAI message model tries to figure out the song and sends it to an active Spotify device**.

Use case Imagine an office where you play music in the background and the employees can control the music without having to login to the playing account.

How it works

  • You describe the song in Telegram.
  • Telegram bot sends the text to n8n.
  • An OpenAI message model tries to find the song.
  • Spotify gets the search query string.
  • First match is then added to queue. -- If there is no match a message is sent to Telegram and the process ends.
  • We change to the next track in the list.
  • We make sure the song starts playing by trying to resume.
  • We fetch the currently playing track.
  • We return "now playing" information to Telegram: Song Name - Artist Name - Album Name.

Error handling

  • Every Spotify step has it's on error handler under settings where we output the error.
  • Message parser receives the error and sends it to Telegram.

Requirements

  • Active workflow*
  • OpenAI API key
  • Telegram bot
  • Spotify account and Oauth2 API
  • Spotify active on a device**

.* The Telegram trigger is activated only if this workflow is active. You can however TEST the workflow in the editor by clicking "Test step" and then it waits for the Telegram event. When event is received, just step through all steps or just clicking "Test step" on the "Fetch Now Playing" node.

.** You must have a Spotify device active when trying to communicate with a device. Open Spotify and play something - not it is active.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.1

Block 2 - OpenAI - Ask about a track

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.6

Block 3 - Search track

Type / Role
n8n-nodes-base.spotify - spotify
Config choices
Version 1

Block 4 - Add song

Type / Role
n8n-nodes-base.spotify - spotify
Config choices
Version 1

Block 5 - Next Song

Type / Role
n8n-nodes-base.spotify - spotify
Config choices
Version 1

Block 6 - Resume play

Type / Role
n8n-nodes-base.spotify - spotify
Config choices
Version 1

Block 7 - Currently Playing

Type / Role
n8n-nodes-base.spotify - spotify
Config choices
Version 1

Block 8 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3

Block 10 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 11 - Message parser

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Not found error message

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Return message to Telegram

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 14 - Define Now Playing

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

3. Summary Table

Workflow Telegram to Spotify with OpenAI
Complexity intermediate
Nodes 14
Categories Personal Productivity, AI Chatbot
Author Alexander Bentlund
Published 05 Nov 2024

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2526/2526.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Telegram to Spotify with OpenAI do?

Search music and play to Spotify from Telegram This workflow is a simple demonstration on accessing a message model from Telegram and it makes searching for songs an easy task even if you can't rem...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Personal Productivity, AI Chatbot use case.