This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add notifiers: slack, ifttt, xmpp, pushbullet (#595)
- Loading branch information
Showing
14 changed files
with
352 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
# zenbot extensions | ||
|
||
To support various exchanges or strategies, zenbot "extensions" can be made. | ||
To support various exchanges, strategies or notifiers, zenbot "extensions" can be made. | ||
This is a directory with a `_codemap.js` at root, which zenbot will scan and add to the codebase. | ||
Zenbot comes with `gdax` exchange and `trend_ema_rate` strategy as built-in (example) extensions, but other extensions | ||
can live in external git repos and be cloned, dropped or symlinked here. | ||
|
||
You may have to `npm install` in the extension directory, and/or copy and configure `conf-sample.js` to `conf.js` for it to work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
_ns: 'zenbot', | ||
|
||
'notifiers.ifttt': require('./ifttt'), | ||
'notifiers.pushbullet': require('./pushbullet'), | ||
'notifiers.slack': require('./slack'), | ||
'notifiers.xmpp': require('./xmpp') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var request = require('request') | ||
|
||
module.exports = function container (get, set, clear) { | ||
var ifttt = { | ||
pushMessage: function(config, title, message) { | ||
var postData = {'value1': title , 'value2': message } | ||
|
||
function callback(error) { | ||
if (error) { | ||
console.log('Error happened: '+ error) | ||
} | ||
} | ||
|
||
var options = { | ||
method: 'POST', | ||
url: 'https://maker.ifttt.com/trigger/' + config.eventName + '/with/key/' + config.makerKey, | ||
json: postData | ||
} | ||
|
||
request(options, callback) | ||
} | ||
} | ||
return ifttt | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var pusher = require('pushbullet') | ||
|
||
module.exports = function container (get, set, clear) { | ||
var pushbullet = { | ||
pushMessage: function(config, title, message) { | ||
var pb = new pusher(config.key) | ||
pb.note(config.deviceID, title, message, (err) => { | ||
if (err) { | ||
console.log('error: Push message failed, ' + err) | ||
return | ||
} | ||
}) | ||
} | ||
} | ||
return pushbullet | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var IncomingWebhook = require('@slack/client').IncomingWebhook | ||
|
||
module.exports = function container (get, set, clear) { | ||
var slack = { | ||
pushMessage: function(config, title, message) { | ||
var slackWebhook = new IncomingWebhook(config.webhook_url || '') | ||
|
||
slackWebhook.send(title + ': ' + message, function (err) { | ||
if (err) { | ||
console.error('\nerror: slack webhook') | ||
console.error(err) | ||
} | ||
}) | ||
} | ||
} | ||
return slack | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var simplexmpp = require('simple-xmpp') | ||
|
||
module.exports = function container (get, set, clear) { | ||
var xmpp = { | ||
pushMessage: function(config, title, message) { | ||
simplexmpp.connect({ | ||
jid : config.jid, | ||
password : config.password, | ||
host : config.host, | ||
port : config.port | ||
}) | ||
|
||
simplexmpp.send(config.to, title + ': ' + message) | ||
|
||
simplexmpp.disconnect() | ||
} | ||
} | ||
return xmpp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.