This is more of a brainstorming session about how to solve a blocker I’m facing with a WhatsApp + AI Agent + Inbound Webhook setup.
I already have my WhatsApp flow and AI agent working properly. The challenge is that, at some point, I’m expecting a webhook from another system, and I need the AI agent to use that data as if it were a tool. I call it a “tool” because I’m not sure if the AI agent can accept another input besides the WhatsApp trigger (maybe it can, but I’m not certain). Since there’s no native “inbound webhook” option for tools, I was thinking of using an HTTP node that calls another workflow, and then structuring it something like the example below. However, I’m not sure if this would actually work or how to make it happen.
The main issue is timing. The response from the other system takes a while to arrive. Imagine I trigger the tool with the HTTP node — I’d then need to wait until the other system’s response is received. Once I have both the initial trigger and the external response, I’d want to merge them and send that combined result to the AI agent as the response to the original call.
If the system you are integrating with supports calling a webhook, the way to integrate it would be to provide that other system with a webhook to call when finished. Calling the webhook will unpause the workflow and allow it to continue its execution.
Alternatives would be to configure a loop where you periodically (once every x seconds/minutes) query that third party for status and only continue when it reports the status you are looking for (like “SUCCESS” or “FINISHED”).
Both ways are doable and used rather often by users in the community.
Hello @jabbson , thank you very much for your support. I had considered this, but honestly I’m not sure how to implement the wait on “webhook call”. Could you share a simple example?
I tried setting it up, but I’m not sure if it’s working as expected. From what I’ve read, n8n only handles one flow at a time (Start → Finish), but it seems I could have two flows running in parallel (the main flow plus this webhook flow triggered by a third-party system).
The most simple example of using the wait node would be as follows:
Here you can see I set the resumeUrl explicitly in the set node (while not technically needed, I included that to show you how to get the URL which will allow to “unfreeze” the Wait node). Then we pass the URL to the third party to call when finished. Make sure to change this to reflect the way your other system is expecting such url to be received, no not just copy my “callback”, as this wont work. Next we have the king of this party - the Wait node will will pause the execution until the resultUrl is called followed by the rest of the workflow.