Creating workflow through API - Having error on post request with "Workflow Json" when has curly braces in it

Hi,

I’m having an error when creating a workflow with http request node while sending my workflow json on http request node because of the curly braces,

on expressions part, it sees curly braces on my json as its own javascript code rather than send it.

It is actually the same error I’m having the topic below but can’t made it with set node too;

I do send my json when I delete {{javascript code}} curly braces like below from my json.

image

So I think solution is somehow to encode and send {{ javascript code }} on expressions part on my http request node…

How could be the solution?

Information on your n8n setup

  • n8n version: Last version on web

OK, here is how I solved it;

On Set Node, I add my json as fixed;

On javascript code, I replaced my fields dynamicaly.


let obj = $input.all()[0].json;

obj.replacedWorkflowBody =  obj.workflowBody
      .replaceAll("{teamId}", obj.body.teamId)
 
return $input.all();

I used it as json on expressions like this;

and it worked.

2 Likes

Hey @onurbolaca,

Nice work :raised_hands:

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