https://discord.gg/botpress logo
Call or execute card inside Autonomous Node
# 🤝help
l
you use transition to exist from the AN to call the API via an the same HTTP request card and get back into AN with the response OR use Actions and do the external API call from within Actions
b
Can you show me a sample?
b
Ahh, thanks @limited-pencil-78283 ! I will try this out.
b
yes Lijo's right - an Action would be super helpful here! equally, I'd also love to see your instructions on the action (or HTTP request) card itself - this could help call it properly. if you find that a certain card or action isn't being called, the Inspect window in the emulator should tell you why a certain tool was called or not called!
l
const axios = require('axios') is not required instead replace that with await callbackPost(), without "await callbackPost()" your function is not being called additionally, your function is returning res.data while your action is not capturing that return, your output schema is empty you have two options 1. defined a zod schema to accept the response from the API (complex) 2. define a user/conversation variable of type object and pass the res.data into the variable example user.apiResponse [type object] instead of return res.data replace and add user.apiResponse = res.data then you in your AN prompt you can let AI prompt know that action response is available in user.apiResponse lastly, if Actions seems complicated - follow what is mentioned above - use transition to exit the AN node and use the same HTTP request card there
b
Thanks @limited-pencil-78283 , for this.
3 Views