Integrate PurpleAir API with Your Air Quality Monitor

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


Purple Air Integration Guide

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

Overview

PurpleAir provides real-time air quality data from a network of sensors worldwide. The service offers detailed air quality measurements including PM2.5, PM10, temperature, and humidity data. It features both current and historical air quality data, with particular focus on particulate matter monitoring through its network of low-cost sensors.

Integration Steps

1. Review API Documentation

First, visit the Purple Air 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_purple_air_data

Description: Get data using Purple Air

URL: https://www2.purpleair.com/?ref=public_apis&utm_medium=website

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_purple_air_data action to your chatbot

Using the Integration

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

  • What's the current air quality in my neighborhood?
  • Show PM2.5 levels in Los Angeles
  • Compare air quality between different cities

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

Additional Resources