mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
ADD: Telegram bot as notification provider
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user