This simple script let's you update your Slack status with the song you're currently listening to via Last.fm - for example using Spotify.
- Clone this repository.
git clone https://github.com/joshghent/lastfm-slack.git
-
Run
composer install
. -
Copy
.env.example
to.env
and configure yourLASTFM_KEY
key,LASTFM_USER
and yourSLACK_TOKEN
. -
Run the script
php statusUpdate.php
-
Listen to some music :)
After configuring a .env
file with the required parameters, run the following command.
Please note: Do not wrap your environment variables in quote " tags as this will mean the program does not work!
docker run -d --restart always --name lastfm2slack --env-file .env joshghent/lastfm2slack
Please note: Please place the config options in "" quote marks.
- Go to this website here and create a new API application a. Fill in the application. Call it "Last2Slack" or something similar - it doesn't really matter
- On the completion screen, it will show the API Key - this is the LASTFM_KEY
- There will also be a "registered to" field. This is the LASTFM_USER.
- Record these details as you cannot currently view them again!
- Get your Slack app credentials from https://api.slack.com/apps.
- Call https://slack.com/oauth/v2/authorize?user_scope=users.profile:write&client_id=&redirect_uri=http://www.example.com/
- with the result, call
curl -F code=<CALLBACK CODE> -F client_id=<CLIENT ID> -F client_secret=<CLIENT SECRET> https://slack.com/api/oauth.v2.access
To change this, change the SLACK_EMOJI
config option to a markdown emoji with the colons either side. e.g., :tada:
By default the emoji is ๐ต
Last.fm to Slack is free software distributed under the terms of the MIT license.