Hey, I had some trouble connecting my botpress chat bot with Stack Ai. I used an execute code block and here is the code that I used,
async function query(data) {
const response = await fetch(
"https://www.stack-inference.com/run_deployed_flow?flow_id=64a5762db29c296cf73fdca5&org=1a2fa797-945d-43c5-9b3e-7081022506ce",
{
headers: {
'Authorization': 'Bearer My Api key',
'Content-Type': 'application/json'
},
method: "POST",
body: JSON.stringify(data),
}
);
const result = await response.json();
return result;
}
query({
"in-0":
what loan types do you guys have??
,
"url-0":
https://www.claritymortgageloans.com/
}).then((response) => {
console.log(JSON.stringify(response));
});
Is there anything wrong with it?