Skip to content

Change your slack status to your currently played track on Spotify, regardless of the device!

License

Notifications You must be signed in to change notification settings

JohnAntonios/slackthespot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack The Spot

Change your slack status to your currently played track on Spotify, regardless of the device!

Getting Started

Python shenanigans

You will need Python >= 3.7 installed on your computer.

I recommend a virtual environment setup, to isolate this app from any other Python app and not have conflicting packages installed.

After installing Python, go to your terminal:

pip install virtualenv
cd <to your chosen folder location>
git clone https://github.com/JohnAntonios/slackthespot.git
cd slackthespot
virtualenv venv

# For Windows:
.\venv\Scripts\activate

# For Mac OS X / Linux / UNIX:
source venv/bin/activate

pip install -r requirements.txt

API shenanigans

You will need to create a .env file in the root directory of the git folder.

In the .env file, 3 keys are required that you will need to obtain yourself:

This sample file has been provided for you to follow along with.

SLACK_OAUTH_ACCESS_TOKEN

You will need to generate this token in Slack API, simply create an App and link it to your desired workspace, then install the app, this will generate an OAUTH key for you to copy and paste.

SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET

You will need to generate these two keys in Spotify for Developers.

  1. Create an App
  2. Fill in the details and press next.
  3. Press Non-Commercial
  4. Confirm to the agreements.

This will now redirect you to the dashboard of your newly created app.

Press SHOW CLIENT SECRET and paste both the Client ID and Client Secret into the .env file.

  1. Press Edit Settings
  2. In the Redirect URIs, add: http:https://localhost/oauth_code

Running the app

After finally getting the above shenanigans sorted, you are ready to start the app!

python app.py

For the first run, a browser will open requiring you to sign in with the Spotify account you would like to grab the currently playing track from.

After signing in, you will be redirected to http:/localhost/oauth_code?=... copy the entire URL and paste it in the terminal window.

This will save that user, so that you do not need to authenticate the user again. If you wish to sign in into a different account, simply remove the SPOTIFY_CURRENT_USER_TOKEN key-value from your .env file.

The app will automatically update your slack status every minute, as there is no event listener / webhook integrated in Spotify's API with Python + Tekore; so polling was implemented.

The app tracks the device that the user is logged into, so it can even update it from your Phone's Spotify!


Dependencies

tekore

python-dotenv

python-slackclient

About

Change your slack status to your currently played track on Spotify, regardless of the device!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages