Integrate AQICN API with Your AI Agent

Learn how to integrate AQICN API with your AI agent for real-time air quality information.


AQICN Integration Guide

This guide will walk you through integrating the AQICN API with your OpenAssistantGPT chatbot.

Overview

AQICN provides comprehensive air quality monitoring data for over 1000 cities worldwide through its World Air Quality Index project. The service aggregates data from over 12,000 monitoring stations, offering real-time air quality measurements including PM2.5, PM10, Ozone, NO2, SO2, and CO levels. It features historical data analysis, pollution forecasting, and health recommendations based on current air quality conditions. The API also provides detailed information about pollution sources, weather conditions affecting air quality, and trends analysis, making it invaluable for environmental monitoring, health applications, and urban planning.

Integration Steps

1. Review API Documentation

First, visit the AQICN API documentation to understand the available endpoints and how they work.

2. Create Custom Action

In your OpenAssistantGPT dashboard:

  1. Go to the Actions Dashboard
  2. Click "Create New Action"
  3. Chose Get or Post
  4. Fill the action form with the following details:

Name: get_aqicn_data

Description: Get data using AQICN

URL: https://aqicn.org/api/

Parameters: This will depend on the API you are integrating. Parameters are query parameters passed in the URL.

3. Assign Action to Your Chatbot

  1. Go to your Chatbot Dashboard
  2. Select your chatbot
  3. Go to "Settings" > "Actions"
  4. Add the get_aqicn_data action to your chatbot

Using the Integration

Your chatbot can now handle weather-related queries. Here are some example questions you can ask:

  • What's the air quality index in Beijing?
  • Is the air quality good for outdoor exercise in Delhi?
  • Show me PM2.5 levels in Shanghai

The chatbot will automatically use the AQICN API to fetch and return the requested information.

Additional Resources