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.
Idea, prompt design, development
Nov 2026 · 1 day
WordPress · Claude API · WP REST API

Drafts per brief
Guardrail checks
Per run
Runs per hour
Auto-published posts
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.
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.
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.
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.