spotatweet
spotatweet copied to clipboard
A Spotify & Twitter API mashup showing what people are listening to now. Written in Node.js.
SpotaTweet
A real-time Spotify & Twitter API mashup.
This web app filters the Twitter stream for #NowPlaying tweets, extracts track IDs from Spotify URLs, requests track data from the Spotify API, displays the embedded Tweet in the web browser and plays a preview. Implements Twitter statuses/filter stream and oEmbed API.
Inspired by Serendipity by @kcimc, formerly a Spotify Media Artist in Residence.

Installing and Running
Install Node.js.
Clone GitHub repo:
git clone https://github.com/twitterdev/spotatweet.git
Create Twitter and Spotify Apps:
- Create a Twitter application.
- Create a Spotify application.
Create a config.json file using config.sample.json as a template. Fill in your Twitter & Spotify API Keys. You may also set the values in the config.sample.json file as environment variables for environments like Heroku and Glitch. Values set in the environment will override those set in the config file.
Install node module dependencies:
npm install
Run application:
npm start
Open http://localhost:3000 in your browser.
A GET request to /nowplaying.json will return a Tweet object, additionally hydrated with a "spotify_track" object and a "oembed" object representing the latest #NowPlaying Tweet.
Deploying
Heroku
This application is already configured to run on Heroku and can be deployed with Git.
Before deployment set your Heroku environment config vars to mirror config.json.
On Heroku set NODE_ENV to "production."
Glitch
You can also easily remix this project on Glitch. Set the environment variables in the .env file.
Limitations
- A Spotify developer token only lasts for 3600 seconds (one hour), so the app will need to be restarted after that time.
- Web audio does not autoplay on mobile Safari and some other browsers