Skip to main content

Creating a bot with API requests

In this section, we will create a bot, which reports current weather in any city receiving data through API requests to OpenWeatherMap. We’ll also make a list of basic functions for HTTP requests and show you how to process them.

First, we recommend you to study the bot project structure and read the tutorial Creating a simple bot.

What is API?

API is an interface for programming applications. API allows developers to use existing functions or blocks in their program code. In this tutorial, we show you how to develop a bot that reports current weather in any city. Meteorological data will be obtained from OpenWeatherMap API.

To run the bot, follow the steps:

  1. Get an API key and set up a configuration file.
  2. Create a function to call OpenWeatherMap API.
  3. Create a script.
  4. Test the bot script.