Spotify playlist to slack

by areohbe

GitHub Readme.md

Spotify Playlist to Slack Build Status

Automatically send new songs added to a Spotify playlist to a desired Slack channel via Slackbot.

All credit goes to Petter Sandholdt's original project: spotify-playlist-2-slack.

The following changes were made to better suit my group's needs:

  • The Slackbot post now contains the Spotify link to the track instead of the entire playlist
  • URL "unfurling" is now set to true by default. This mimics the default behavior when posting a link to Slack from Spotify which allows you to play the Spotify track from within Slack

##Setup

Set up can be performed via Heroku deploy button below which requires no programming knowledge. As long as you don't have an unusually active channel, you should have no problem staying within Heroku's free tier.

####Create Spotify Playlist

Create a playlist in Spotify that will be used to send newly added tracks to the Slack channel. The playlist can public, private, individual or collaborative. In our setup we use a collaborative playlist that anyone in the group can add tracks to.

####Obtain Spotify PlaylistId

The easiest way to obtain your PlaylistId is to right click on your playlist in Spotify and select "Copy Playlist Link" and paste the copied URL into a browser or text editor. Your PlaylistId is the string that comes after .../playlist/PlaylistId. In the example below, the PlaylistID would be 5ZMLf0vF70ugvT1AoesMCE

https://open.spotify.com/user/spotifydiscover/playlist/5ZMLf0vF70ugvT1AoesMCE

Save the PlaylistId somewhere. You will need it later when deploying your app to Heroku.

####Obtain Spotify Credentials

You'll need to obtain your Spotify username as well as the API credential for your app.

You can find you Spotify usersname by visiting the Account overview page. Save this for use later.

In order to obtain your API keys, create a new app from the Spotify Developer Portal. Once your app has been created you will be granted a Client ID and Client Secret. Save these values for later use.

####Slack Incoming Webhook

In order to allow a bot to post to your desired Slack channel you will need to set up an incoming webhook. Set up just takes a click and is detailed here. Save the URL of your webhook for later use.

####Deploy & Configure

Use the Heroku deploy button below to deploy your app to Heroku. On the setup screen you will see fields for the environment variables you created above.

SLACK_URL=https://hooks.slack.com/services/*/*/*
SPOTIFY_CLIENT_ID=ClientID
SPOTIFY_CLIENT_SECRET=ClientSecret
SPOTIFY_USERNAME=SpotifyUsername
SPOTIFY_PLAYLIST=PlaylistId

Deploy to Heroku

Deploy