Hi everyone,
I’m using n8n v1.88.0 (Self-Hosted) and trying to push an AI-generated message to Rocket.Chat using the HTTP Request
node. Static content works fine — but when I try to send dynamic content via JSON, I keep getting errors like:
![]()
JSON parameter needs to be valid JSON
![]()
Bad request - must match exactly one schema in oneOf
![]()
The value "$json" is not supported!
What Works:
This static JSON body successfully sends to Rocket.Chat:
json
CopyEdit
{
"channel": "#ai-chat",
"text": "Test message",
"alias": "AI Agent",
"emoji": ":robot_face:"
}
What Fails (Dynamic JSON Approaches Tried)
We’ve tested every known method and can’t get dynamic text (like {{ $json.text }}
) to work. Here’s a list of what we tried:
1. $json
(expression) directly in JSON field:
json
CopyEdit
$json
Error: “The value
$json
is not supported!”
2. Full expression block:
js
CopyEdit
={{
{
"channel": "#ai-chat",
"text": $json.text,
"alias": $json.alias,
"emoji": $json.emoji
}
}}
Error:
JSON parameter needs to be valid JSON
3. Expression interpolation inside string values:
json
CopyEdit
{
"channel": "#ai-chat",
"text": "={{ $json.text }}",
"alias": "={{ $json.alias }}",
"emoji": "={{ $json.emoji }}"
}
Fails silently or body is interpreted as a literal string.
4. JSON via Set or Edit Fields node:
Used an Edit Fields
node or Set
node to structure:
json
CopyEdit
{
"channel": "#ai-chat",
"text": "{{ $json.output }}",
"alias": "AI Agent",
"emoji": ":robot_face:"
}
Looks correct in the preview, but Rocket.Chat rejects the request, possibly due to string escaping.
5. Using Code
node:
Formatted and returned JSON from a Code node:
js
CopyEdit
return {
json: {
channel: "#ai-chat",
text: $json.text,
alias: "AI Agent",
emoji: ":robot_face:"
}
};
Works fine when hardcoded
Still fails when passed into HTTP Request node unless fields are explicitly replaced again
6. Tried Function node with direct fetch()
call
![]()
fetch
and$http
are not supported in the Function node (sandboxed)
Other Notes:
- Rocket.Chat API requires
channel
ORroomId
, butchannel
is definitely valid. - When dynamic fields are passed, Rocket.Chat returns:
must have required property 'roomId' | must match exactly one schema in oneOf
We’ve exhausted all formatting tricks and workarounds inside n8n.
What We Need Help With:
- Has anyone successfully pushed dynamic text to Rocket.Chat using n8n’s HTTP Request node?
- Is there a best practice or correct way to pass
$json
in a format Rocket.Chat will accept?
Thanks in advance for your insights!