spotify2line is a LINE message bot channel that will send updates when a new song is added into a collaborative playlist.
Currently, Spotify has implemented collaborative playlists, which allow multiple users to add songs to a single shared playlist. However, there is no existing notification system in place when someone adds a song. The motivation to create spotify2line was to solve this problem and create a way to send notification updates to a LINE chat when a new song has been added.
- Screenshot
- Getting Started
- Pre-requisites
- Installation
- Setup
- 1. Environment Variables File
- 2. Create a new Spotify Developer App and Generate Client ID & Client Secret
- 3. Determine Spotify Playlist ID
- 4. Create a new LINE Channel and Generate Channel Access Token & Channel Secret
- 5. Create a new Heroku app and deploy app
- 6. Setup Cloudinary Add-On
- 7. Setup FreshPing to periodically ping Heroku app
- 8. Add LINE Channel
- Usage
- License
Description | Demo Image |
---|---|
Mobile LINE app | |
Desktop LINE app | |
If there is no song preview available |
- Spotify account
- LINE account
- Clone this project
git clone https://github.com/philliplam8/spotify2line.git
- Use the package manager npm and install the required dependencies
npm i
- Follow steps in the Setup section below to host and use the spotify2line app
This project will use the following APIs and free services to run and host the spotify2line application
IMPORTANT: Ensure the .env file is not made available to the public i.e. not uploaded to a public repository (to workaround this, use a .gitignore file). Your tokens and secrets should be kept hidden and treated like a password as they can be misused. If they are compromised, re-issue a new token/secret from the application accordingly.
- Create an environments variable file called
.env-placeholder
in the root directory of the project - Rename the file to
.env
- In the following steps, we will be adding several environment variables into this file
- Log into Spotify Developer Dashboard with your existing Spotify account
- Click Create An App
- Fill in all required details and create a new Spotify Developer App
- Copy the Client ID and Client Secret from the Dashboard Overview page and paste into the
.env
file variablesSPOTIFY_CLIENT_ID
andSPOTIFY_CLIENT_SECRET
, respectively
- Open your desired Spotify Playlist
- Right-click on the playlist
- Click
Share > Copy link to playlist
- Paste the share link into any text editor
- The share link will appear with the following syntax
https://open.spotify.com/playlist/{playlistId}?si=
- Copy the
playlistId
value and paste it into the.env
file variablePLAYLIST_ID
- Visit the LINE Developers Messaging API page
- Click Start now
- Login with your existing LINE account
- Create a new channel
- Copy the Channel Secret and Channel Acccess Token from the Dashboard Overview page and paste into the
.env
file variablesCHANNEL_SECRET
andCHANNEL_ACCESS_TOKEN
, respectively - Save the
.env
file
Heroku is used here, but feel free to use any hosting method (local, AWS, etc.)
- Visit Heroku and create a new account (or sign in with an existing account)
- Click New > Create new app
- Following the instructions to Deploy using Heroku Git
- Visit the Settings Tab
- Click on Reveal Config Vars
- Copy and paste all key/values from the
.env
file into the Heroku Config Vars section - Click on More > View Logs and ensure the app has been deployed successfully
- Visit the Heroku Dashboard and click on the created app
- Proceed to the Overview Tab > Configure Add-ons
- Search for Cloudinary and add the Free Tier plan
- Click on the added Cloudinary Add On to visit the Cloudinary Console
- In section Configure your SDK, click Start configuring > Node.JS
- Copy and paste all key values from the
.env
file into the Heroku Config Vars section
- Visit Freshping and create a new account (or sign in with an existing account)
- Click + Add Check
- Enter the Heroku app URL into the Check URL field
- Set Check interval = 1 min
- Click Save
- Visit Line Manager
- Click on the Channel created
- Click on Gain Friends > "Add friend" tools"
- Click on Create a URL
- Visit the URL and add the LINE channel on either desktop or mobile
- Add any song to the Spotify playlist configured during the setup steps above
- Congratulations, you are done! A LINE chat message will automatically send a broadcast message!
spotify2line is licensed under the MIT license