How to set a JavaScript Array variable in Typebot?

Hi, I'm struggling to set an Javascript array variable in Typebot. The context is the following. I need to generate an array of messages to send to an API via Webhook.

The Webhook have the following body:

{
"model": "some-model",
"max_tokens": 1024,
"messages": {{messages_hist}},
"stream": false
}

I need to pass in "messages" the following Array:

[{"role": "system","content": "some system message"},{"role": "user","content": "some user message"}]

To achieve this I'm trying to 'Set variable' in the Typebot. A 'Custom' variable by the way, with this:

[{"role": "system","content": "some system message"},{"role": "user","content": "some user message"}]

The problem is that the Webhook does not work because(I think) what's inside the JS Array is being interpreted as a regular string:

["{"role":"system","content":"some system message"}","{"role":"user","content":"some user message"}"]

Any clues on how to handle Array variables in Typebot?
Was this page helpful?