Guide: Chain Workflows with Subworkflow

Build a parent workflow that calls two separate subworkflows in sequence, passing data between them. This pattern is useful for keeping complex workflows modular and reusable.

What you will build:

Parent: Webhook → Subworkflow A (validate) → Subworkflow B (notify) → Return
Child A: Manual Trigger → HTTP Request (validate) → Return
Child B: Manual Trigger → Send Email → Return

Time: ~20 minutes

Prerequisites:

  • Tensorify account with a workspace
  • Resend account with a verified domain
  • CLI installed (only for local testing): curl -fsSL https://cli.tensorify.io/install | sh — or skip and deploy with Managed mode

Step 1: Build Subworkflow A — "Validate User"

This workflow takes a user ID and returns the user's data.

  1. Dashboard → New Workflow → name it validate-user
  2. Add a Manual trigger with allowWorkflowInvocation enabled
  3. Set mock payload:
{ "userId": "usr_123" }
  1. Add an HTTP Request node connected to Manual's payload:

    • Method: GET
    • URL: https://jsonplaceholder.typicode.com/users/{{ manual.body.userId }}
  2. Add an If node connected to HTTP Request's response:

    • Condition: {{ http_request.status }} == 200
  3. On the true branch: add a Return node connected to HTTP Request's response

  4. On the false branch: add a Return node connected to a Transform node that produces:

    { "error": "User not found", "userId": "{{ manual.body.userId }}" }
    

Copy the Workflow ID from the URL — you will need it in the parent workflow.

Step 2: Build Subworkflow B — "Send Notification"

This workflow sends an email notification with the user data.

  1. Dashboard → New Workflow → name it send-user-notification
  2. Add a Manual trigger with allowWorkflowInvocation enabled
  3. Set mock payload:
{
  "name": "Test User",
  "email": "[email protected]"
}
  1. Add a Code node connected to Manual's payload:
name = input.get("body", {}).get("data", {}).get("name", "User")
return f"New user validated: {name}"
  1. Add a Send Email node connected to Code's result:

  2. Add a Return node connected to a Transform that produces:

    { "notified": true, "userId": "{{ manual.body.data.id }}" }
    

Copy this workflow's Workflow ID too.

Step 3: Build the Parent Workflow

  1. Dashboard → New Workflow → name it user-onboarding-pipeline
  2. Add a Webhook node (or API Endpoint if you want a synchronous response)
  3. Add a Subworkflow node connected to Webhook's payload:
    • Workflow ID: paste the ID of validate-user
  4. Add another Subworkflow node connected to the first Subworkflow's result:
    • Workflow ID: paste the ID of send-user-notification
  5. Connect the second Subworkflow's result to a Return node (if using API Endpoint)

Step 4: Test the Chain

Using Managed mode? Skip to Step 5 — deploy with Managed execution and test via the webhook URL.

tensorify init
tensorify login              # opens browser — or use --api-key on init
tensorify runner start

Set a mock payload on the Webhook node:

{ "userId": "3" }

Click Test → select the Return node → click Run to Selected.

In the terminal, you will see execution logs from all three workflows in sequence. The canvas shows the parent and each subworkflow's outputs at each step.

Step 5: Deploy

With a connected runner, deploy the parent workflow from the UI. Subworkflows run in the same execution context — you do not start a separate process per workflow.

One tensorify runner start process handles every workflow assigned to it. Deploy the parent from the Deploy dialog; subworkflows are invoked automatically. Or set execution mode to Managed if you prefer cloud execution.


What You Learned

  • How to compose multiple workflows using the Subworkflow node
  • How to pass data between parent and child workflows via the input handle and Return node
  • How to use If branching inside a subworkflow to handle error states
  • The module composition pattern for keeping complex automations maintainable

Next Steps

On this page