Skip to main content
Solved

Curly Brackets and my chatbot requests

  • June 30, 2025
  • 10 replies
  • 72 views

NIgefire

We're attempting to use a Custom User Field (e.g. User_Question) in a webhook body using the + Add a Field feature within the "Edit Request" screen. However, when the variable is inserted, it does not auto-wrap with double quotes or curly braces ({{ }}), which causes the JSON to become invalid. Even when manually adding the correct format ("{{User_Question}}"), the system either strips the quotes/brackets or continues showing Invalid JSON. We've followed all official instructions, but the variable remains unrecognized and the request fails to trigger the webhook correctly.

Help as the manychat Helpdesk are asleep at the wheel 

Best answer by Gustavo Boregio

Got it ​@NIgefire !

To solve this, go to the ‘Contact for testing’ box on the top right and type your name (or the name or any Manychat subscriber) to do the ‘Test Request’. This will make sure you have proper values on the User Fields for the test.

If you run this in a real scenario (real run of the automation) the invalid JSON issue will not happen.

Now, one thing: with your setup, if there’s a character that needs escaping in the ‘User_Question’ field (such as a “) it’ll break the JSON code.

Removing the “ “ and applying the ‘Encode to JSON’ like I showed is the safe way to do this.

10 replies

Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • June 30, 2025

@NIgefire click on the custom field in the JSON body (the blue custom field bubble) and check the ‘Encode to JSON’ option.

This should solve your problem ;)

Alternatively, you can enclose the user field with “ ” (but the encode to JSON option is better!)

Let us know if this works!


NIgefire
  • Author
  • Up-and-Comer
  • 6 replies
  • June 30, 2025

I get this 


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • June 30, 2025

@NIgefire what’s in the ‘body’ section?


NIgefire
  • Author
  • Up-and-Comer
  • 6 replies
  • June 30, 2025

 

Thanks for the follow-up.

I have followed your instructions to “remove the brackets and then encode as JSON,” but unfortunately, this approach is not working as expected. When we do this:

{
"question": ChatGPT_Question
}

…the preview throws an Invalid JSON error. If we try wrapping the variable in quotes like this:

{
"question": "ChatGPT_Question"
}

…it treats "ChatGPT_Question" as literal text, not the dynamic variable value — so it just sends the string "ChatGPT_Question" instead of the user’s actual input.

We've also tested inserting the variable using the + Add a Field method. This auto-wraps the variable visually (with the green highlight), but ManyChat still fails to format it with the correct curly bracket syntax ({{variable}}) — and it continues to trigger the Invalid JSON error in the preview panel.

It seems that ManyChat’s internal variable rendering either:

  • Doesn’t evaluate the inserted variables correctly when inside a JSON object, or

  • Fails to encode the data properly unless the entire payload is dynamically structured — which defeats the purpose of a static JSON template.

Could you please clarify:

  1. What is the correct way to dynamically insert user inputs into a JSON POST body, without breaking the syntax?

  2. Should the fields inserted using the + Add a Field button be auto-wrapped in quotes or not?

  3. If curly brackets and manual wrapping are not allowed — how do we trigger variable rendering that actually sends dynamic values?

Happy to provide additional screenshots or test results if needed — but at this stage, it seems like the builder UI and the webhook preview are misaligned in how variables are parsed.

Thanks,


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • June 30, 2025

@NIgefire this is what it should look like:

 

  1. The user field is added with the {+} link
  2. It shows up as a blue bubble on the UI
  3. When you click on it, make sure you have the ‘Encode to JSON’ option checked

This, along with a correct JSON structure, works 100% of the time,


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • June 30, 2025

@NIgefire if you share a screenshot of the ‘Body’ section I’ll most likely be able to tell you what’s wrong with it ;)


NIgefire
  • Author
  • Up-and-Comer
  • 6 replies
  • June 30, 2025

 


NIgefire
  • Author
  • Up-and-Comer
  • 6 replies
  • June 30, 2025

 


Gustavo Boregio
Forum|alt.badge.img+6
  • Manychat Community Moderator
  • 2821 replies
  • Answer
  • June 30, 2025

Got it ​@NIgefire !

To solve this, go to the ‘Contact for testing’ box on the top right and type your name (or the name or any Manychat subscriber) to do the ‘Test Request’. This will make sure you have proper values on the User Fields for the test.

If you run this in a real scenario (real run of the automation) the invalid JSON issue will not happen.

Now, one thing: with your setup, if there’s a character that needs escaping in the ‘User_Question’ field (such as a “) it’ll break the JSON code.

Removing the “ “ and applying the ‘Encode to JSON’ like I showed is the safe way to do this.


NIgefire
  • Author
  • Up-and-Comer
  • 6 replies
  • June 30, 2025

Thanks, got that sorted and realised I dont have the return flow working, May get back to you

 

N>