[{"data":1,"prerenderedAt":273},["ShallowReactive",2],{"node-red-\u002Fnode-red\u002Fcore-nodes\u002Finject":3},{"id":4,"title":5,"body":6,"description":265,"extension":266,"meta":267,"navigation":268,"path":269,"seo":270,"stem":271,"__hash__":272},"nodeRed\u002Fnode-red\u002Fcore-nodes\u002Finject.md","Node-RED - Inject Node",{"type":7,"value":8,"toc":243},"minimark",[9,14,18,23,26,30,33,38,41,45,48,52,55,59,68,72,84,87,109,112,116,120,123,128,132,135,138,142,145,148,152],[10,11,13],"h1",{"id":12},"inject","Inject",[15,16,17],"p",{},"Triggers flows by injecting messages manually or automatically.",[19,20,22],"h2",{"id":21},"where-and-why-do-we-use-the-inject-node","Where and why do we use the Inject node?",[15,24,25],{},"The Inject node starts flows either manually by clicking the button on its left side or automatically on a schedule. This makes it essential for testing and debugging flows, triggering automated tasks, initializing system state on startup, or running periodic data processing jobs. It's often the first node in a flow, providing the initial message that kicks off the entire process.",[19,27,29],{"id":28},"modes-of-operation","Modes of operation",[15,31,32],{},"The Inject node can trigger flows in several different ways:",[34,35,37],"h3",{"id":36},"manual-trigger","Manual Trigger",[15,39,40],{},"Click the button on the left side of the node to send a message on demand. This is the most common mode for testing, debugging, or manually initiating processes. The message can contain any configured payload and properties.",[34,42,44],{"id":43},"on-startup","On Startup",[15,46,47],{},"Configure the node to inject a message automatically when Node-RED starts or when flows are deployed. This is useful for initializing flow state, setting default values, or starting background processes. You can add a delay before the injection occurs. When configured to inject once on start, a small '1' appears after the label inside the node.",[34,49,51],{"id":50},"interval","Interval",[15,53,54],{},"Send messages repeatedly at a fixed time interval. Set the interval in seconds, minutes, hours, or days. The interval must be greater than 1 and less than 2^31. When the repeat value is 0 or below, Node-RED will not display an error but the interval won't function.",[34,56,58],{"id":57},"scheduled","Scheduled",[15,60,61,62,67],{},"Inject messages at specific times using cron-like scheduling. This allows complex schedules like \"every Monday at 9am\" or \"the first day of each month at midnight\". Make sure to set the correct timezone in the ",[63,64,66],"a",{"href":65},"\u002Fdocs\u002Fuser\u002Finstance-settings\u002F#editor","editor settings",".",[19,69,71],{"id":70},"how-the-node-handles-messages","How the node handles messages",[15,73,74,75,79,80,83],{},"The Inject node creates a new message object with configured properties. By default, it sets ",[76,77,78],"code",{},"msg.payload"," to the current timestamp and ",[76,81,82],{},"msg.topic"," to an empty string, but you can configure any message properties.",[15,85,86],{},"Message properties can be set to:",[88,89,90,94,97,100,103,106],"ul",{},[91,92,93],"li",{},"Static values (strings, numbers, booleans, JSON objects)",[91,95,96],{},"Flow or global context variables",[91,98,99],{},"Environment variables",[91,101,102],{},"JSONata expressions for dynamic values",[91,104,105],{},"Current timestamp",[91,107,108],{},"Empty values",[15,110,111],{},"The node can set multiple message properties at once, allowing you to construct complete message objects that subsequent nodes need.",[19,113,115],{"id":114},"examples","Examples",[34,117,119],{"id":118},"inject-on-node-red-start","Inject on Node-RED start",[15,121,122],{},"To setup state when starting Node-RED, the inject node can be set to trigger a flow once with minimal delay. This example injects a timestamp immediately after deployment or restart.",[124,125],"render-flow",{":height":126,"flow":127},"200","W3siaWQiOiI3M2NjNTEwYmVlNjg2MDBmIiwidHlwZSI6ImluamVjdCIsInoiOiI4MDk4N2YyNzc4NTI0NWE3IiwibmFtZSI6IiIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOnRydWUsIm9uY2VEZWxheSI6IjAuMSIsInRvcGljIjoiIiwicGF5bG9hZCI6IiIsInBheWxvYWRUeXBlIjoiZGF0ZSIsIngiOjE5MCwieSI6MjAwLCJ3aXJlcyI6W1siN2Y4M2JmMjRiZGY3YmM2OCJdXX0seyJpZCI6IjdmODNiZjI0YmRmN2JjNjgiLCJ0eXBlIjoiZGVidWciLCJ6IjoiODA5ODdmMjc3ODUyNDVhNyIsIm5hbWUiOiJPdXRwdXQgb25jZSIsImFjdGl2ZSI6dHJ1ZSwidG9zaWRlYmFyIjp0cnVlLCJjb25zb2xlIjpmYWxzZSwidG9zdGF0dXMiOmZhbHNlLCJjb21wbGV0ZSI6InBheWxvYWQiLCJ0YXJnZXRUeXBlIjoibXNnIiwic3RhdHVzVmFsIjoiIiwic3RhdHVzVHlwZSI6ImF1dG8iLCJ4IjozNzAsInkiOjIwMCwid2lyZXMiOltdfV0=",[34,129,131],{"id":130},"run-a-flow-daily-at-midnight","Run a flow daily at midnight",[15,133,134],{},"By selecting \"at a specific time\" in the Repeat section, the inject node can generate a message at set times. This example triggers at 23:59 (11:59 PM) every day, useful for daily data processing tasks.",[124,136],{":height":126,"flow":137},"W3siaWQiOiI5OThlODQ0YTdlNTBlMjc1IiwidHlwZSI6ImluamVjdCIsInoiOiI4MDk4N2YyNzc4NTI0NWE3IiwibmFtZSI6IiIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IjU5IDIzICogKiAqIiwib25jZSI6ZmFsc2UsIm9uY2VEZWxheSI6IjAiLCJ0b3BpYyI6IiIsInBheWxvYWQiOiIiLCJwYXlsb2FkVHlwZSI6ImRhdGUiLCJ4IjoxOTAsInkiOjMyMCwid2lyZXMiOltbIjFlODBmNTIyOTUxNmU5MTAiXV19LHsiaWQiOiIxZTgwZjUyMjk1MTZlOTEwIiwidHlwZSI6ImRlYnVnIiwieiI6IjgwOTg3ZjI3Nzg1MjQ1YTciLCJuYW1lIjoiT3V0cHV0IGRhaWx5IGF0IG5pZ2h0IiwiYWN0aXZlIjp0cnVlLCJ0b3NpZGViYXIiOnRydWUsImNvbnNvbGUiOmZhbHNlLCJ0b3N0YXR1cyI6ZmFsc2UsImNvbXBsZXRlIjoicGF5bG9hZCIsInRhcmdldFR5cGUiOiJtc2ciLCJzdGF0dXNWYWwiOiIiLCJzdGF0dXNUeXBlIjoiYXV0byIsIngiOjQwMCwieSI6MzIwLCJ3aXJlcyI6W119XQ==",[34,139,141],{"id":140},"inject-a-static-string","Inject a static string",[15,143,144],{},"The Inject node can set the payload to static data like strings, numbers, or JSON objects. This example injects the string \"Hello FlowFuse!\" when triggered manually.",[124,146],{":height":126,"flow":147},"W3siaWQiOiJjMDQ1MWUxNGY2YjdlZmYwIiwidHlwZSI6ImluamVjdCIsInoiOiI4MDk4N2YyNzc4NTI0NWE3IiwibmFtZSI6IkluamVjdCBhIHN0cmluZyIsInByb3BzIjpbeyJwIjoicGF5bG9hZCJ9XSwicmVwZWF0IjoiIiwiY3JvbnRhYiI6IiIsIm9uY2UiOmZhbHNlLCJvbmNlRGVsYXkiOjAuMSwidG9waWMiOiIiLCJwYXlsb2FkIjoiSGVsbG8gRmxvd0Z1c2UhIiwicGF5bG9hZFR5cGUiOiJzdHIiLCJ4IjoxOTAsInkiOjI4MCwid2lyZXMiOltbIjlmYmQ4YTBhOWQyMTU2MmEiXV19LHsiaWQiOiI5ZmJkOGEwYTlkMjE1NjJhIiwidHlwZSI6ImRlYnVnIiwieiI6IjgwOTg3ZjI3Nzg1MjQ1YTciLCJuYW1lIjoiT3V0cHV0IFwiSGVsbG8gRmxvd0Z1c2VcIiIsImFjdGl2ZSI6dHJ1ZSwidG9zaWRlYmFyIjp0cnVlLCJjb25zb2xlIjpmYWxzZSwidG9zdGF0dXMiOmZhbHNlLCJjb21wbGV0ZSI6InBheWxvYWQiLCJ0YXJnZXRUeXBlIjoibXNnIiwic3RhdHVzVmFsIjoiIiwic3RhdHVzVHlwZSI6ImF1dG8iLCJ4Ijo0MTAsInkiOjI4MCwid2lyZXMiOltdfV0=",[19,149,151],{"id":150},"node-documentation","Node Documentation",[153,154,157,160,161,160,165,160,196,160,200,160,203,160,206,160,209,160,212,160,219,160,238],"div",{"className":155},[156],"core-node-doc",[15,158,159],{},"Injects a message into a flow either manually or at regular intervals. The message\npayload can be a variety of types, including strings, JavaScript objects or the current time."," ",[34,162,164],{"id":163},"outputs","Outputs",[166,167,170,180,184,193],"dl",{"className":168},[169],"message-properties",[171,172,173,174],"dt",{},"payload",[175,176,179],"span",{"className":177},[178],"property-type","various",[181,182,183],"dd",{},"The configured payload of the message.",[171,185,188,189],{"className":186},[187],"optional","topic ",[175,190,192],{"className":191},[178],"string",[181,194,195],{},"An optional property that can be configured in the node.",[34,197,199],{"id":198},"details","Details",[15,201,202],{},"The Inject node can initiate a flow with a specific payload value.\nThe default payload is a timestamp of the current time in millisecs since January 1st, 1970.",[15,204,205],{},"The node also supports injecting strings, numbers, booleans, JavaScript objects, or flow\u002Fglobal context values.",[15,207,208],{},"By default, the node is triggered manually by clicking on its button within the editor. It can also be set to\ninject at regular intervals or according to a schedule.",[15,210,211],{},"It can also be configured to inject once each time the flows are started.",[15,213,214,215,218],{},"The maximum ",[216,217,51],"i",{}," that can be specified is about 596 hours \u002F 24 days. However if you are looking at intervals\ngreater than one day you should consider using a scheduler node that can cope with power outages and restarts.",[15,220,221,225,226,229,230,233,234,237],{},[222,223,224],"b",{},"Note",": The ",[216,227,228],{},"\"Interval between times\""," and ",[216,231,232],{},"\"at a specific time\""," options use the standard cron system.\nThis means that 20 minutes will be at the next hour, 20 minutes past and 40 minutes past - not in 20 minutes time.\nIf you want every 20 minutes from now - use the ",[216,235,236],{},"\"interval\""," option.",[15,239,240,242],{},[222,241,224],{},": To include a newline in a string you must use the Function or Template node to create the payload.",{"title":244,"searchDepth":245,"depth":245,"links":246},"",2,[247,248,255,256,261],{"id":21,"depth":245,"text":22},{"id":28,"depth":245,"text":29,"children":249},[250,252,253,254],{"id":36,"depth":251,"text":37},3,{"id":43,"depth":251,"text":44},{"id":50,"depth":251,"text":51},{"id":57,"depth":251,"text":58},{"id":70,"depth":245,"text":71},{"id":114,"depth":245,"text":115,"children":257},[258,259,260],{"id":118,"depth":251,"text":119},{"id":130,"depth":251,"text":131},{"id":140,"depth":251,"text":141},{"id":150,"depth":245,"text":151,"children":262},[263,264],{"id":163,"depth":251,"text":164},{"id":198,"depth":251,"text":199},"Guide on the Node-RED core node that injects a message into a flow","md",{},true,"\u002Fnode-red\u002Fcore-nodes\u002Finject",{"title":5,"description":265},"node-red\u002Fcore-nodes\u002Finject","-5Ci37dEVScZjk-TsE9zhYqpv3VXrpAySUJuKulJERw",1780070555934]