Free usage is now available on puq.ai
Integrations Templates Models Blog Pricing
Ai Agents

Build an AI Chat Agent with GPT-4o for Weather & News Queries

Create an intelligent chat agent using GPT-4o that interprets user intent and automatically routes to the right tool, fetching real-time weather from OpenWeatherMap or news headlines from NewsAPI.

1.9K uses 4.7 rating 8 min setup
Use this template Free to start · 8 min setup
See how it works
Works with Webhook integration OpenAI integration OpenWeatherMap integration
Template preview

The workflow at a glance

Use this template as a starting point, connect the apps it needs, then adapt the steps to your own workflow.

Use this template

Everything this workflow handles

Build a production-ready AI chat agent that understands natural language and automatically selects the right tools to answer questions. This puq.ai template uses GPT-4o to interpret user intent, route requests to appropriate APIs, and format responses — all accessible via a simple webhook endpoint.

Designed for developers building intelligent chatbots and conversational interfaces, this workflow demonstrates the agentic pattern of AI tool selection while providing real utility through weather and news integrations.


How This Automation Works

1. Receive Chat Messages via Webhook

The workflow exposes a POST endpoint at /chat that accepts user messages in JSON format, ready to integrate with any chat interface.

2. AI Intent Detection with GPT-4o

GPT-4o analyzes the user message and determines which tool to use:

  • Weather Tool — When users ask about weather, temperature, or conditions
  • News Tool — When users request news, headlines, or current events
  • Direct Answer — When no external data is needed

3. Intelligent Parameter Extraction

The AI extracts relevant parameters from natural language:

  • Location names for weather queries ("What's the weather in Tokyo?")
  • Topics for news queries ("Show me news about AI")

4. Weather Tool Path

Weather requests are processed through:

  • OpenWeatherMap API — Fetches real-time weather data
  • GPT-4o-mini Formatting — Converts API data to friendly response with practical advice (umbrella, sunscreen, etc.)

5. News Tool Path

News requests are processed through:

  • NewsAPI — Retrieves latest articles by topic
  • GPT-4o-mini Summarization — Creates concise headline summaries

6. Structured Webhook Response

All paths return structured JSON responses via webhook, making integration with chat UIs, Slack bots, or custom applications seamless.


Key Benefits

  • Agentic AI with automatic tool selection
  • Natural language understanding via GPT-4o
  • Real-time weather data integration
  • Current news retrieval and summarization
  • Webhook-based API for easy integration
  • Structured JSON responses
  • Fallback to direct AI answers
  • Production-ready error handling

Use Cases

  • Building custom AI chatbots
  • Adding AI capabilities to existing applications
  • Creating Slack or Discord bots with real-time data
  • Prototyping conversational AI interfaces
  • Learning agentic AI patterns
  • Building voice assistant backends

Integrations Used

  • Webhook — HTTP endpoint for chat messages and responses
  • OpenAI GPT-4o — Intent detection and tool selection
  • OpenAI GPT-4o-mini — Response formatting and summarization
  • OpenWeatherMap — Real-time weather data API
  • NewsAPI — Current news articles by topic

Why Use This puq.ai Template?

Building AI agents from scratch requires complex orchestration logic. This template provides a working agentic pattern you can extend — demonstrating tool selection, parameter extraction, API integration, and response formatting in a production-ready package.

With puq.ai, you deploy an intelligent chat agent in minutes — no backend code, no orchestration complexity, no API plumbing.


Get Started in Minutes

  • Import the template into puq.ai
  • Connect your OpenAI account
  • Add your OpenWeatherMap API key
  • Add your NewsAPI key
  • Get your webhook URL and start sending messages
  • Integrate with your chat interface or application

Ask anything. Route intelligently. Respond naturally.

Use this template to build AI-powered chat agents that understand intent and fetch real-time data — powered by GPT-4o intelligence and orchestrated by puq.ai.

Questions before you start

Do I need to write code to use this?

No. This is a pre-built workflow — you connect your accounts and adjust settings in puq.ai's visual editor. No custom code required.

How long does setup actually take?

Most people have this workflow running in about 8 min setup. You're connecting accounts and mapping a few fields for Webhook, OpenAI, and OpenWeatherMap — not building the automation from scratch.

What if I don't use one of these apps?

You can swap any step for another supported app inside the workflow builder after you open the template — the trigger-to-action structure stays the same.

What happens after I click "Use this template"?

You'll be taken to your puq.ai workspace with this workflow pre-loaded — connect Webhook, OpenAI, and OpenWeatherMap, adjust any settings, and turn it on.

Can I customize the workflow after I import it?

Yes — this template is a starting point, not a fixed script. Add, remove, or rewire steps freely once it's in your workspace.

Is my data safe when I connect an app?

You control which accounts you connect, and you can disconnect any integration at any time from your puq.ai dashboard.

Webhook AI chatbot OpenAI GPT-4o agent OpenWeatherMap integration NewsAPI automation AI chat agent
Use this template
Automate Every Job

Ready to put "Build an AI Chat Agent with GPT-4o for Weather & News Queries" to work?