Drag and drop from schema

Describe the problem/error/question:

When building an HTTP request using fields in the Body from a previous node, if I drag and drop them using Schema, i get something like this:
{input: “{{ $(‘Webhook’).item.json.body.text}}”, enableStreaming: false, sessonId: “kam”}

What is the error message (if any)?

synthax error

the correct synthax should be (thanks @kapai.ai)

{ “input”: “{{ $node[‘Webhook’].json[‘body’][‘text’] }}”, “enableStreaming”: false, “sessionId”: “kam” }

→ My question is : can we change the way drag and drop works, so as to have the correct/new notation?

Hey @Kam,

This one is interesting, Both syntax options are correct and you could use $('Webhook').item.json.body.text or $node['Webhook'].json['body']['text'] although we actually prefer $('node name').item which Kapa was not aware of but will be shortly.

What actually fixed the issue was Kapa corrected your JSON so that the key names were wrapped in quotes (")

This means that you could actually use

{
  "input": "{{ $('Webhook').item.json.body.text }}",
  "enableStreaming": false,
  "sessionId": "kam"
}

But if you were to try the below which is the same as your original schema but instead uses the notation that Kapa returned it would fail.

{
  input: "{{ $node['Webhook'].json['body']['text'] }}",
  enableStreaming: false,
  sessionId: "kam"
}

Hopefully this helps to clear up the issue, Let me know if you have any questions on this.

3 Likes

@Jon : understood. thanks for clarifying.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.