Describe the issue/error/question
I’m trying to forward Webhook output (Headers + Body) to HTTP Request.
I’m dragging the Webhook Headers and Body to the HTTP Request node but it adding that string “[Object: ]” to each of them.
How can I pass all of the body and headers content without adding that string into it?
What is the error message (if any)?
ERROR: JSON parameter need to be an valid JSON
Please share the workflow
Share the output returned by the last node
ERROR: JSON parameter need to be an valid JSON
Information on your n8n setup
- n8n version: n8n@0.200.1
- Database you’re using (default: SQLite): ?
- Running n8n with the execution process [own(default), main]: own
- Running n8n via [Docker, npm, n8n.cloud, desktop app]: n8n.cloud
You can try
{{ $json }}
OR to send it as a JSON string:
{{ JSON.stringify($json) }}
fyi the [Object: {...}] does not mean that that “string” gets added. It is only supposed to tell you that it is an actual JavaScript object vs. being a stringified one. You will see the difference when you try the two different versions @pemontto posted above.
Thanks @pemontto (and @jan ),
{{ JSON.stringify($json) }}
Did worked for me.
Another thing I don’t know how to do:
I need to change 2 parameters at the header of the HTTP Request node. How can I modify just that 2 while I’m taking the whole “Headers” object from the Webhook node?
Modifying just one or two header values works similar to the body approach suggest by @pemontto above. Simply use a Set node before your HTTP Request node overwriting the values you want to overwrite and you’re good.
In this example I am overwriting the user agent:
I am using a destination URL provided by webhook.site, so it’s easy to verify as well. This is the user agent arriving on the server:
Hope this helps!
Thanks @MutedJam that’s helps a lot!
I’m trying to make 2 HTTP Requests with different body\headers modifications and 1 WhatsApp sending message between them.
The first SET > HTTP Request working great but the second one seems to be able to take and modify only his previous node, which is the WhatsApp node.
How can I use the 2nd Set node modifying the first Webhook node?