How use Execute Workflow on cloud

Hi!

First of all: I am using n8n on the cloud, and I am new here.

I have written a workflow that listens to a webhook for my Slack Commands, and verifies the signature.
From this workflow I’d like to “switch” and execute other workflows depending on what command was sent.

  • Is it possible to use the Execute Workflow on the cloud app?
  • How is it supposed to work?
  • How do I test run it? Do both workflow have to be in test mode or can the initial one be activated in production whereas it triggers other workflows in test mode?

My other option would be to create a unique workflow and webhook url for each command, but that would mean that I have to copy paste Slack signature verification stuff into each flow.

Thanks for any insight and other suggestions!
/Einar


Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": ***REDACTED***,
        "responseMode": "responseNode",
        "options": {
          "rawBody": true
        }
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        380,
        420
      ],
      "webhookId": ***REDACTED***
    },
    {
      "parameters": {
        "action": "hmac",
        "type": "SHA256",
        "value": "=v0:{{$node[\"Webhook\"].json[\"headers\"][\"x-slack-request-timestamp\"]}}:{{$node[\"Move Binary Data\"].json[\"raw_data\"]}}",
        "dataPropertyName": "my_signature",
        "secret": ***REDACTED***
      },
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        980,
        420
      ]
    },
    {
      "parameters": {
        "setAllData": false,
        "destinationKey": "raw_data",
        "options": {}
      },
      "name": "Move Binary Data",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        800,
        420
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$node[\"Webhook\"].json[\"headers\"][\"x-slack-signature\"]}}",
              "value2": "=v0={{$node[\"Crypto\"].json[\"my_signature\"]}}"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1160,
        420
      ]
    },
    {
      "parameters": {
        "errorMessage": "Invalid signature!"
      },
      "name": "Stop And Error",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1380,
        580
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=You wrote: {{$node[\"Webhook\"].json[\"body\"][\"command\"]}} {{$json[\"body\"][\"text\"]}}",
        "options": {}
      },
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        600,
        420
      ]
    },
    {
      "parameters": {
        "source": "url",
        "workflowUrl": ***REDACTED***
      },
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1,
      "position": [
        1380,
        360
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move Binary Data": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Stop And Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook": {
      "main": [
        [
          {
            "node": "Move Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hey @einarpersson, welcome to the community!

You can use the Execute Workflow node on cloud, but you might want to go for the “Database” source option. This would simply require the ID of your workflow.

So if the workflow you want to execute has a URL of https://yourusername.app.n8n.cloud/workflow/1285, simply copy the 1285 from the URL:

This would be the value to use in the Workflow ID field of the Execute Workflow node:

Hope this helps!

Okey, done!

But how do I consume the data in the second workflow (B)?
Right now (B) is just an empty Start-node. I cannot “activate” it.
When I run my initial workflow (A) nothing happens in (B).

If I press “Execute workflow” in (B) it just finishes. If I open the Start node I don’t see any data.

What am I missing?

Ah, now when I entered B and looked at “Executions” I see a successful execution, with the correct data. So the linking seems to work.

Is there any way to “transfer” this production data so that it is available in the workflow builder (as when using test data)?

As I explained earlier, my idea is to have a stable Slack verification workflow (i.e. should be in prod and active) but I might want to develop new sub-workflows (B) and have sample data available.

Any Ideas if /how I can do this conveniently?

So data will get passed on to the Start node of the sub-workflow as you have noticed, but unfortunately this data is not available when building your workflow later (though I know something along those lines is planned for the future).

For now, while building your sub-workflow I’d suggest you mock the data structure your parent workflow would later pass on in production mode.

This can be done like so:

When looking at the previous execution data, select the JSON structure and copy the value using the button in the upper right (appearing after selecting):

You can then (temporarily) add a Function node to your sub-workflow and have it return the data copied in the previous step:

Now you can run this Function node whenever you need some sample data (and just disable it once your workflow is ready to go into production mode). Hope this makes sense and helps!

Alright, thanks, I’ll try that!

(and sounds good that this is on the radar for future development)