An AWS Lambda to control local Spotify playback via Slack. Includes package script and CircleCI config.
Clone and run an instance of Spotify Local on a Mac mini and deploy this Lambda with the following Environmental variables:
SPOTIFY_LOCAL_URL=https://xxx.ngrok.io
SLACK_TOKEN=THE_TOKEN_YOUR_SLACK_APP_SENDS_IN_POST_BODY
- Requires Node v6.10
- Package engine is set to strict to match AWS Lambda Environment
- I recommend using NVM
Add the following commands to your Slack app in order to control an instance of Spotify Local. When adding the slash commands to Slack be sure to point all commands at a POST endpoint for the Lambda's corresponding API Gateway.
/playing
/skip
/add [spotify track id, uri or http link]
/queue
/dequeue 1
/dequeue all
# sets the playlist
/playlist [spotify playlist id, uri or http link]
# gets the playlist
/playlist
/play [spotify track id, uri or http link]
/shuffle
/pause
/resume
# sets the volume
/volume 0
# gets the playlist
/volume
/say [something funny or useful]
This project includes Mocha and Chai. If you add to this, write more tests. And run them:
$ npm test
The lint config is based on AirBnB's eslint. To lint the code run:
$ npm run lint
Make sure the bin directory has executable permissions:
$ chmod +x ./bin/build.sh
If this throws an error, trying using sudo:
$ sudo chmod +x .bin/build.sh
Zip up the source code and runtime dependencies for upload by running:
$ npm run build
This should output files.zip to the project root for upload to the AWS Lambda Console.