Weather API issue

Hey everyone. I am having trouble with the Open Weather API request to get weather forecast for users by city name and state. I have attached a photo of what I have been trying, based on documentation. I know this may be a simple fix, I am just clueless on how I can get the weather forecast.

If you got the answer in facebook, you should write it here, so that it will help other people who has same problem in future.

1 Like

I managed to figure out how to solve this API issue on my own yesterday. For anyone who has the same issue or want to add weather updates to your Alexa skill,

First - you will need to get a api key from https://openweathermap.org/ you can call city, city and state or city code) #note it takes 10 minutes to an hour for the key to activate

second - You choose the integrations/api block from voiceflow and you will want to keep the block on the default “GET” selection.

Third - in the request URL block, you will get the link that you want. For instance, you can get the link which requires a user to request weather for a city and state (note some cities share the same names like Newark in Delaware and Newark in New Jersey which may cause a problem if you just call a city)

Fourth - You will remove the [your api key] from the end of the url you choose from openweather website and add your unique api key from your open weather profile. (you can make 1,000 weather calls per day for free currently, but anything above will cost you money.)

fifth - you can either change {city_name} {state} in the url link into variables so that users can call their own cities or put a static city name like Delhi, London, New York etc. there to only get weather updates from those specific locations. This will look like q={city_name} in the URL

sixth - add parameters for “q” which will have a value of{city_name} if users can call their own cities, or London or New York if the city weather will be static to one location. Next add a parameter for appid which will have a value of your individual api key from openweather map.

seventh - test your api integration to make sure it works, the button will be at the bottom of the integration block. View your formatted results. You will get several values like temp_max and temp_min and weather descriptions that you can pull from results and transform into variables. Put your mouse by the variables you want and click the keyboard icon to copy and then under transform into variables, paste the copied variable into the “transform into variable” part of the integration block and then give the variable a name. If you add a speak block after the api request and add the variable, Alexa should say the result value that gets stored into the variable.

I hope all the steps are clear. I am a visual learner, so I will create a YouTube tutorial for Voiceflow users to flow along if you want to add integrations into your skill. I am finally understanding an api in its basic uses.

1 Like