Watch the sites of the stackexchange network and get a slack notification for new questions
Because if you are like me, you like to contribute to StackExchanges sites which don't have a lot of traffic. And you don't want to check the new question page every ten minutes.
So you can simply run this code on your local machine or in a cloud function and get a nice Slack notification with the link to the questions you didn't already see.
The file config.json
contains all the keys you need to run the application:
slack.webhookurl
Always keep it private The URL generated by slack to reach your team. See their doc. hereslack.channel
The channel which should get the notification of the new question. You can specify either a#channel
or a@user
slack.username
The screenname of the bot when it sends you a notificationpersitence.idfilepath
The path to the file where the application will write the ID of the last seen questionstackexchange.sites
A JSON array of the sites you want to followstackexchange.refresh
The refresh rate of the app in seconds
First clone this repo, then use npm
to install the dependencies:
npm install
You're ready to go, simply start the app with:
npm start
- axios for the web request
- cheerio for the HTML parsing
- node-slack for the notification to slack
- Use the StackExchange API to get the new questions instead of parsing the HTML
- Watch the review queues
- Support several slack users to have one instance for several users in the same slack team
- Get rid of the id file to prepare the deployment as cloud function
- Make deployable in cloud function out of the box