Work / Case study
Case study · AI automation · Local SEO

Building an AI Google Business Profile post generator with guardrails

Agencies are starting to automate Google Business Profile posts with AI: approved photos go in, AI drafts the posts, guardrails catch risky wording, and a person approves before anything goes live. I built a working version of the middle of that pipeline as a free tool on my site, so I could learn the workflow by shipping it.

Role

Idea, prompt design, development

Timeline

Nov 2026 · 1 day

Platform

WordPress · Claude API · WP REST API

GBP post generator case study cover: a Google Business Profile post draft beside a guardrail checklist with every check passed and an Approved button
3

Drafts per brief

update, offer, tip
6

Guardrail checks

server and browser
~11s

Per run

in my first live test
5

Runs per hour

per visitor, plus a daily cap
0

Auto-published posts

a human approves first
01 — The idea

AI drafts, people decide

A teammate shared that other agencies have fully automated GBP posts: they link a Google Drive folder of approved images to each client, AI writes the posts within set guardrails, and someone quickly reviews and publishes. For med spa and dental clients that last part matters. One careless “guaranteed results” can break Google’s rules or a client’s compliance, so I set a few rules before building:

  • Guardrails in two places. The prompt tells the AI the rules, and the server checks every draft again, because a prompt alone isn’t a guarantee.
  • Nothing goes out without a person. Drafts land in a review step. Approve stays blocked while any check fails.
  • Never invent offers. Prices, discounts and dates appear only if the brief includes them.
  • Safe to leave public. Rate limits, a daily cap and caching keep the API bill predictable.
Claude API
WP REST API
Prompt design
Guardrails
Vanilla JS
Code Snippets
Local SEO
Google Business Profile
02 — How it works

Five steps, three of them live

The full pipeline has five steps. The public demo runs steps 2 to 4; steps 1 and 5 are what a client setup adds.

  • 1. Approved photos. In a client setup, each business has a Drive folder of photos it has already approved. The demo suggests which photo would fit each post.
  • 2. AI drafts. A short brief (business, city, service, offer, tone, brand rules) becomes three different posts: an update, an offer if one was given, and a tip or FAQ.
  • 3. Guardrails. Every draft is checked for length, phone numbers, links, risky medical or outcome claims, a local mention and a call-to-action button.
  • 4. Human review. Each draft is shown as a Google-style post next to its checklist. You can edit it, and the checks re-run as you type, then approve or copy it.
  • 5. Publish. Approved posts go to the client’s Business Profile. In production this is a scheduled job; in the demo, you copy the text.
03 — Build

A small API with the rules built in

The tool is one Code Snippet: a WordPress REST endpoint, a shortcode for the interface and a little CSS. It reuses the same secure server-side connection to the Claude API as the “check my fit” assistant on my homepage, so the API key never reaches the browser.

  • Structured output. The AI must return JSON with a type, title, body, call-to-action and photo idea for each post. The server pulls out the JSON, validates every field and whitelists the post types and buttons.
  • Same rules, both sides. The guardrail list lives in PHP and is passed to the browser, so a post the server flagged and a post you edit are judged by identical rules.
  • Built to look familiar. Drafts render like a real Business Profile post, so a reviewer sees what customers will see.
// Server-side guardrail: flag risky claims, even if the prompt was ignored
foreach ( hjm_gbp_banned() as $w ) {
  if ( false !== mb_strpos( $low, $w ) ) $hit[] = $w;
}
$checks[] = [ 'claims', $hit ? 'fail' : 'ok',
  $hit ? 'Risky claim: ' . implode( ', ', $hit ) : 'No guarantees or medical claims' ];

Edge cases I designed for

Models don’t always return clean JSON

Sometimes an answer comes wrapped in extra words. The server extracts the first JSON object, rejects anything missing posts, and cleans every field before it reaches the page.

A prompt is a request, not a rule

The AI is told to avoid claims like “guaranteed” or “painless”, but the server still checks every draft, and I tested it by editing a draft to break the rules on purpose.

A public AI tool can get expensive

Each visitor gets 5 runs an hour, every run counts toward a shared daily cap, and identical briefs are served from a 24-hour cache.

Approve has to mean something

The Approve button won’t work while any check fails. It shakes instead, so a risky post can’t slip through with one click.

04 — What I learned

Local SEO is mostly consistency

Building this taught me why agencies care so much about Google Business Profile: for local businesses it’s often where customers first meet them, and regular, accurate posts keep the profile active. It also showed me where AI fits best: drafting quickly within clear rules, with a person making the final call.

What I’d build next

Connect step 1 to a real Drive folder per client, add a review queue the agency team can share, and publish approved posts on a schedule through Google’s Business Profile API.

NEXT PROJECT

Have a site to build or fix?

Tell me about the project, or about a role you’re hiring for. I reply within one business day.