Weather Bot

Maurizio Cibelli
Hu:toma AI
Published in
3 min readJun 20, 2017

Building a weather bot in 5 mins.

Today I am going to show you how to build a simple weather bot using the Hutoma Platform. In this example, I am using http://api.openweathermap.org as API provider but you can use any provider you want.

Step 1 — Log in and click “Create New Bot”

Go to www.hutoma.ai and login. You will see a screen with a list of AIs you created in the past (if any) and a big green button. Click that to initiate the AI creation flow.

Step 2 — Fill the Basic Bot Settings UI

Give your AI a name and fill the basic info form. I’ve called my AI “WeatherBot” and added a quick description. Then hit the “Next” button.

Go to the next page and hit the “Save and go to your Bot” button.

Step 3 — Create a ‘Weather’ Intent

After you saved your bot from the previous step, you will see a menu that looks like this:

Now click the “Intents link”, give your new intent a name and click the “Create Intent” button. I called my intent “weatherinfo”

Now you need to give the AI examples of questions that are about the weather. You can do that by typing an example in the text box “Add Expression” button.

In my example I am giving the AI just three examples:

· How is the weather like in Seattle

· Weather forecast for Reading, UK

· Will it be sunny in Barcelona today?

Next, you want to tell the AI that if it recognises that the user is asking about the weather it should automatically extract the city the user is interested in. This is because you will need that city to call the weather API later on. To do that, scroll down below to the Entities section and pick the “sys.place” entity.

The “sys.places” entity will automatically recognise cities in a phrase and return that when you call your webhook (more about webhook later on).

After you picked the sys.places entity, click the “click to enter” label below the Prompt section and add some text to prompt the user in case she/he does not specify a city or a town.

Now hit close and click the “Add Entity” to save your entity.

Now grab the sample code from https://github.com/fargonaut/hutomadotai-samples/blob/master/getWeather.py and deploy it somewhere (ex. AWS, Google Cloud). Once it is deployed and you verified is running, fill the webbook section toward the end of the Intent form. If you don’t want to host your own code you can use our sample code hosted at http://52.44.202.141:5678/getWeather instead.

Now click the save Intent button towards the top of the Intent form and give it a go!

--

--