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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login