Hi everyone,
I´m e newby as far as n8n and am building rather an easy setup with a chatbot that ist embedded on the webpage which “speaks” 4 different languages answering questions via openai (http) with retrieval konwledge base.
I’m struggling with a persistent issue as far as the language detection and forwarding the “channel: webchat” in the workflow and would really appreciate your help - what am I missing here?
Workflow Context
- n8n version: 1.101.1
- Trigger: Webhook (incoming webchat message)
- Webhook body:
{
"body": {
"message": "Some text here",
"channel": "webchat"
}
}
What I’m Doing
subflow: Webchat: webhook (incoming message) - > subflow (see below) → respond to webbhook
"when executed by another workflow:
→
- Edit Fields (Set) Node:
I extract the values from the webhook body:
message:={{$json["body"]["message"]}}channel:={{$json["body"]["channel"]}}Output example:
{
"body": {
"message": "Some text here",
"channel": "webchat"
}
- Intent Detection (HTTP Request to OpenAI):
{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "Analyze the following message and return only the main intent as a single word: sommerdeal, terminbereit, reminder, upsell, crossselling, komplex, neugierig. ..."
},
...
{
"role": "user",
"content": "Nachricht: {{$json["body"]["message"]}}\nchannel: {{$json["body"]["channel"]}}"
}
],
"max_tokens": 5,
"temperature": 0
}
- **Intent Detection (HTTP Request to OpenAI): does not have an output
The Problem
- The intent is returned correctly from the OpenAI node, but the
messageandchannelfields are missing from the output. - There are no error messages in the node output.
- I have checked:
- The Edit Fields node output contains both
messageandchannelas expected. - The HTTP Request node is set to JSON body, with correct headers.
- Expressions are correct and highlighted green in the UI.
- The Edit Fields node output contains both
What I’ve Tried
- Using both
{{$json.message}}and{{$json["message"]}}syntax. - Adding debug fields to check if values are passed (they are present in Edit Fields output).
- Changing field names to all lowercase for consistency.
- Testing with both OpenAI and other HTTP endpoints.
What am I missing?
- Why are the
messageandchannelfields not passed through the OpenAI HTTP Request node output, even though the intent is returned? - Is there a best practice for passing original input fields through OpenAI nodes in n8n?
- Has anyone solved a similar issue?
Any help or pointers would be greatly appreciated!
