Can the properties of a node be changed programatically?

I am trying to send notifications using node-red-contrib-telegrambot. This module requires setting bot name, token, user ID, and name (optional) beforehand.

I understand that the bot can get the user ID and name from the message sent to it. But, is there a way to set bot name, token, and User ID programmatically. Say, from input text boxes on the UI?

Not at runtime unless the developer added such capabilities.

However, you can use env vars to set the value of a text field.

Thank you.

If not at runtime, setting and restarting the flow should also be fine as long as it is from UI, not from the editor.

Can you give an example of how I can use env vars to set properties from text field?

see docs - Using environment variables : Node-RED

I tried:
export some_var=123 in terminal

and tried to read it as explained in the docs. But it returns empty. Also, I tried export some_var=123 inside exec node just in case if nodered was on different environment. It still results empty.

[
    {
        "id": "d17299e5.9ff148",
        "type": "tab",
        "label": "Flow 5",
        "disabled": false,
        "info": ""
    },
    {
        "id": "d66f687a.d01248",
        "type": "change",
        "z": "d17299e5.9ff148",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "some_var",
                "tot": "env"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 380,
        "y": 140,
        "wires": [
            [
                "67cb1bc6.0b3724"
            ]
        ]
    },
    {
        "id": "578fe08e.8f056",
        "type": "inject",
        "z": "d17299e5.9ff148",
        "name": "",
        "props": [
            {
                "p": "payload",
                "v": "",
                "vt": "date"
            },
            {
                "p": "topic",
                "v": "",
                "vt": "string"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 140,
        "wires": [
            [
                "d66f687a.d01248"
            ]
        ]
    },
    {
        "id": "67cb1bc6.0b3724",
        "type": "debug",
        "z": "d17299e5.9ff148",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 580,
        "y": 140,
        "wires": []
    },
    {
        "id": "0a79e7b4cbf4e1cb",
        "type": "exec",
        "z": "d17299e5.9ff148",
        "command": "export some_var=123",
        "addpay": "",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 400,
        "y": 80,
        "wires": [
            [
                "a67d205f48f957c7"
            ],
            [],
            []
        ]
    },
    {
        "id": "48b8a588201d86de",
        "type": "inject",
        "z": "d17299e5.9ff148",
        "name": "",
        "props": [
            {
                "p": "payload",
                "v": "",
                "vt": "date"
            },
            {
                "p": "topic",
                "v": "",
                "vt": "string"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 80,
        "wires": [
            [
                "0a79e7b4cbf4e1cb"
            ]
        ]
    },
    {
        "id": "a67d205f48f957c7",
        "type": "debug",
        "z": "d17299e5.9ff148",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 590,
        "y": 80,
        "wires": []
    }
]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.