Create the weather skill
Last Updated: 25.10.2019
Last updated
Last Updated: 25.10.2019
Last updated
Create weather skill to get the information about the weather in the Hala chat. In this tutorial we are using the service https://weatherstack.com to get the information about the current weather.
Step 1. Go to the https://weatherstack.com and sign up for a free account
Step 2. After the registration, go to the https://weatherstack.com/quickstart and copy the API Access Key that was generated for your account and also Base URL
Step 3. Go to the Integration
section on the Hala Platform and add the new integration
and select REST API integration:
Past the values that you have copied step 2. Save your results.
Step 4. Go to the Actions
section on the Hala Platform, and create a new action
. Provide the name for the action and select the integration.
Step 5. Make the configuration of your API service. You can find more information about building the API in the documentation of the API provider. In our case, you can read API documentation of this service here. When you will finish, save your changes.
Step 6. You have set up integration and action. Now, you need to create an intent to recognize the user input about getting the weather. Go to the Intents
section on the Hala Platform and press New Utterance
Step 9. Now you need to provide examples of how the end-users can write about the getting the weather forecast. You need to provide at least five examples.
Step 10. Save
your changes and train model
It is very important that you need to Save the changes and then Train Model. It will take up to 20 seconds to train the machine learning models.
Step 11. Now, you need to create an entity to recognise the city for which we need to provide the weather. Go to the Entities
section on the Platform and press New Entity
Save
your changes and train model
Step 12. Go to the Skill Kit
section on the Hala Platform and create a skill by pressing the button Create skill
Step 13. Provide the name of the skill, description, and tags (last two is optional). Press next for creating the dialog flow.
Step 14. You will be promoted to the interface for creation dialog flow. Create the first root node by pressing the button Add new
Step 15. Open the created dialog node and fill it.
Field Name - you can enter any value, for example "User asks for a weather forecast"
Conditions - here you need to specify created intent intent.get_weather
Actions - skip this section
Context - skip this section
Output - here we need to ask the user for which city we need to provide the weather forecast
Step 16. Now you need to create a child node to recognize the input from the user about the city.
Step 17. Open the child node and fill it.
Field Name - you can enter any value, for example "Form Success"
Conditions - here you need to specify the entity entity.city
Actions - When we got the information about the city, we can send the API request to the weather service. We need to add the Action that we have created previously.
When you add the action, you would need to specify the context variable where the response from the weather service will be stored, for example, context.weatherResponse
Context - Here we need to save the City name into the context variable that will be sent to the weather service.
Output - In output you can write something like this "Please wait, I am checking the information."
Step 18. Create a new child node to process the API response from the weather service.
Open the created node and fill it:
Field Name - you can enter any value, for example "Provide the results"
Conditions - Specify the context variable that was created for the Action Response on previous steps: context.weatherResponse
Actions - skip this section
Context - skip this section
Output - In the Output, we would need to provide information about the weather. To access the data from the API response, you would need to use the next prefix context.weatherResponse.
and then specify the path to the required data. All API providers have information about using their API. You could read this information to create the correct path to the data extracting.
You can use the next text:
Step 19. Save the changes by pressing button "Save Changes". Now you have created the simple skill with one dialog node.
Remember to save your changes.
Step 20. Test the results. Go to the Hala Web Chat by using the next link https://chat.hala.ai/ and type the first message in the chat. You can type one of the trained phrases, or you can use new phrases that weren't specified in intent training.
Congratulations! You have created the skill and tested it.
Step 7. To change the default name of the intent, click on icon pencil next to the default value, or you can click on the default value, and then you will be able to modify it.
Step 8. Specify the name of the intent and press Enter