Skip to content

Commit 7ae553a

Browse files
committed
Version 1.0.0 of project
Working version of rss-slack-integration module completed. Needs better documentation.
1 parent ae52b41 commit 7ae553a

4 files changed

Lines changed: 90 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ build/Release
2525
# Dependency directory
2626
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2727
node_modules
28+
29+
config.coffee
30+
docker-compose.yml

lib/index.js

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "rss-slack-integration",
3+
"version": "1.0.0",
4+
"description": "Super simple Ghost blog Slack-integration to notify Slack channel upon new posts.",
5+
"main": "index.coffee",
6+
"scripts": {
7+
"start": "node lib/index.js",
8+
"test": "echo \"Error: no test specified\" && exit 1",
9+
"prepublish": "coffee -o lib/ -c src/"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/pilsprog/rss-slack-integration.git"
14+
},
15+
"keywords": [
16+
"rss",
17+
"Slack",
18+
"Integration"
19+
],
20+
"author": "Snorre Magnus Davøen <snorremd@gmail.com>",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/pilsprog/rss-slack-integration/issues"
24+
},
25+
"homepage": "https://github.com/pilsprog/rss-slack-integration#readme",
26+
"dependencies": {
27+
"request": "^2.64.0",
28+
"rss-watcher": "^1.3.0"
29+
}
30+
}

src/index.coffee

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Watcher = require 'rss-watcher'
2+
request = require 'request'
3+
4+
exports.start = (config) ->
5+
6+
watcher = new Watcher config.feed
7+
8+
watcher.set
9+
feed: config.feed
10+
interval: config.interval
11+
12+
watcher.on "new article", (article) ->
13+
request.post
14+
url: config.slackHook,
15+
body: JSON.stringify(
16+
{"username": config.slackBotUser
17+
"text": "New post: <#{article.link}|#{article.title}>"
18+
"icon_url": config.slackIcon})
19+
headers:
20+
"Content-Type": "application/json"
21+
22+
watcher.run (error, articles) ->
23+
console.log "Started watching rss feed."

0 commit comments

Comments
 (0)