https://discord.gg/botpress logo
#🤝help
Format input to send to an external API
# 🤝help
s

shy-glass-43299

06/29/2023, 7:26 AM
I want to ask the users a couple of questions and then contact an API. The issue is, I will ask them for city names, and the API needs it to be in a specific format, for example SYD for Sydney, NYC for New York, etc. How can I format the city names before sending it to the API? City names should match the names from this list https://www.iata.org/en/publications/store/airline-coding-directory/
a

acoustic-hair-60678

06/29/2023, 10:13 PM
hi @shy-glass-43299 👋 have you considered using an AI task to formulate the city names into the airport way you need them ✈️ ? I'd try something like setting up the AI task with the instructions of “Analyze the user’s message and set the string variable “cities” according to the airport code it corresponds to” and then feed that cleaned up variable to the API
s

shy-glass-43299

06/30/2023, 1:58 PM
Didn't work from the first attempt, but good idea, I can play with it a bit more. Thanks
a

acoustic-hair-60678

06/30/2023, 4:05 PM
Of course. Good luck and let us know once you figure it out!
2 Views