A Slack App that will crawl a specific Soundcloud User and post stats of how their tracks are doing into a channel.
- Create
config.json
inconfig/
and supply these values. You can also duplicate and create aconfig.test.json
if you wish to test into a different webhook.
{
"SOUNDCLOUD_USER_ID": "",
"CLIENT_ID": "",
"APP_VERSION": "",
"SLACK_WEBHOOK_URL": ""
}
- If you need help obtaining these values, go into the Network tab when you visit your Soundcloud profile and you should be able to find a request that makes such a call (filter by
api-v2.soundcloud.com
). These calls will have the parametersclient_id
andapp_version
passed. See the image below
- Set up your Webhook URL in your Slack team. You can do this by going to Your Apps, creating a new App, and then adding a new Incoming Webhook.
- Run
npm install
in this repository. - Assuming you have done all the steps above, run
npm run start
and you should send a Slack message to the channel you chose when setting up your Webhook URL above. - If you wish to have this run on a weekly or monthly basis, you can set up a cron job and have it run the command. My crontab file looks like below and you can access via
sudo crontab -e
and will run Monday 8 AM every week
NODE_PATH=/home/pi/.npm/lib/node_modules
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
0 8 * * 1 /usr/local/bin/npm start --prefix /home/pi/slack-soundcloud-pulse >/dev/null 2>&1
- The
client_id
value gets refreshed every so often so you may need to verify you have the rightclient_id
. I have not pinpointed how often this refresh happens but it seems every few months it can refresh. - Make sure you specify
NODE_PATH
andPATH
in your crontab in order for it to run. See here - If you need to verify your cron job is working, you can do a
grep CRON /var/log/syslog
and see if your job is running. - Sometimes it's nice to be able to test and send Slack attachment results to a test Slack channel. I have created an issue to do this see issue #4.