I’m trying to send aggregated data from 30 Gong calls to Claude’s API for analysis. My workflow aggregates the calls, builds a prompt, and needs to POST to https://api.anthropic.com/v1/messages.
The Problem: Every approach with the HTTP Request node gives: "JSON parameter needs to be valid JSON"
What I’ve tried:
-
JSON body with Expression mode - using
{{ $json.master_prompt }}in JSON → Error -
Using Fields Below - individual parameters for model, max_tokens, messages → Error: “messages: Input should be a valid list”
-
Pre-built JSON string - created
claude_json_bodyusingJSON.stringify()in Edit Fields, then set HTTP Request to “Raw” body with{{ $json.claude_json_body }}→ Still same error -
Code node -
fetchand$http.request()are undefined in sandbox
Current setup (Raw body):
-
Headers:
x-api-key,anthropic-version,Content-Type: application/json -
Body:
{{ $json.claude_json_body }}(pre-built JSON string from Edit Fields) -
Still fails with “JSON parameter needs to be valid JSON”
Environment: n8n 1.110.1 (Self Hosted), HTTP Request node v4.2
Question: How do I send a dynamically built JSON body to an external API? Is there an Anthropic node I should use instead, or a workaround for this validation issue?