Part 2: Add Telegram Integration to Your Node-RED IoT Dashboard
Welcome back! In Part 1, we built a real-time dashboard that displayed live temperature and pressure data from a BMP180 sensor using Arduino and Node-RED.
In this Part 2 tutorial, we’ll take it up a notch by integrating Telegram with your dashboard. After this, you’ll be able to send your bot a simple message like status
, and it will reply instantly with the latest readings. It’s a lightweight, secure, and mobile-friendly way to access your sensor data anytime, anywhere.
Need help building dashboards or automating sensor networks?
What You’ll Add
- A Telegram bot that responds to live commands
- Command:
status
returns temperature and pressure - Secure mobile integration with your Node-RED flow
Step 1: Create a Telegram Bot
- Open Telegram and search for BotFather in the search bar
- Send the command
/newbot
- Choose a name and username (must end in
bot
) - You’ll get a token like:
Save this — it connects Node-RED to your bot123456789:AAH...YourBotTokenHere
- Click the link to your bot and press Start
Step 2: Install Telegram Nodes in Node-RED
- Go to Node-RED → ☰ menu → Manage palette
- Click the Install tab
- Search for:
node-red-contrib-telegrambot
- Click Install
Step 3: Update Your Flow
Here is an updated flow from part 1.
- Drag in these nodes:
telegram receiver
-
2 function
nodes (label them as you like) telegram sender
- Paste this code into the function node between the sender and the receiver:
let cmd = msg.payload.content.toLowerCase(); if (cmd === "status") { let temp = flow.get("latestTemp") || "N/A"; let pressure = flow.get("latestPressure") || "N/A"; msg.payload = { chatId: msg.payload.chatId, type: "message", content: `🌡️ Temp: ${temp} °C\n🌬️ Pressure: ${pressure} hPa` }; return msg; } return null;
- Make sure earlier in your flow, you're storing the latest values. You can attach the other function node after the JSON node to store the values with the following function:
flow.set("latestTemp", msg.payload.temp); flow.set("latestPressure", msg.payload.pressure); return msg;
Step 4: Test It
- Deploy the new Node-RED application by clicking Deploy.
- Open your bot in Telegram
- Send:
status
- You should get:
🌡️ Temp: 25.3 °C 🌬️ Pressure: 1012.9 hPa
Why This Matters
This gives you real-time monitoring from your phone — no VPN, no cloud needed. You can also expand this with commands like set alert
, turn on light
, or log values over time.
Whether you’re doing smart agriculture, home automation, or industrial monitoring, Telegram bots + Node-RED is a powerful combo.
Work With Us
W help businesses and makers build reliable IoT systems using tools like Node-RED, MQTT, Raspberry Pi, Arduino, and custom dashboards.
If you want help setting up something like this — or want to take your automation to the next level — get in touch here:
Watch More on My YouTube Channel
We also post tutorials and hands-on videos covering Node-RED, Raspberry Pi, ESP32, and microcontroller projects.
Thanks for following along! Stay tuned for Part 3.