Issue with subworkflow execution response when using a Wait for response

Describe the problem/error/question

Hey!
I’m trying to build a custom “Human in the loop” workflow using Zoho Cliq API.
I’ve 2 very basic workflows :

  • The first one is the subworkflow that send a message to Zoho Cliq and wait for approval using the “Wait” node
  • The second one is just a test to trigger the subworkflow and route the response

The subworkflow correctly waits for the webhook call of the Wait node.
But the output of the subworkflow is not correct.
It’s output is the input it received before calling the subworkflow…
When I inspect the subworkflow execution, the output is correct, so I don’t understand what I miss…

Do I made a mistake?
Or it is a bug?

What is the error message (if any)?

The output of the subworkflow node is not the output of the subworkflow execution.

Please share your workflow

A simplified version of the “Send and wait” subworkflow :

{
  "nodes": [
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a979de88-a00b-4cee-822b-fda8c14eddae",
              "name": "url",
              "value": "https://cliq.zoho.com/api/v2/bots/hamsterchef/message",
              "type": "string"
            },
            {
              "id": "733b9eb5-061b-4429-aa09-07293aa466b9",
              "name": "userids",
              "value": "={{ $json.userids }}",
              "type": "string"
            },
            {
              "id": "fbaf28f2-e234-4452-b983-f02405f10b36",
              "name": "text",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "bcfdf5d4-a917-4956-9ced-bd90922ed1a0",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -3072,
        -32
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $json.url }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json.removeField('url').toJsonString() }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "b6023f20-6211-4d2a-b0af-30e449948d54",
      "name": "Send Cliq chat as hamsterchef",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -2624,
        -32
      ],
      "credentials": {
        "httpQueryAuth": {
          "id": "LcsWCdhfAYCXKoiy",
          "name": "Zoho Cliq ZAPIKey"
        }
      }
    },
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "type"
            },
            {
              "name": "userids"
            },
            {
              "name": "channel"
            },
            {
              "name": "botname"
            },
            {
              "name": "text"
            },
            {
              "name": "requestApproval",
              "type": "boolean"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -3296,
        -32
      ],
      "id": "5daf8091-a5d9-4b1a-80bf-2938d49a1acd",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f077c24d-0c66-4df3-bbb3-4b260cb36de3",
              "name": "text",
              "value": "={{ $json.text }}\n\n*Approve*: [Yes]({{ $execution.resumeUrl }}/?approved=yes) - [No]({{ $execution.resumeUrl }}?approved=no)",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -2848,
        -32
      ],
      "id": "212762d4-cf39-4cfe-8a5d-a220fc5daac2",
      "name": "Edit Fields2"
    },
    {
      "parameters": {
        "resume": "webhook",
        "options": {}
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -2400,
        -32
      ],
      "id": "03bc9318-5e7b-4fee-9fe5-a085677fe469",
      "name": "Wait",
      "webhookId": "2c623a7d-6ca7-4346-a2ce-8faa6cd365d6"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c910e788-4cc9-41ac-a8bd-53c8b5b4619a",
              "name": "approved",
              "value": false,
              "type": "boolean"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1952,
        -128
      ],
      "id": "90bd2ec8-9830-4b1d-88a1-54c392417930",
      "name": "Edit Fields3"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "cc78e301-9de6-4d65-bb09-f52ee6cbf6e8",
              "leftValue": "={{ $json }}",
              "rightValue": "",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -2176,
        -32
      ],
      "id": "4850648c-b84c-4c93-aeeb-8006f8f06497",
      "name": "If1"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c910e788-4cc9-41ac-a8bd-53c8b5b4619a",
              "name": "approved",
              "value": "={{ $json.query.approved === 'yes' }}",
              "type": "boolean"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1952,
        64
      ],
      "id": "cd041aee-12b5-49e7-99d1-b67355784ed8",
      "name": "Edit Fields4"
    }
  ],
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Cliq chat as hamsterchef": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Send Cliq chat as hamsterchef",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "3aff85da7e07969a23ea8358cff02e32115008a143ca6830c498a692dd793b04"
  }
}

The test workflow :

{
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "e2a7216f-20e0-4541-b2d6-da95d376e78b",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "7590024e-2f4d-491f-a6c1-aa906e7aa755",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            },
            {
              "id": "57f2025e-611e-4d98-a400-787bba610756",
              "leftValue": "={{ $json.approved }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "id": "39e33b07-e93d-48b3-ba52-204ae815608e",
      "name": "Approved ?",
      "type": "n8n-nodes-base.if",
      "position": [
        672,
        0
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "7pTybgDX08MqfKJq",
          "mode": "list",
          "cachedResultName": "Test send and wait for Cliq"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "requestApproval": true,
            "type": "user",
            "userids": "636372456",
            "text": "=Message:\n{{ $json.message }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "type",
              "displayName": "type",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "userids",
              "displayName": "userids",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "channel",
              "displayName": "channel",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": true
            },
            {
              "id": "botname",
              "displayName": "botname",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": true
            },
            {
              "id": "text",
              "displayName": "text",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "requestApproval",
              "displayName": "requestApproval",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "boolean"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        448,
        0
      ],
      "id": "a68bc494-a281-40d0-8425-448c9cd36f85",
      "name": "Execute Workflow"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9e3b7dfe-7274-43fc-a38a-f643a75fecbf",
              "name": "message",
              "value": "test",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        0
      ],
      "id": "c2d1af60-ab5d-43e9-8628-54a1edaffa5b",
      "name": "Edit Fields"
    }
  ],
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Approved ?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "3aff85da7e07969a23ea8358cff02e32115008a143ca6830c498a692dd793b04"
  }
}

Share the output returned by the last node

Last node of the subworkflow returns this :

[
  {
    "approved": true
  }
]

But the subworkflow node of the test workflow returns it’s input :

[
  {
    "message": "test"
  }
]

Information on your n8n setup

  • n8n version: 1.106.0
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

Hi there, have you make sure that on the parent workflow,it will only return the response from the subworkflow when the sub is already done?

because there’s a known issue that usually the parent does not wait for the sub if it has a wait node

the workaround tht u can do if you want to wait, is use a code node for waiting

{
  "nodes": [
    {
      "parameters": {
        "jsCode": "async function wait(ms) {\n  return new Promise(resolve => {\n    setTimeout(resolve, ms);\n  });\n}\n\nawait wait(300000);  // Wait for 300 seconds\nreturn {};"
      },
      "id": "271abfb3-54a9-436c-a4e3-21ce83d9b8dc",
      "name": "Delay",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        0,
        0
      ]
    }
  ],
  "connections": {},
  "pinData": {},
  "meta": {
    "instanceId": "689fa22e68cd4198e4ae37f3cc44f498087edd235a867e22515be823bab694c7"
  }
}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.