Share feedback, ideas and get community help

Updated last year

Create object variables in prefilledVariables on start bot

His, is possible to pass an object in prefilledVariables, as the 'contact' below?
If yes, how can I access 'contact.name' into my flow?
const reqData = { typebot: TypebotName, prefilledVariables: { number: '929292920000', contact: {id:1, name:'John', address:'xxx',...others keys} } }; const { data } = await axios.post( TypebotUrl, reqData );
B
R
L
4 comments
No, that's not possible, variables only work with string or a list of strings πŸ™
Have a look a this json to list:

const json = {
"data": [
{ "name": "🍎 Manzana" },
{ "name": "πŸ‡ Uvas" },
{ "name": "πŸ‰ Sandia" },
{ "name": "πŸ’ Cerezas" },
{ "name": "🍐 Pera "}
]
};

function convertJSONToList(jsonData) {
if (!jsonData

!jsonData.data

!Array.isArray(jsonData.data)) {
return "JSON invΓ‘lido";
}

const items = jsonData.data.map((item, index) => ${index + 1} - ${item.name});
return items.join("\n");
}

const listaDeTexto = convertJSONToList(json);
return listaDeTexto;
Thank you, I will try it
Make sure to create a variable to call the script
Add a reply
Sign up and join the conversation on Discord