I'm calling a WordPress API and all is working, however botpress is not waiting on the final API call before moving on and is ending the convo before the results return. It is also not setting the propResults variable even though I can console.log then. What am I doing wrong?
I threw my code in a codepen under the js tab.
https://codepen.io/Damian-Smith-the-solid/pen/jOQQzYN
s
stale-sundown-82363
07/29/2023, 5:14 PM
Use await
n
nice-airplane-37559
05/16/2024, 1:54 AM
There doesnt seem to be an answer fromthe Dev team in this, I've searched (found yours too) API call a response data doesnt set workflow variables. NOW id this is a bug then it would be great to kow rather tham spend days trying to resolve!! @cold-motherboard-82208
nice-airplane-37559
05/17/2024, 2:22 AM
Try adding another await call eg await new Promise((resolve) => setTimeout(resolve, 3000));
after the let response = await axios.get(url, { headers });
EG
let response = await axios.get(url, { headers });
* await new Promise((resolve) => setTimeout(resolve, 3000));*
let recordData = response.data;