ADD: Telegram bot as notification provider

This commit is contained in:
Christian Kellner
2018-02-06 13:57:32 +01:00
parent 97d7ba7f9a
commit f0d9c0cb00
9 changed files with 579 additions and 23 deletions

View File

@@ -7,11 +7,11 @@ const {token, channel} = config.notification.slack;
/**
* sends a new listing to slack
* @param serviceName e.g immoscout
* @param payload the actual payload that is used to construct the message
* @param newListings an array with newly found listings
* @returns {Promise<Chat.PostMessage.Response> | void}
*/
exports.send = (serviceName, payload) => {
return msg({
exports.send = (serviceName, newListings) => {
return newListings.map(payload => msg({
token,
channel,
text: `*(${serviceName})* - ${payload.title}`,
@@ -42,7 +42,7 @@ exports.send = (serviceName, payload) => {
ts: new Date().getTime() / 1000
}
]
}
})
);
};
@@ -50,5 +50,5 @@ exports.send = (serviceName, payload) => {
* each integration needs to implement this method
*/
exports.enabled = () => {
return config.notification.slack.enabled;
return config.notification.slack.enabled;
};