Set a workflow as "Test/Development Mode"

I just started using n8n and have been enjoying the tool :slight_smile:

I created a flow that sends push notifications to users that met specific conditions, but I’d like to be able to control the destination of those pushes, ie: send to a test group or the production database.

The way I solved this was by setting a variable at the beginning of the flow and using it to branch into production or “test mode” (or debug as I called here).

I’m wondering if there is a better way to achieve this behavior.
For example, I searched for workflow variables that could indicate it was started manually, that would be an indicator that I’m testing.

Thanks for any idea / suggestions.

Hey @arjones!

Welcome to the community :slightly_smiling_face:

You can check if the workflow was executed manually or through the trigger using the $ variable. You can read more about it on our documentation.

1 Like

With the next version you will also be able to get the exact mode via $mode in expressions and Function-Nodes.


Thanks @harshil1712! I saw this variable but my understood was it would tell me if the workflow was active or not, and not how it was been executed (manual vs. scheduled).
I’ll try it out.

Yes you are totally right. But because manual executions have currently always “active” set to false does it currently work for what you want to do until the next version got released.

1 Like

Got released with [email protected]

1 Like