Read the statement by Michael Teeuw here.
Telegram Bot
-
Hey.
After I experimented with the Google Hangoutsbot for a while, I am now at the Telegrambot. Currently my telegrambot sends me a simple message if the CPU temperature is too high. For this I ‘quickndirty’ inserted a few lines of code into the forked MMM-SystemStats module:
var url="https://api.telegram.org/bot[BOT-TOKEN]/sendMessage?chat_id=[CHAT-ID]&text=CPU%20zu%20warm%20"; var method = "POST"; var postData = "Some data"; var async = true; var request = new XMLHttpRequest(); request.onload = function () { var status = request.status; // HTTP response status, e.g., 200 for "200 OK" var data = request.responseText; // Returned data, e.g., an HTML document. } request.open(method, url, async); request.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); request.send(postData);
It would be great if, for example, also MMM-Syslog, MMM-PIR or MMM-NetworkScanner sends messages, as good as centrally via a Telegram module.
For example https://github.com/enricostara/telegram.link or https://github.com/yagop/node-telegram-bot-api.
Thank you.
-
I’ve updated the MMM-SystemStats module on github.
Now the request is sent by nodehelper.js.request({ url: 'https://api.telegram.org/bot' + this.config.botToken + '/sendMessage?chat_id=' + this.config.chatID + '&text=' + encodeURI(payload.message), method: 'POST' }, function(error, response, body) { console.log("TG with response " + response.statusCode);
It is not a separate module, but it works.
-
@clubbi maybe you could implement this in a separate module, implementing sendNotification / notificationReceived ?
-
-
@ryck
Currently, I do not have much time, but I’ll keep it in mind.@cowboysdude
ah, ok. thanks.