Skip to main content

Configuration file setup

This article is a part of a tutorial about creating a bot which reports the current weather in any city of the world.

  1. Configuration file setup (you are here)
  2. HTTP request to OpenWeatherMap API
  3. Script development
  4. Testing

First, we will create an account on the OpenWeatherMap website, get a personal API key, and set up the bot configuration file.

Getting an API key

Let’s get an API key to the OpenWeatherMap service. The API key is used to identify a specific client, so the service determines what data can be given to the client.

  1. Sign in to your OpenWeatherMap account or create a new one.
  2. Go to the API keys tab and copy Default key or create a new one in the Create key field. We will store the API key in the chatbot.yaml configuration file.
tip
Learn more about OpenWeatherMap service in API documentation

Now, let’s move on to setting up the configuration file.

Configuration file

Create a chatbot.yaml bot configuration file and set the following parameters:

# Project name
name: weather-api
# Main file
entryPoint:
- main.sc

# Tovie NLP parameters:
botEngine: v2
language: en

nlp:
intentNoMatchThresholds:
phrases: 0.2
patterns: 0.2

# OpenWeatherMap API key
injector:
api_key: '***'
caution
Type your API key in quotes api_key: '***' instead of ***.

Next, move on to working with HTTP request.