How to implement custom node that wait for User Action trigger in another app

Hi All,

I am trying to do POC n8n for a workflow process.

Let’s say there is a Web application for shipment creation. Once a shipment is created it has its own life cycle as mentioned below

  1. Shipment Request Creation
    In this step, a user fills out a form to create a request in a web application, and from the backend API service, I would like to trigger a workflow that contains Shipment Request Creation node. The trigger will have a JSON payload of a shipment request.

For this step, I could use the custom webhook node to perform the required action.

  1. Shipment update ERP
    Post the output of the previous node to the ERP system.

For this step, I could use the HTTP Request node.

Step 1 and Step 2 will happen immediately once the workflow is triggered.

  1. Vehicle Assignment
    In this step, a user fills vehicle details against a specific shipment request in a web application, and from the backend API service, I would like to trigger a workflow that contains Vehicle Assignment node. The trigger will have a JSON payload of a shipment request.

This step should get executed only when user action happens at other web applications and how to create a custom node which should wait for such trigger.

  1. Truck-In
    In this step, a user fills truck details during entry to the factory against a specific shipment request in a web application, and from the backend API service, I would like to trigger a workflow that contains Truck In node. The trigger will have a JSON payload of a shipment request.

This step should get executed only when user action happens at other web applications and how to create a custom node which should wait for such trigger.

  1. Truck Out
    In this step, a user fills truck details during exit from the factory against a specific shipment request in a web application, and from the backend API service, I would like to trigger a workflow that contains Truck Out node. The trigger will have a JSON payload of a shipment request.

This step should get executed only when user action happens at other web applications and how to create a custom node which should wait for such trigger.

  1. Shipment Provision to ERP
    Post the output of the previous node to the ERP system.

For this step, I could use the HTTP Request node and can execute it immediately after the previous node execution.

  1. Proof of Delivery
    In this step, a user fills delivery details against a specific shipment request in a web application, and from the backend API service, I would like to trigger a workflow that contains Proof of Delivery node. The trigger will have a JSON payload of a shipment request.

This step should get executed only when user action happens at other web applications and how to create a custom node which should wait for such trigger.

Vehicle Assignment, Truck-In, Truck Out, Proof of Delivery are needs to be wait nodes in a single workflow and should be able to trigger via HTTP requests from other applications.

Please refer to the attached image for understanding the flow.

I read about the Wait node with On webhook call functionality but the problem I see there is that node depends on $resumeWebhookUrl variable for getting the URL of the node. If I have multiple such wait nodes in a single workflow, then I need multiple $resumeWebhookUrl

thanks.
gramcha

Hi @gramcha, welcome to the community!

It seems this is your main problem, right?

I read about the Wait node with On webhook call functionality but the problem I see there is that node depends on $resumeWebhookUrl variable for getting the URL of the node. If I have multiple such wait nodes in a siwngle workflow, then I need multiple $resumeWebhookUrl

Have you considered spreading out your process across multiple workflows? In your “first step workflow”, you could run an HTTP Request calling the URL of a webhook node in your “second step workflow” and passing on all required information.

In the second step workflow you can then re-use $resumeWebhookUrl.

Hi @MutedJam

Thanks for the reply. Yes, we considered that but maintaining multiple workflows will be a little hard for us.

Worst case that is the only possible way, we hesitate with that solution because in many cases each workflow will have a single node.

Also, I could not find the sample template workflow that provides $resumeWebhookUrl.

you can enable Webhook Suffix option in wait node that way for every single node can use multiple webhook call in same workflow in the http node it will be like {{$resumeWebhookUrl}}/value defined in the webhook suffix

you can see an example video in the link below starting at 38:40 (I recommend the whole video because it explains in detail how the node works)

https://docs.n8n.io/integrations/core-nodes/n8n-nodes-base.wait/#specified-time

1 Like

Thanks Rodrigo.

I understood the solution.

1 Like