I’m struggling with getting a dynamically generated prompt to reach the OpenAI HTTP node. The goal: combine an original text with structured feedback, pass it as a single prompt to gpt-4-1106-preview, and get an optimized version of the text.
Setup (simplified)
Google Sheets → provides generatedText
Code Node → adds feedback as prompt
Merge Node → Combine mode → All Possible Combinations
Code7 Node → builds final prompt
HTTP Request7 → should then correctly execute the combined prompts
What is the error message (if any)?
Problem
Although Code7 outputs the correct prompt, the HTTP node sends an empty or incomplete value to OpenAI.
Response:
“Unfortunately, you have not provided any specific information or data that I could convert into an optimised JSON text.” (just in german)
Since you are saying Code 7 outputs the correct prompt but fails at HTTP request it could be a referencing issue of the finalPrompt from the previous node. can you verify and revert
this should be fine, but I’m new to n8n and maybe I did something wrong. Here’s a screenshot of the input, the node and the output (see ‘Content:’ where it says: Unfortunately, you did not provide any specific information or data that I could convert into an optimised JSON text).
Sorry. Hadnt had time to come back to this thread. The latest screenshot is quite helpful. I think in the line where you have
“content”: “{{JSON.stringify($json.prompt)}}”
this could be the issue. this is turning your prompt into a quoted JSON string including extra quotes and escaping like this “"Du bist ein professioneller SEO-Texter…"”
The open AI is going nuts since its being passed a string inside a string.
Replace that line with
“content”: “={{ $json.prompt }}”
The = at the beginning is crucial — it tells n8n to evaluate the expression and inject the value directly, instead of treating it as static text. try it out and let me know
{
"model": "gpt-4-1106-preview",
"max_tokens": 2000,
"temperature": 0.2,
"messages": [
{
"role": "system",
"content": "Du bist ein professioneller SEO-Texter. Optimiere den folgenden JSON-Text anhand des Feedbacks. Verändere keine Überschriften oder Themen — passe nur Formulierungen, Stil und Details an. Gib ausschließlich den optimierten Text zurück."
},
{
"role": "user",
"content": "={{ $json.prompt }}"
}
]
}
But the output is always the same. “Unfortunately, you did not provide any specific information or data that I could convert into an optimised JSON text”
can you retrace back and see whats the $json.prompt like in Code 7 output and could you also share what does the code look like for Merge2 and Code7. Basically I am trying to figure out how the shape of the input is whether the generatedText or feedback is inside nested keys