Allen, thank you for the code. I truly appreciate you sharing it! I used it (and gave credit) in my solution and I published the entire solution so other beginners can follow the steps from A to Z to add the weather skill to their chatbot. The next challenge will be to adapt the code for a call into the forecast option of OpenWeather, which is a paid option. This will require improving the dialog node to discern between requests for the current weather or for a forecast.
I will also explore the option of using IBM's weather solution. It seemed easier to work with OpenWeather, but it would be a pity not to explore all the options offered by IBM.
------------------------------
Antonel Neculai
------------------------------
Original Message:
Sent: Mon August 02, 2021 06:19 PM
From: Allen Nugent
Subject: Weather Skill for Watson Assistant
Hi Antonel,
Capture the fields you want from the response by OpenWeather into a formatted string variable, and return it to your assistant.
My cloud function is:
let rp = require('request-promise')
function main(params) {
const options = {
uri: "http://api.openweathermap.org/data/2.5/weather?q=" + encodeURIComponent(params.object_of_interest) + "&units=metric&APPID=my_openweather_api_id" ,
json: true
}
return rp(options)
.then(res => {
WeatherReport = "Current Temperature : " + res.main.temp + ", Pressure : " + res.main.pressure + ", Humidity : " + res.main.humidity + ", temp min : " + res.main.temp_min + " , temp max : " + res.main.temp_max
return { WeatherReport
}
})
}
------------------------------
Allen Nugent
Original Message:
Sent: Mon July 26, 2021 09:09 AM
From: Antonel Neculai
Subject: Weather Skill for Watson Assistant
Thank you Vincent for the info sources. I have started working on developing the chatbot connected to OpenWeather API. I have been successful calling the API so far, the only aspect I still have to work on is processing the return JSON file by the IBM Watson Functions using Node.js so it passes on a nice, human-friendly response back to Watson Assistant in the dialog to display for the user. Processing JSON file with Node.js or Python is a useful skill anyway, since it's needed in pretty much any Watson Assistant project, so I'll go for it. After the chatbot is ready, I will come back here and post a link to the project so others can see an example of how to implement weather with Watson Assistant.
------------------------------------------------------------
Antonel Neculai
https://www.LinkedIn.com/in/antonelneculai/
-----------------------------------------------------------
------------------------------
Antonel Neculai
Original Message:
Sent: Tue July 20, 2021 09:49 PM
From: Vincent Kok
Subject: Weather Skill for Watson Assistant
Hi Antonel,
I have not encountered any tutorials or examples. But I guess you could use the web hooks tutorial by Morgan Carroll here: https://www.youtube.com/watch?v=5z3i5IsBVnk
The API that you can use is from Openweather: https://openweathermap.org/api
Hope it helps.
Thanks!
Vincent Kok
https://www.linkedin.com/in/vincekok/
------------------------------
Vincent Kok
Original Message:
Sent: Tue July 20, 2021 06:13 PM
From: Antonel Neculai
Subject: Weather Skill for Watson Assistant
Are there any tutorials or examples on how to add weather skills to a Watson Assistant chatbot? I would like to build a chatbot that can provide weather details for a specific location is asked something like: "How is the weather there now?" or "What is the weather forecast for next week?" etc. Does The Weather Company has API that can be used by Watson Assistant? Is there a free version just like there is the Lite version for the CloudPak for Data? Thank you.
------------------------------
Antonel Neculai
------------------------------
#WatsonAssistant