How to initialize an integrated flow

Describe the issue/error/question

Hi community! I am having a small issue. most of my flows are executed by a single call to a webhook node. I then do some basic transformation and use execute workflow nodes to pass the data and trigger other flows for different use cases.

I have been having issues while creating this flows cause I can´t find a good way to build and test using the data structure that would come from the execute workflow nodes. I currently use postman to hit the test endpoint with a fake webhook node I later eliminate.

Is there a way to initialize the data for the trigger node without having to hit the endpoint? Example, I take an execution of the main flow, grab the JSON that gets sent to the execute node, paste it in the start node of the next flow, and use that as an initialization until it is active and receives the actual data from the workflow?

Running on npm cloud.

Appreciate any help!

Hi @jpm, welcome to the community :tada:

I would typically use a Function node to mock incoming data without an actual webhook. So disabling the webhook and adding a Function node with code like this should do the trick:

const mock_data = {
  "id": 1,
  "name": "Bulbasaur",
  "additional_names": {
    "english": "Bulbasaur",
    "japanese": "フシギダネ",
    "chinese": "妙蛙种子",
    "french": "Bulbizarre"
  },
  "type": [
    "Grass",
    "Poison"
  ]
};

return [{
  json: mock_data
}];

Simply adjust mock_data in the above example to match your webhook data. The whole workflow would look like so:
image

Example Workflow

You can simply copy the above JSON and paste it into your canvas.

I hope this helps! Let me know if you have any further queries on this or in case I have missed something.

That´s genius, so simple, don´t know why I didn´t think about it!

I think it would be great UX if there was an option to do this directly in the start node, or in a stand alone node.

But this works great, thanks!

2 Likes

I couldn’t agree more and that’s definitely something the team has on their radar. So this should get more intuitive going forward :slight_smile:

For now I am glad to hear this works for you, thanks a lot for confirming!