top of page

Blueprint: How I Built the AI Lead Finder & Marketing Audit Agent

  • Writer: Moiz Deshmukh
    Moiz Deshmukh
  • Jul 10, 2025
  • 2 min read




1. Objective


✅ Build an AI-powered tool that:


  • Finds local businesses in any location & category.

  • Performs a quick marketing audit: website speed, UX, SEO, social media presence.

  • Generates smart outreach hooks & suggestions.


✅ Make it fast, user-friendly, and accessible via a simple web app (no coding needed for end users).



2. Technology Stack

Layer

Tools Used

Purpose

Frontend + UI

Streamlit

To build a lightweight, Python-based interactive app

AI / NLP

OpenAI GPT-3.5 via openai lib

To analyze business websites and generate insights

Data Source

SerpAPI for Google Maps

To fetch local business listings dynamically

Python Libraries

requests, pandas, json

For API calls, data processing, and structuring tables


3. Core Components


a) Local Business Data via Google Maps


  • API used: SerpAPI

  • Endpoint: google_maps engine

  • Data fetched:

    • Company Name

    • Website URL

    • Type / Category

    • Ratings & Reviews


This allowed the agent to dynamically pull businesses based on:


b) Marketing Analysis with GPT


  • API used: OpenAI (via the openai Python package)

  • Model: gpt-3.5-turbo


Prompted GPT to:


  • Act as a digital marketing consultant.

  • Review the business type, name, and website.

  • Return a JSON with fields like:

    • insight: overall marketing note

    • hook: outreach line

    • speed: guess on site speed

    • theme: UI / UX theme suggestions

    • seo: quick SEO improvements

    • social: social presence guess


This made it easy to parse into a neat pandas DataFrame.


c) Classification of Ratings


Added a simple helper:

This helped highlight brands that might be underperforming in reputation.


4. Building the UI with Streamlit


Used Streamlit because it:


✅ Requires minimal setup.

✅ Allows python + markdown + HTML styling.

✅ Easy to deploy on Streamlit Cloud.


Added custom styling with:

  • st.markdown and embedded <style> to change background colors, buttons, and text colors.

  • Download CSV button to let users save the leads.



5. How it all connects















6. Key Features Implemented


✅ Enter any business type & location — dynamic results.

✅ One-click Get Leads to process.

AI marketing audit runs instantly.

✅ Download leads as CSV.

✅ Clean, responsive UI with custom theme.



7. Challenges & Solutions

Challenge

How I solved it

Avoiding API key exposure

Stored keys in secrets.toml (Streamlit native way)

Handling bad JSON from GPT

Used try...except for json.loads()

Rate limiting on GPT calls

Added time.sleep(1) between calls

Styling Streamlit cleanly

Embedded CSS inside markdown

8. Tools Recap

Tool

Why I chose it

Streamlit

Quick Python-based UI & deploys easily

SerpAPI

Simplifies scraping Google Maps data

OpenAI GPT

Strong text analysis & suggestions

Pandas

Structure data & generate CSVs

Requests

Easy REST API calls

9. How You Can Try or Customize It


✅ Clone my GitHub repo

✅ Put your API keys into .streamlit/secrets.toml





Done!


Need Any Help? Connect with Me!!!

 
 
 

Comments


bottom of page