- users can become hosts: the app logs into Spotify, creates a new playlist and assigns the host a passcode
- other users can request for a song to be added to a host's playlist using the host's passcode, or cancel their request
- hosts can preview requested songs and approve them, which adds the song to the playlist and notifies the requester
- search for songs
- listen to 30-second previews, if available
This guide will walk you through how to deploy your own instance of this bot on Heroku for your Facebook page.
Clone the repository first:
git clone https://github.com/bobheadxi/facebook-spotify-chatbot.git
- Make an Heroku account and install Heroku tools from https://devcenter.heroku.com/articles/heroku-cli
- Install Node from https://nodejs.org/en/
- CD into your cloned repository and install the project's dependencies:
npm install - Set up a new Heroku instance
heroku create - Make sure you set the URI of your Heroku instance as well:
heroku config:set HEROKU_URI=your-heroku-uri
- Create a Facebook page for your app at https://developers.facebook.com/apps/
- Click on "Messenger" under "Products". Generate a token under "Token Generation", and set up Webhook under "Webhooks". Use the URL of your Heroku server as your webhook URL (append "/webhook/" to the end)
- Save as Config Variables on Heroku
heroku config:set FB_REDIRECT_URI=your-redirect-uri heroku config:set FB_TOKEN=your-fb-token
- Create a Spotify application at https://developer.spotify.com/my-applications/#!/applications
- Go to your application settings and add the URL of your Heroku server as your redirect URI (append "/callback/" to the end). Also take note of your Client ID and Client Secret.
- Save as Config Variables on Heroku
heroku config:set SPOTIFY_CLIENT_ID=your-client-id heroku config:set SPOTIFY_CLIENT_SECRET=your-client-secret heroku config:set SPOTIFY_REDIRECT_URI=your-redirect-uri
With all this set up, you should be good to go! Deploy the bot to your Heroku instance:
git push heroku dev:master
Now you can message your Facebook page to try out the bot. Note that until your application gets submitted for review and accepted, other users will have to be added as testers before the bot will respond to them.

