Node-Red Twitter Bot

I have setup a new Node-Red Twitter Bot. This is powered by a Raspberry Pi 4 Model B (2GB) that I have setup as the new Pi Lab Node Red Node.

The Node-Red flow was originally setup to provide a URL endpoint that accepts a minimal number of query parameters (e.g. hostname). The flow would then make http requests to the Pi Lab Metric's Node that is powered by Prometheus to retrieve the metrics. The metrics were then formatted and pushed directly to the Pi Lab Twitter feed.

I am now on version 4 of the flow. The latest iteration is completely self contained inside Node-Red. The flow runs every 30 minutes and does ping checks to ensure that the nodes are online before gathering the metrics for each node and sending out tweets. This allows me to reduce the overhead for each of the nodes in the Pi Lab cluster and have things more centralized.

I have also added an SMS alert node that, after a failed ping check, sends an email that is then forwarded via text message to my mobile phone using this AT&T feature.

Below is a screenshot of the flow.



I am very impressed with Node-Red. I definitely recommend it for anyone who enjoys coding and automation.

Get it on GitHub

Updates:

Thanks to some great feedback from r/nodered I have re-factored the flow to use the join node so I can remove the use of flow variables. This should fix the issues I was seeing when a request to the flow would occur before the previous request had completed.

I have added a new flow that tweets the current BOINC Node Rosetta@home stats. This flow is setup to be completely powered by Node-Red and is run on a 30 minute interval.

I have updated this blog post with the latest information on this project.

I have added Node CPU temperature checks to alert me if a node has exceeded a configurable threshold.

I have added a new flow that tweets the current average web stats from the Pi Lab Statcounter account.

I have updated the flow to have better formatting of the message payload.

I have added a new flow that tweets a JPEG snapshot of the Pi Lab Live Stream every 30 minutes.

I have added a Current Date/Time node to ensure that the Tweets are unique.

Posted on