New n8n user, and I am testing flow where a webhook that will received a raw body. I need to send this raw body to my python script which is being called via execute command node. I tried to send the body from the webhook as a arg when calling the script but that does not work.
As you can see it sending the object as a string. I am assuming this be because i am sending as command argument. However I do not know how else to have my python script ingest the webhook body object.
Information on your n8n setup
n8n version: 0.227.0
Database (default: SQLite): SQLite
Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
Your webhook body is a JSON object, and [object Object] is its string representation in JavaScript. So based on the information provided so far the behavior might be exactly what is it expected. To get this right would require knowing which data type and format exactly is required by your script and how you’ve set up your workflow.
Assuming you want a string rather than an object, and don’t want any n8n/JavaScript logic to be applied to your webhook body, you could enable the “Raw Body” option on the webhook node:
This would provide you with a binary object data which contains the original body. You can then use a subsequent Move Binary Data node to read this body as a string. In a workflow this would like so:
You’d then get a string with your body in the data field which could be what you’re looking for. Simply use {{ $json.data }} to access this field in your Execute Command node (though again, this would depend exactly on what your script needs, based on the example result you have shared it looks like it simply returns all parameters):