Systems Library / Customer Service / How to Build an AI Review Response Generator
Customer Service review management

How to Build an AI Review Response Generator

Generate professional review responses using AI for Google and Yelp.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

An ai review response generator for google and yelp writes thoughtful, unique replies to every review in seconds. I build these for businesses that get 10+ reviews per week and cannot keep up with responses. The AI reads the review, matches the tone, and generates a response that sounds personal, not templated.

Responding to every review matters for SEO and customer retention. Google factors response rate into local rankings.

What You Need Before Starting

Step 1: Build the Response Generator

import anthropic

client = anthropic.Anthropic()

SYSTEM_PROMPT = """You are writing review responses for {business_name}.
Business type: {business_type}
Tone: Professional, warm, and genuine. Never generic.

Rules:
- Reference specific details from the review
- Thank them for specific feedback, not just "thanks for your review"
- For positive reviews: acknowledge what they liked, invite them back
- For negative reviews: apologize sincerely, address the specific issue, offer to make it right
- Include the owner/manager first name: {owner_name}
- Keep responses 50-100 words
- Never be defensive on negative reviews
- Never use the phrase "We appreciate your feedback"
"""

def generate_response(review_text, star_rating, reviewer_name, business_config):
    response = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=200,
        system=SYSTEM_PROMPT.format(**business_config),
        messages=[{
            "role": "user",
            "content": f"Review from {reviewer_name} ({star_rating} stars):\n{review_text}"
        }]
    )
    return response.content[0].text

Step 2: Handle Different Star Ratings

Adjust the approach based on rating:

def get_response_strategy(star_rating):
    if star_rating >= 4:
        return "positive"
    elif star_rating == 3:
        return "neutral"
    else:
        return "negative"

def generate_with_strategy(review, business_config):
    strategy = get_response_strategy(review["rating"])

    strategy_context = {
        "positive": "This is a positive review. Be grateful and specific. Invite them back.",
        "neutral": "This is a mixed review. Acknowledge the positives, address concerns briefly.",
        "negative": "This is a negative review. Apologize sincerely. Address the specific issue. Offer to resolve it offline."
    }

    enhanced_prompt = f"{strategy_context[strategy]}\n\nReview from {review['name']} ({review['rating']} stars):\n{review['text']}"

    response = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=200,
        system=SYSTEM_PROMPT.format(**business_config),
        messages=[{"role": "user", "content": enhanced_prompt}]
    )
    return response.content[0].text

Step 3: Batch Process Reviews

Process all unresponded reviews at once:

def process_pending_reviews(business_config):
    pending = get_unresponded_reviews()
    responses = []

    for review in pending:
        response_text = generate_with_strategy(review, business_config)
        responses.append({
            "review_id": review["id"],
            "platform": review["platform"],
            "response": response_text,
            "rating": review["rating"]
        })
        save_draft_response(review["id"], response_text)

    return responses

Step 4: Review Before Publishing

Present drafts for approval before posting:

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route("/approve-response", methods=["POST"])
def approve_response():
    data = request.json
    review_id = data["review_id"]
    action = data["action"]

    if action == "approve":
        draft = get_draft(review_id)
        post_response(review_id, draft)
        mark_responded(review_id)
    elif action == "edit":
        post_response(review_id, data["edited_text"])
        mark_responded(review_id)

    return jsonify({"status": "posted"})

Step 5: Track Response Patterns

Log what works to improve future responses:

def analyze_response_quality(days=30):
    conn = sqlite3.connect("reviews.db")
    responses = conn.execute("""
        SELECT r.rating, resp.action, resp.response_text
        FROM reviews r
        JOIN responses resp ON r.id = resp.review_id
        WHERE resp.created_at > datetime('now', ?)
    """, (f"-{days} days",)).fetchall()

    approved = sum(1 for r in responses if r[1] == "approve")
    edited = sum(1 for r in responses if r[1] == "edit")

    return {
        "total": len(responses),
        "auto_approved": approved,
        "edited": edited,
        "approval_rate": round(approved / len(responses) * 100, 1) if responses else 0
    }

What to Build Next

Add platform-specific formatting. Google Business responses have different character limits and conventions than Yelp or TripAdvisor. Tailor the response style to match each platform's norms.

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems