Blogs

Part 2: Add Telegram Integration to Your Node-RED IoT Dashboard

 

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?

Hire Us on UpWork


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

  1. Open Telegram and search for BotFather in the search bar
  2. Send the command /newbot
  3. Choose a name and username (must end in bot)
  4. You’ll get a token like:
    123456789:AAH...YourBotTokenHere
    Save this — it connects Node-RED to your bot
  5. Click the link to your bot and press Start

Step 2: Install Telegram Nodes in Node-RED

  1. Go to Node-RED → ☰ menu → Manage palette
  2. Click the Install tab
  3. Search for: node-red-contrib-telegrambot
  4. Click Install

Step 3: Update Your Flow

Here is an updated flow from part 1.

  1. Drag in these nodes:
    • telegram receiver
    • 2 function nodes (label them as you like)
    • telegram sender
  2. 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;
  3. 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

  1. Deploy the new Node-RED application by clicking Deploy.
  2. Open your bot in Telegram
  3. Send: status
  4. 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:

UpWork


Watch More on My YouTube Channel

We also post tutorials and hands-on videos covering Node-RED, Raspberry Pi, ESP32, and microcontroller projects.

@mmshilleh on YouTube

Thanks for following along! Stay tuned for Part 3.

Create a free account to access full content.

All access to code and resources on ShillehTek.

Signup Now

Already a member? Sign In

Need Project Support?