Questions in webhook and HTML

The Question


Hi! I am trying to create a simple web app that lets users type in text and add files and generate output using OpenAI’s API. I am trying to use Appsmith/Openblocks for this front end and use n8n to handle everything else. The sample layout is given below:

Here, I have tried creating a webhook node to accept the inputs provided by the users. Whatever they type in the text field, and the uploaded document is received without any problems, and the workflow starts running.

Now, I need to send the output of the last node back to the application. I’ve tried creating a ‘Respond to Webhook’ node, but not quite able to figure out how it functions and everything. How to send the response back to an application after a few seconds (for the workflow to run) and use the last node’s output in the response?

Or is there any other way to do this? Any help would be appreciated.

Information on your n8n setup

  • n8n version: 0.227.1
  • Database: Postgres
  • n8n EXECUTIONS_PROCESS setting: own
  • Running n8n via Docker
  • Operating system: Ubuntu Server 22.04 LTS

Hi @Jayavel - would you be able to share the workflow that you’re using? You can copy and paste from the editor and paste it here, with three backticks (```) above and below. That will let us see how your current workflow is set up, and we can try to troubleshoot from there!

Sure, @EmeraldHerald. Since it was having some imp data, I didn’t include it. I have masked the data now; you can see the workflow below.

Also, this is how I have configured the application’s POST request:
Authentication - None
Headers -
content-type - multipart/form-data
Body - Attaching image below

1 Like

Hi @Jayavel , thanks for the details! :tada:

What you’d need to do here is add the respond to webhook node, and tell the webhook node to use that for the response. The application you are building should then wait before getting the response. You would need to add the respond to webhook node three times – one for each output.

It would look something like this:

And your webhook would set this:
image

And in the respond webhook node, you could put whatever you want:

The important part here though is telling the webhook to use the respond to webhook node. If you miss that it will just reply immediately :+1:

2 Likes

Okay, I’ll try this and let you know.

This is not working, and the only response received in the app is " [] "
If I don’t use the respond to webhook node, the app shows the message ‘Workflow has started’.

Hey @Jayavel,

Can you share the updated workflow?

Sure, here it is:

That looks like it should work to me, there is data in the output so should be ok. How long is the workflow taking to run and is your app waiting for the response or just moving on quickly? Could be worth doing a test with CURL or Postman to see what happens.

1 Like

The workflow completes in approximately 6 seconds. If there are no files attached to it, the time is even less. The app is configured to receive responses and display them in the Output section.

I will try checking with Postman as you suggested.

1 Like

Please ignore my previous reply.

The workflow works without any issues after I restarted my server :expressionless:

Don’t know the root cause of this. But I am now getting the responses populated correctly using the ‘Respond to Webhook’ node.

Thank you @EmeraldHerald and @Jon, for looking into this.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.