Skip to content
Reports Now Playing status from Spotify and Last.FM to Slack
JavaScript HTML Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.github
src
test
.gitignore
CODE_OF_CONDUCT.md
CREDITS.md
Dockerfile
LICENSE
README.md
app.js
package.json
yarn.lock

README.md

lastfm2slack CircleCI Docker Pulls lgtm

Reports Last.FM now playing to Slack.

Getting started

lastfm2slack is fairly simply to use and this README should suffice in setup. There are few dependencies you'll need to retrieve before using this app.

Dependencies

Last.FM API key

  1. Go to this website here and create a new API application
    • Fill in the application
    • Call it lastfm2slack or something similar - it doesn't really matter
  2. On the completion screen, it will show the API Key - this is the LASTFM_KEY
  3. There will also be a "registered to" field. This is the LASTFM_USERNAME

ℹ️ Note: Record these details as you cannot currently view them again

Slack API key

  1. Go to this page here and create a new API key
    • Although Slack does not recommend using Legacy tokens, they are still heavily used and perfectly secure
  2. Scroll down to the Legacy token generator underneath Legacy information
  3. Locate the Slack workspace you are looking to get a token for, click the Request Token button next to it
    • You may be prompted for a password
  4. The token will appear in an input field to the left of the button. Place token for SLACK_TOKEN

Docker

Customization

There are many variables you can set. Below is a description of each environment variable.

# Last.FM API Key
LASTFM_KEY=last-fm-key

# Last.FM username
LASTFM_USERNAME=last-fm-username

# Slack API Key
SLACK_TOKEN=slack-key

# @artist, @title, and @album are valid variables
STATUS_TEXT=@artist - @title (@album)

# Slack emoji; :emoji_name: or remove
STATUS_EMOJI=:sound:

# Random emoji from your Slack server; true or remove
RANDOM_EMOJI=true

# Random default music emoji; true or remove
RANDOM_MUSIC_EMOJI=true

# The emoji used when not playing music
NOT_PLAYING_EMOJI=:mute:

# Status text shown when not playing music
NOT_PLAYING_TEXT=Currently not playing

# Censor words from the album, artist, and track; delimiter: ','
BLACKLIST_WORDS=bad,words,mom,doesnt,like

# Like the above, but pulls from an external source
BLACKLIST_WORDS_URL=https://raw.githubusercontent.com/snguyenthanh/better_profanity/master/better_profanity/profanity_wordlist.txt
Example
docker run -d \
    --restart always \
    --name lastfm2slack \
    -e "LASTFM_KEY=1234asdf" \
    -e "LASTFM_USERNAME=coolusername" \
    -e "SLACK_TOKEN=xoxp-1234-asdf" \
    -e "STATUS_TEXT=@artist - @title (@album)" \
    -e "RANDOM_MUSIC_EMOJI=true" \
    -e "NOT_PLAYING_EMOJI=:mute:" \
    -e "NOT_PLAYING_TEXT=Currently not playing" \
    -e "BLACKLIST_WORDS_URL=https://raw.githubusercontent.com/snguyenthanh/better_profanity/master/better_profanity/profanity_wordlist.txt" \
    hijef/lastfm2slack
You can’t perform that action at this time.