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.

I have downgraded the Node-RED Node to a Raspberry Pi 3 Model B and repurpsed the original Node-RED Node into a Pi Lab Web Cluster production node.

I have moved the ping checks to Uptime Kuma that I have setup on another server on my network. It uses IFTTT for the notifications which is much better than the AT&T SMS method. I have also updated the Twitter Bot to use IFTTT for the temperature checks.

I have upgraded to Node-RED v3. I ran into a few issues during the upgrade. Read more

Twitter has suspended the Pi Lab Twitter account. They didn't give any specific reason. Not going to put any effort into fixing it since Twitter is a total dumpster fire at this point.

I have moved my Node-RED node to an LXC container running in Proxmox.

Posted on