124 lines
4.0 KiB
Markdown
124 lines
4.0 KiB
Markdown
# Google Business Profile API Setup Guide
|
|
|
|
This guide provides step-by-step instructions for setting up Google Business Profile (formerly Google My Business) API integration for managing reviews.
|
|
|
|
---
|
|
|
|
## Table of Contents
|
|
|
|
1. [Overview](#overview)
|
|
2. [Prerequisites](#prerequisites)
|
|
3. [Google Cloud Console Setup](#google-cloud-console-setup)
|
|
4. [Environment Configuration](#environment-configuration)
|
|
5. [OAuth Redirect URI Configuration](#oauth-redirect-uri-configuration)
|
|
6. [Permissions & Scopes](#permissions--scopes)
|
|
7. [Development vs Production](#development-vs-production)
|
|
8. [Troubleshooting](#troubleshooting)
|
|
|
|
---
|
|
|
|
## Overview
|
|
|
|
**API Version:** My Business API v4 / Account Management v1
|
|
**Base URL:** Google API Services
|
|
**Auth Method:** OAuth 2.0
|
|
|
|
### Features Supported
|
|
- Fetch business locations
|
|
- Read Google reviews for locations
|
|
- Reply to reviews as the business owner
|
|
- Monitor review ratings and feedback
|
|
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
- A Google account with owner/manager access to a Google Business Profile
|
|
- Access to [Google Cloud Console](https://console.cloud.google.com/)
|
|
- A verified business location on Google Maps
|
|
|
|
---
|
|
|
|
## Google Cloud Console Setup
|
|
|
|
### Step 1: Create a New Project
|
|
|
|
1. Navigate to [Google Cloud Console](https://console.cloud.google.com/)
|
|
2. Click on the project selector dropdown at the top
|
|
3. Click **"New Project"**
|
|
4. Enter project details:
|
|
- **Project Name:** e.g., "PX360 Social Integration"
|
|
- **Organization:** Select your organization (if applicable)
|
|
5. Click **"Create"**
|
|
6. Select your new project
|
|
|
|
### Step 2: Enable Required APIs
|
|
|
|
1. Go to **"APIs & Services"** → **"Library"**
|
|
2. Search for and enable the following APIs:
|
|
- **Google My Business API** (Note: May require verification)
|
|
- **My Business Account Management API**
|
|
- **My Business Business Information API**
|
|
|
|
> ⚠️ **Important:** Google My Business API requires approval from Google. You may need to fill out a form explaining your use case.
|
|
|
|
### Step 3: Configure OAuth Consent Screen
|
|
|
|
1. Go to **"APIs & Services"** → **"OAuth consent screen"**
|
|
2. Select **"External"** user type (unless you have a Google Workspace account)
|
|
3. Click **"Create"**
|
|
4. Fill in the required fields:
|
|
- **App Name:** Your application name
|
|
- **User Support Email:** Your support email
|
|
- **App Logo:** Upload your logo
|
|
- **Application Home Page:** Your website URL
|
|
- **Authorized Domains:** Your domain(s)
|
|
- **Developer Contact Email:** Your email
|
|
5. Click **"Save and Continue"**
|
|
6. Add scopes (click "Add or Remove Scopes"):
|
|
- `https://www.googleapis.com/auth/business.manage`
|
|
7. Click **"Save and Continue"**
|
|
8. Add test users (for development)
|
|
9. Click **"Save and Continue"**
|
|
|
|
### Step 4: Create OAuth 2.0 Credentials
|
|
|
|
1. Go to **"APIs & Services"** → **"Credentials"**
|
|
2. Click **"Create Credentials"** → **"OAuth client ID"**
|
|
3. Select **"Web application"**
|
|
4. Configure:
|
|
- **Name:** e.g., "PX360 Web Client"
|
|
- **Authorized JavaScript origins:**
|
|
- Development: `http://127.0.0.1:8000`
|
|
- Production: `https://yourdomain.com`
|
|
- **Authorized redirect URIs:**
|
|
- Development: `http://127.0.0.1:8000/social/callback/GO/`
|
|
- Production: `https://yourdomain.com/social/callback/GO/`
|
|
5. Click **"Create"**
|
|
6. **Download the JSON file** - This is your credentials file
|
|
|
|
### Step 5: Save Credentials File
|
|
|
|
1. Rename the downloaded JSON file to `gmb_client_secrets.json`
|
|
2. Place it in your project's `secrets/` directory:
|
|
```
|
|
your_project/
|
|
├── secrets/
|
|
│ └── gmb_client_secrets.json
|
|
└── ...
|
|
```
|
|
|
|
The JSON file structure should look like:
|
|
```json
|
|
{
|
|
"web": {
|
|
"client_id": "xxxxx.apps.googleusercontent.com",
|
|
"project_id": "your-project-id",
|
|
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
"token_uri": "https://oauth2.googleapis.com/token",
|
|
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
|
"client_secret": "your-client-secret",
|
|
"redirect_uris": ["http://127.0.0.1:8000/social/callback/GO/"]
|
|
}
|
|
}
|
|
``` |