I can't pass Make.com variables to Claude via their API

Using Claude’s ‘Make an API Call’ module. Before that I have a “set” module with some plaintext.

I have a very simple prompt:

{
“model”: “claude-3-5-sonnet-20241022”,
“max_tokens”: 4096,
“messages”: [
{“role”: “user”, “content”: “summarise this: {{252.product_page}}”}
]
}

But it doesn’t like the curly brackets. I’m getting the error: The operation failed with an error. [400] The request body is not valid JSON: unexpected character: line 5 column 161 (char 247)

Please advise! Thanks!

Try this

{
“model”: “claude-3-5-sonnet-20241022”,
“max_tokens”: 4096,
“messages”: [
{
“role”: “user”,
“content”: “summarize this: {{252.product_page}}”
}
]
}

Make sure there is no blank space at the end of the JSON.

1 Like

Thanks for the suggestion. Got this error though:
The operation failed with an error. [400] The request body is not valid JSON: unexpected character: line 2 column 1 (char 2)

Can you share a screeenshot of you module opened.

Hey, just managed to fix it. To fix the error, I escaped special characters in the “set variable” module text, like double quotes and unescaped backslashes, which were breaking the JSON structure. By adding backslashes before these characters, I ensured they wouldn’t interfere with JSON formatting.

2 Likes