Axios Get request not working
# 🤝help
s
Hi there, so I'm trying to run this code where I check the user's input to see if it's a valid postcode in the UK, by using this API called postcodes.io. However when starting the conversation and running the code block, nothing seems to happen (check images):

https://cdn.discordapp.com/attachments/1138131502446694541/1138131502656397424/Code_block_not_returning_anything.png

https://cdn.discordapp.com/attachments/1138131502446694541/1138131502933217330/API_Axios_Get_request_code_block.png

f
Do you have anything setup to respond to any kind of messages?
s
Not at the moment, just the execute code block:

https://cdn.discordapp.com/attachments/1138131502446694541/1138132528021123092/Screenshot_2023-08-07_163204.png

f
WEll then how are you planning on it responding to you?
Can you take a picture of the logs?
s
I'm not very experienced with the execute code blocks, so apologies for the noobie questions😅 Yes, here's the picture of the log:

https://cdn.discordapp.com/attachments/1138131502446694541/1138133999450079232/Screenshot_2023-08-07_163743.png

f

https://cdn.discordapp.com/attachments/1138131502446694541/1138136706508402728/image.png

This is the logs
And no worries. We all have to learn.
s
My bad, here are the logs:

https://cdn.discordapp.com/attachments/1138131502446694541/1138137410568454175/Screenshot_2023-08-07_165131.png

f
The way it looks you have nothing to respond with. Have you tried a template? Maybe seeing a video of someone building a bot?
s
It's because I'm new to the execute code blocks and have never used them before. I'll do more research into how to set them up
Basically, I have a client who is in the solar industry and he only covers certain areas. I'm trying to come up with something where I ask the user for their postcode, they input the postcode and then I check if it's valid using postcodes.io, and then check if it's an area covered by my client. Previously I was just using the knowledge base to check if the user's postcode was covered but I was running into alot of bugs, which is why I'm trying to set up this code. Maybe this context might help with clarifying what I'm trying to do. Any help would be great, or if you think that this can be figured out through watching yt videos + examining other templates, I'll do that instead👍
f
Hey guys, Instead of use console.log. You can add a variable, then set the variable in the Execute Code, instead of the console.log try something like: workflow.variableNameGoesHere =
${postcode} is a .....
Then add a "Text Message" card and in it add supertext: {{workflow.variableNameGoesHere }}
Test it and tell me how it goes
f
Its a long video but i think it will help. From the Botpress YT channel:

https://www.youtube.com/watch?v=7VILLIxGXAI&t=914s

If you want some shorter videos check this one out or their YT channel to find what suits you:

https://www.youtube.com/watch?v=nzlni00lOSQ

s
I've set it up like this but it doesn't seem to fix it:

https://cdn.discordapp.com/attachments/1138131502446694541/1138461343209508934/Card.png

https://cdn.discordapp.com/attachments/1138131502446694541/1138461343452766228/Updated_Code.png

I made a few changes but it's still not working:

https://cdn.discordapp.com/attachments/1138131502446694541/1138476796577320970/image.png

https://cdn.discordapp.com/attachments/1138131502446694541/1138476796996755476/image.png

f
Can you share with me a Report ID?

https://cdn.discordapp.com/attachments/1138131502446694541/1139592728812978176/image.png

71 Views