What is your goal?
I’m building a LINE chatbot that sends customer messages to Claude API via HTTP module. It works with single-line messages, but breaks when customers press Enter (line break).
What is the problem?
Error: “The provided JSON body content is not valid JSON - Bad control character in string literal”
My HTTP Body:
{“model”:“claude-sonnet-4-20250514”,“max_tokens”:1024,“messages”:[{“role”:“user”,“content”:“{{3.events.message.text}}”}],“system”:“{{6.Prompt}}”}
I tried replace(text; newline; " ") in Set Variable but Make adds extra quotes/brackets that break JSON.
What’s the correct way to escape newlines before passing to HTTP JSON body?
What have you tried so far?
-
Used Set Variable module with replace(3.events.message.text; newline; " ") - Make.com adds extra quotes and brackets that break the JSON
-
Typed the replace function manually - same problem
-
Used the variable picker - adds unwanted Events pill
Single line messages work perfectly. Only breaks when customer message contains a line break.