Right click context menu inject timestamp msg

I often need to prod a node as part of testing or a one off trigger.
Mostly to do this I'm adding an inject node, wiring it up, deploy then press the inject node to fire it, then remove it and deploy again. For sure this is most definitely a first world problem....

I think it would be great to have a right click context option to fire a timestamp inject to any input node connector...!

Simply hover the mouse over left side connector of any node, right click and select 'Inject'.
Perhaps the default is a timestamp, but maybe make this configurable?

1 Like

I see it more as a utility rather than a built-in feature - I believe it's doable with a plugin.

The idea would be to configure the default message in the sidebar and trigger the action by clicking on the link and... I don't really know.

I would add an option: yours allows to send a message and I would like to add a kind of box that hangs on the wire and listens for messages (the message can be displayed in the sidebar).

This principle exists when monitoring PLCs - the mouse looks like a kind of arrow that we are going to click on a wire to see status. Maybe @Steve-Mcl sees what I mean

Do plug-ins allow for the creation of context sensitive menu options? Perhaps the function could be an integration, maybe, but the action to fire it needs to be seamless, hence the suggestion of it being in the right click context menu....

There is a node:

May work for you.

Put it at critical points in your flows.
Then if/when you need to test, it is there.

Thanks, but I'm after a facility that does not require additional nodes being added.

It already exists :exploding_head:, all that remains is to add a section allowing to trigger a message.

@knolleary, next feature: inject message :star_struck:

You can set / change the test msg and hit inject now
without the need to Deploy each time

ps. You still need an Inject node though


Hi @dougle03,

I am not an expert on this, but going to give some information because I find your question both interesting and useful.

I "think" this are in fact two separate feature requests, but I might be fully mistaken:

  1. Ability to show custom menu items in the contextmenu via a plugin. Because I don't see any plugin related in the contextmenu code. You can only hide or show the contexmenu.

    It would indeed be a very useful plugin mechanism, because all the software I use (which support plugins) all allow the plugins to add menu items.

  2. Ability to inject a message to a wire instead of into a node. I "think" this is currently not possible. Because when I look at the code of the Inject node's "Inject now" button, it calls the server-side to inject the message into the (Inject) node and not into a wire.

    Imho this again would be very useful, like e.g. as mentioned by others to be used in the node-red-debugger. Although I have no idea what the impact of the second one would be on the flow runtime behaviour.

Like always you could start hacking to show a custom menu in the contextmenu, but I think that would be a bad idea because it looks dirty & has performance impact & might break with a feature version of Node-RED! You could do that by observe the document body in the plugin and add your custom menu item as soon as the contextmenu is being displayed:

    let callback = function(mutationsList, observer) {
        for(let mutation of mutationsList) {
            if (mutation.type === 'childList') {
                for(let node of mutation.addedNodes) {
                    // When the contextmenu is created (i.e. added to the html body of the flow editor)
                    if(node.id === 'red-ui-workspace-context-menu'){
                        const selection = RED.view.selection()
                        const wireLinks = (selection.links && selection.links.filter(e => !e.link)) || [];

                        // Only add the custom menu item when 1 wire has been selected
                        if (wireLinks.length === 1) {
                            let menuLabel = 'Inject message';

                            // Append a custom menu item "Inject message" to the contextmenu
                            let html = '<li><a id="red-ui-menu-item-57" tabindex="-1" href="#"><span class="red-ui-menu-label"><span>' + menuLabel + '</span></span></a></li>';
                            $liElement = $(node).append(html);

                            $liElement.on('click', 'li', function() {
                                // Put your code here to do something
                                alert('Your custom menu item has been clicked');

    // Start observing the immediate child elements of the document body
    var observer = new MutationObserver(callback);
    observer.observe(document.body, { childList: true });

Which will only show your custom menu item if 1 wire has been selected:

custom menu item

But again: I created quickly this code snippet only out of technical interest. But it will not be performant to observe the DOM, so I would NOT do it this way!

Hopefully your feature requests will be accepted, so developers can add stuff like this in a clean way.

BTW For people that don't like custom context menu items: simply don't install the plugin :wink:


Wires can’t have properties, and you can’t inject to a wire. Luckily the original request is to inject into the input port of a node.

Hard part I see is how to make the input easily customisable as most nodes need more than a simple timestamp injected. And even if you do that, do you have to set it per node ? Or just once globally, and then have to change it for each place you want to inject. Becomes more a simple right click each time imho.


Ah ok, I had overlooked that. Thanks for the clarification!

It looks - to me at least- that you need to show the screen of an inject node, with some of the buttons invisible (i e. only the " Inject now" button)...

thanks for the that, hadn't noticed it before but extremely useful.

I was going to say that "inject now" combined with the quick connect feature of 3.1.x and the OP has their solution but ....


there is a deploy inbetween :frowning:

rename it to "deploy & inject now" and we have it! :wink:

The whole point was NOT to deploy so thanks but no thanks ! :pray:

1 Like

So the idea is to simulate flow execution BEFORE doing a deploy?

In that case, take the in-browser static version of Node-RED --> https://cdn.flowhub.org --> import flow there and nothing can happen.

You can simply deploy before opening and editing the inject rules.

Sure but I think it's about being faster than Lucky Luke - i.e. the deploy (Ctrl-D) is one step too much.

Either way, I was just trying to find a sensible workable compromise for the original question...


Drag wire, press ctrl , press return, press ctrl d. Not really that much slower. The dragging the wire is most probably the bottle neck operation.

[edit] If there was a shortcut action press selected node button, it would be a very quick operation to inject a timestamp msg.

This is why I proposed the idea of the plugin - the request being linked to development, the injection option should not be found directly in the NR core but added (to the core) from a plugin.

The message parameters must be easily modifiable - only the sidebar allows this.

As mentioned above, there is already a (debugger) plugin allowing to see messages in a desired position (this is more my addition of the request than the one wanted here), all that is missing is message injection.

It's entirely possible to do and it will be just as simple to use - just need to add a plugin.

1 Like

I think that the idea of being able to inject to a non-deployed flow is very uncertain. Do we have any idea of the impact on existing nodes? Why would we have any expectation that nodes would behave correctly if not deployed?

On the other hand, having a more dynamic inject mechanism to be able to inject a message into a deployed flow without an extra deploy - that seems sensible and should be doable surely? Since all that is needed is a way to form a msg object and inject. The first part is fairly simple web form and JS - and possibly mostly already exists in the HTML for the Inject node (and as I've discovered recently, it isn't hard to separate out the parts of the node's Editor HTML into separate files and make them reusable). The 2nd part, I suspect, already exists in the core code.

That's the inject now button on the inject node that you describe - if the inject node is deployed, then inject node will dynamically - without further deployment - insert new messages into the flow.

Having played around with the static version of Node-RED, I can tell you that's it's completely doable. You can navigate throughout the entire flow in the frontend - how? see this code - that basically simulates a flow execution purely in the frontend.

The issues arise when code in the frontend hasn't been deployed but is run in the frontend, then you mileage starts varying.

For me, this is starting to sound like "simulation mode" within Node-RED: I simulate the execution of the flow purely in the frontend. I would also not put this into the core of Node-RED since it's extremely confusing for any type of user. Plus: Node-RED is not a dashboard! :wink:

1 Like

It is to be able to inject without having to deploy the inject node, it is not possible to trigger another non-deployed node.

The plugin exists, just need to add an HTML part (like a button/shortcut or something else on the node input) which sends a request to the runtime and it is the latter which triggers the flow - no need for more code, it's quite simple to do. Just see with Nick how to set it up

Exactly, it's a debugging tool so let's put it in its place

1 Like