GBP — Current Implementation
Leadmetrics has a substantial GBP integration already in place. This document describes what is currently built and where to find it.
Channel Connection
OAuth flow using Google’s business.manage scope. Supports multi-location accounts — after OAuth the user is presented with a location picker and the selected location is stored as subChannelInfo on the ConnectedChannel record.
Key files:
apps/api/src/routers/channel-connect.ts—GET /google-business-profile/connect,/callback,/page/selectpackages/providers/google/src/google-business-profile.ts—GoogleBusinessProfileServicepackages/providers/google/src/types.ts—GoogleBusinessProfileConfig,GBPLocation,GBPMetricsResult,GBPReview
AI Agents
GBP Post Writer
- Queue:
agent__gbp-post-writer(BullMQ, concurrency 4) - Model: Claude Haiku 4.5
- Cost: 1 credit/post
- Typical volume: 4–12 posts/month
- Post types: offer, update, event
- Input: business info + topic → produces a GBP post following character limits, local keywords, and CTA best practices
- File:
packages/agents/src/workers/gbp-post-writer.worker.ts
Review Response Writer
- Queue:
agent__review-response-writer(BullMQ, concurrency 4) - Model: Claude Sonnet 4.6
- Plan gate: Pro+ minimum
- Input: a single review → drafts a response + classifies the review by sentiment
- HITL rules:
- 1–3 star reviews: mandatory human approval before posting
- 4–5 star reviews: bulk-approvable
- Trigger: reactive — fires when a new review is synced from GBP or Facebook
- File:
packages/agents/src/workers/review-response-writer.worker.ts
Note — Review notifications not yet implemented.
Google Business Profile has no native webhooks. New review alerts will be delivered via Google Cloud Pub/Sub (mybusinessnotifications.googleapis.com). Implementation is deferred — seeroadmap.md§1 for the full plan.
GBP Insights Analyst
- Queue:
agent__gbp-insights(BullMQ, concurrency 3) - Model: Claude (via
GoogleBusinessProfileInsightsAnalystagent config) - Data fetched from GBP API: views, call clicks, website clicks, direction requests, conversations, bookings — current period vs prior period
- Output: structured insight report with delta percentages
- File:
packages/agents/src/workers/insights/gbp-insights.worker.ts
Dashboard UI
The GBP channel detail page (apps/dashboard/src/app/(dashboard)/channels/[id]/GoogleBusinessProfileChannelDetail.tsx) has four tabs:
| Tab | Content |
|---|---|
| Overview | Stat blocks: views, call clicks, website clicks, direction requests, conversations, bookings (current vs prior period with delta %) |
| Profile Views | Daily performance charts — Maps Mobile, Maps Desktop, Search Mobile, Search Desktop breakdown |
| Search Terms | Monthly keyword impressions sourced from GBP Search Keywords API |
| Reviews | Paginated review list with star ratings and current reply display |
GBP posts also appear in:
- Calendar — filterable by
gbp_postactivity type (MapPin icon, violet theme) - Deliverables —
gbp_postdeliverable type - Activities —
gbp_postin activity utils - Insights page — GBP is a supported channel type
Google Provider API Methods
Located in packages/providers/google/src/google-business-profile.ts:
| Method | Description |
|---|---|
getAllLocations(token) | Lists all business locations across all accounts |
getMetrics(locationName, token, start, end) | Fetches 9 daily performance metrics |
getSearchKeywords(locationName, token, start, end) | Monthly keyword impressions |
getReviews(locationName, token, pageSize, pageToken) | Paginated reviews with star ratings and existing replies |
Knowledge Base Documents (seeded)
- GBP Post Best Practices — character limits, local keyword guidance, CTA best practices (seed:
packages/db/src/seed.tsline ~682) - Review Response Guide — local SEO signals from responding, tone guidance, sentiment classification (seed:
packages/db/src/seed.tsline ~1112)