Skip to main content

telegram

Send and receive messages via Telegram Bot API for instant notifications.

Overview

The telegram node integrates with the Telegram Bot API for instant messaging. Send alerts, receive commands, share photos and documents. Perfect for mobile notifications and remote control.

Bot
API
Instant
Delivery
Media
Support
2-Way
Communication

Properties

Property Type Default Description
botToken string - Bot token from @BotFather
chatId string - Default chat/group ID
mode string "send" send, receive, or both
parseMode string "Markdown" Markdown, MarkdownV2, HTML
polling boolean true Enable polling for incoming messages

Message Types

Text Message

{
  "payload": "Hello from EdgeFlow!",
  "chatId": "123456789"
}

Photo

{
  "type": "photo",
  "payload": buffer_or_url,
  "caption": "Camera snapshot"
}

Document

{
  "type": "document",
  "payload": buffer,
  "filename": "report.pdf"
}

Location

{
  "type": "location",
  "latitude": 51.5074,
  "longitude": -0.1278
}

Bot Setup Guide

1

Create a Bot

Message @BotFather on Telegram and send /newbot

2

Get Bot Token

Copy the token (looks like: 123456:ABC-DEF1234...)

3

Get Chat ID

Message your bot, then visit: https://api.telegram.org/bot[TOKEN]/getUpdates

4

Configure Node

Paste the token and chat ID into your EdgeFlow node

Example: Sensor Alert with Inline Keyboard

Send interactive alerts with action buttons.

// Function node: Create alert with buttons
var sensor = msg.payload.sensor;
var value = msg.payload.value;

msg.payload = `🚨 *Alert: ${sensor}*

Value: `${value}`
Time: ${new Date().toLocaleString()}`;

msg.options = {
    parse_mode: "Markdown",
    reply_markup: {
        inline_keyboard: [
            [
                { text: "✅ Acknowledge", callback_data: "ack_" + sensor },
                { text: "🔇 Mute 1h", callback_data: "mute_" + sensor }
            ],
            [
                { text: "📊 View Dashboard", url: "https://edgeflow.local/dashboard" }
            ]
        ]
    }
};

return msg;

Receiving Commands

Handle incoming messages and commands from users.

// Switch node: Route commands
// Property: msg.payload.text

// /status → Output 1
// /restart → Output 2
// /report → Output 3
// default → Output 4

// Function node: Handle /status command
if (msg.payload.text === "/status") {
    msg.payload = "✅ *System Status*
" +
                  "• CPU: 45%
" +
                  "• Memory: 2.1GB/4GB
" +
                  "• Uptime: 14 days";
    msg.chatId = msg.payload.chat.id;
    return msg;
}

Related Nodes