I have a workflow starting with a webhook, and using multiple “Respond to webhook” nodes, depending on what happens in the workflow. All ResponseToWebhook nodes are responsing with JSON, which I have entered in the responseBody field, as an expression.
I would like to log what happens to the response, with a node to Airtable to Supabase.
What’s the best way to set this up?
What is the error message (if any)?
Currently, each RespondToWebhook node is connected to a single Supabase node. I use {{ $($prevNode.name).params["responseBody"] }} to fetch the contents of the previous node (a RespondToWebhook node).
These are parameters, meaning that it doesn’t interpret the JSON inside the RespondToWebhook node, which returns the expression parameters, and not values. It also comes with an equal sign as the first character, making it not easy to process. Example: =[ { "is_error" : true, "message": "sample message", "uuid" : "{{ $("MergeParamsUUID").last().json["uuid"] }}", } ]
On the other hand, it seems the output of a RespondToWebhook node is the same as the input of that node itself, and not what is interpreted in the responseBody, so I cannot use what’s documented in Output of other nodes | n8n Docs
So, is there a way I can access in my workflow to the actual output of ResponseToWebbook nodes?
Hey @jb8n , as you noted the output of “Respond to Webhook” is the content you configured to reply with in response to activation of your Webhook. You can access that content in the same manner as the output of any other node.
The screenshot demonstrates it. I used Set node connected directly to the output of “Respond to Webhook” but the same applies to any node connected directly to “Respond to Webhook” (including Supabase).
When directly connected, use {{ $json.<property> }} expression. You need to come to the references in Output of other nodes | n8n Docs only if the referenced node is not immediately precedes your current node.
However I cannot find that anywhere in the Airtable input.
When I inspect {{ $json }} in the Airtable node of a previous execution of the workflow, I only find the headers and body that were received by the Webhook node that starts the workflow.
I noticed that I am using versions 1.0 and 1.0 of the webhook (receive and replyTo) nodes, while the latest version is 2.0 and 1.1, maybe that’s the reason why I cannot relate to your answer?
Hey @jb8n, I think I understand the problem better. You are right, the "Respond to Webhook” node will output the incoming data regardless of the actual data it responds to Webhook activation with.
You are also right that using params["responseBody"] produces invalid JSON that prevents further processing of that data. I will raise a bug issue for that.
The good news is, I can offer a workaround that will work whether the issue is fixed or not. You can use the following expression to get the valid JSON.
{{ $evaluateExpression($('Respond to Webhook').params["responseBody"].startsWith('=') ? $('Respond to Webhook').params["responseBody"].slice(1,) : $('Respond to Webhook').params["responseBody"]) }}
Basically you will get = removed from the beginning if it present.