Creating Subflows within a Workflow in Zenphi

In Zenphi, while there's no direct "Subflow" action, you can establish a seamless relationship between flows using an HTTP Trigger. This approach allows you to trigger one flow from another, effectively creating subflows. Here's how you can set it up:


How to Create Subflows

  1. Start with an HTTP Trigger:

    • Create a new flow that will act as your subflow.

    • Add an HTTP Trigger to the subflow, which provides a URL that can initiate this flow via an API request.

    • Publish the Subflow: After publishing, you’ll find the trigger URL under the Invocation section in the HTTP Trigger settings.


  2. Configure the Main Flow:

    • In your main flow, use the Make HTTP Request action at the point where you want to trigger the subflow.

    • Paste the Subflow URL: Copy the URL from the HTTP Trigger of the subflow and paste it into the API URL section of the "Make HTTP Request" action in your main flow.


  3. Set Up the Request Details:

    • Set the request method to POST.

    • Add any data you want to pass to the subflow in the Body Request or as Form Data, Query String Data, etc. This data will be available for use within the subflow.


Example: Cascading Subflows

Here’s a demonstration of triggering multiple subflows in sequence:

  1. Main Flow:

    • Triggers SubFlow 1 via a "Make HTTP Request" action.

  2. SubFlow 1:

    • Uses its HTTP Trigger to receive data from the Main Flow.

    • Use "Convert Json to Object" action to extract data from your body

    • Includes a "Make HTTP Request" action to trigger SubFlow 2.

  3. SubFlow 2:

    • Receives data from SubFlow 1 using its HTTP Trigger.

This setup ensures that all three flows are executed sequentially, starting from the Main Flow and passing data between them as needed.


Benefits of Using HTTP Triggers for Subflows

  • Modularity: Each subflow is an independent unit, making it easier to test and maintain.

  • Data Sharing: Seamlessly pass data between flows via the request body or parameters.

  • Scalability: You can add more subflows or rearrange flow triggers with minimal effort.