Giter VIP home page Giter VIP logo

spotify-slack's Introduction

spotify-slack

This golang app provides the ability to:

  • Login using a spotify account
  • In slack, using the /spotify command in #shoreditch-tunes:
    • Add new tracks to the echo playlist: this will post to #shoreditch-tunes
    • Vote to skip the currently playing song, which starts a 10 second timer, after which if there are more votes to skip than keep the song will be skipped.
    • Vote to keep the currently playing song on
    • Check what's playing. This also posts to #shoreditch-tunes

Running this

  1. Get yourself a spotify client ID and token. Go to https://developer.spotify.com, login with your spotify account and then head to dashboard, and click "create client ID"
  2. Set up a slackbot in your apps, head to "oauth & permissions" and add the chat:write scope and the commands scope
  3. Click "install to workspace", head to "Basic information", scroll down and copy the verification token. Whack this in a .env file and call it SLACK_VERIFICATION_TOKEN
  4. Back in the slack manager, head to "Oauth and permissions", copy the "bot oauth token" and add that to your .env file as SLACK_BOT_TOKEN
  5. Create a playlist in your chosen spotify account, then right click on the title, "share" and copy the Spotify URI. This should be of the format spotify:playlist:<id>. Drop off the first two sections and put the id in your env file as SPOTIFY_PLAYLIST_ID.
  6. Run SPOTIFY_ID=<ID> SPOTIFY_SECRET=<SECRET> go run main.go, then go to the URL shown in the terminal window to handle oauth with spotify. For some bizarre reason godotenv doesn't work with the spotify library - i.e it can't find those variables in the env??
  7. Install ngrok, add it to your path, then in a separate terminal window, run ngrok http 8080 and copy the url in "forwarding".
  8. Head to "slash commands" back in the slack setup, add a new one for "/spotify" or similar and set the request url to the URL you just copied
  9. Run a slash command (I do this in messages to myself) /spotify add <query> and it should give you back a list of songs!

spotify-slack's People

Watchers

Rebecca Cottrell avatar Harry Walter avatar  avatar David Thorpe avatar James Cloos avatar Huw Martin avatar Miguel Medina avatar Pete D avatar Charlotte Godley avatar  avatar Dan Scott avatar  avatar Conor Okus avatar Ed  avatar

spotify-slack's Issues

Action Plan

Interface

The interface needs to have a mechanism of adding songs to the playlist. This should first check whether the song is already on the playlist.
It would be really nice if you could query the interface for what is currently playing in the office.
It would be nice if there was a mechanism for voting, proposing:

  • You can vote to "skip" the current song
  • The bot has a 30 second timeout window within which it will allow others to chime in, either with "keep" or "skip".
  • If there are more votes for skip it will skip the song.

We should:

  • Provide a add command under the slash name we've chosen, which takes a query string and picks the first result from the Spotify api.
  • Provide a what's playing command
  • Provide a skip command
  • Provide a keep command (which only does something if a skip is currently in action)

Hack part 2

  • Make the skip/keep voting system more interactive: look at having the first "skip" result in the bot posting to the channel saying "someone has voted to skip this song. Should we skip it or keep it? (x time remaining)"
  • Make it so that when /spotify playing is ran in the shoreditch-tunes channel, a message is posted to the channel rather than it being a "only you can see this" response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.