help with Async API call
# 🤝help
g
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
Use await
n
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
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;
3 Views