Automator - Message, Flow, & Global Objects | MUSE
In this video, we break down the differences between message, flow, and global objects in MUSE Automator and how each helps manage data in your projects. You’ll learn how the msg object handles temporary, real-time data as it moves through a flow, while flow and global contexts provide persistent storage for broader use. Through practical examples, we’ll demonstrate when to use each object type and how their behavior differs across flows. By the end, you’ll clearly understand how to manage data efficiently and build more scalable automation logic.
What You’ll Learn:
• Understanding message (msg), flow, and global objects in Automator
• Using the msg object for real-time data handling within flows
• Leveraging flow and global contexts for persistent data storage
• Differences in scope and lifespan between object types
• Practical examples of when to use each object
• Managing data efficiently across multiple flows
• Building scalable and organized Automator projects
Hello, and welcome to this video on using the message, flow, and global objects in Muse Automator as well as the context data tab to view them. In this video we will give a practical explanation of each, how they differ, and when to use each type.
We will begin with the message object. M-S-G (or message) is a JavaScript object that travels from node to node in a flow. It is short‑lived, moving data. The msg object exists only while the message is moving from node to node, each node gets its own copy, and it is destroyed after the flow finishes.
Common uses of the message object would include data being processed right now, values that need a single execution, and passing values between nodes.
Next, we will talk about Flow context. Flow is shared memory for a single flow, think of it as variables shared by all nodes on a single tab. Flow variables are not visible to other tabs, and they persist across multiple messages.
Some common uses of flow context would include flow specific logic, values that must persist between messages, and states shared within one flow.
Lastly, we will talk about Global context. Global is application‑wide shared memory, they are variables shared by all flows. They are accessible from any flow, any node, and persists across all messages.
Some common uses of global context would include data used across multiple flows and central configuration.
Let’s look at some examples. In the first example, we have an Inject node that sends msg.payload containing “Hello World” and then a Change node that changes the msg.payload to “12345”. When we trigger the Inject node, we can see the current value of msg.payload at each step of the flow by using the debug section of the sidebar. Once the message reaches the end of the flow, it is destroyed and can no longer be used.
In the next example, we are using the same Inject node but in this case the Change node is setting flow.test1 to the values of “123”. When we trigger the inject on this flow you will notice that the msg.payload of “Hello World” makes it to the end of the flow, because it was not modified by the change node. If we change the sidebar over to the Context Data option and refresh the Flow section, we will now see that we have ‘test1’ with a value of “123”. This is now stored and can be used again in this flow.
The next example is like the previous, but we are using the Change node to set global.testing to a value of “Testing123”. When we trigger this flow, we will see our msg.payload passed through to the end and if we refresh the Global section of our Context sidebar, we see that testing with a value of Testing123 has been stored.
Now let’s select the Flow 2 tab. You will notice that in the context sidebar our flow section is empty but our global section is still populated with testing. This is because flow context only exists in the Flow in which it was created where global context can be accessed from anywhere in the project.
We can use the inject node on Flow 2 to set flow.test1 to a value of “ABC”. If we change back to our Flow 1 tab you will see that the flow context data changes depending on the flow that is selected where the global context data stays the same regardless of which flow is selected.