hi, how can i add external APIs in botpress chatbo...
# 🌎general
m
hi, how can i add external APIs in botpress chatbots
e
Hey @most-monkey-24141, you can call any external API by using the Execute Code card.
n
hi, Im trying to implement an external API call, and keep getting network error. Execute code is: const apiUrl = "https://postman-echo.com/get?foo1=bar1&foo2=bar2" console.log("Call API: "+apiUrl); const response = await axios.get(apiUrl).catch(function (error) { if (error.response) { // The request was made and the server responded with a status code // that falls out of the range of 2xx console.log("error.response:" + error.response.data); console.log(error.response.status); console.log(error.response.headers); } else if (error.request) { // The request was made but no response was received //
error.request
is an instance of XMLHttpRequest in the browser and an instance of // http.ClientRequest in node.js console.log("error.request:" +error.request); } else { // Something happened in setting up the request that triggered an Error console.log('Error message:', error.message); } console.log("error.config:" +error.config); } ) //console.log("Response: " + response.data); log shows: Call API: https://postman-echo.com/get?foo1=bar1&foo2=bar2 error.request:[object XMLHttpRequest] error.config:[object Object] Can anyone pls assist? thanks
e
Hey @nice-answer-41744, there was a bug with Axios requests
it has been solved now
2 Views