Google – Reviews

前言

繼上一篇 Facebook – Reviews (Graph API) 後, 這篇繼續介紹另一個 Reviews 大平臺 Google Reviews.

想通過 API 獲取 Google Reviews 難度比 Facebook Reviews 高了一個量級哦!

 

參考

Docs – Work with review data

 

概念

要想通過 API 獲取 Google Business Reviews.

需要 integrate 整套 OAuth 和 Business Profile APIs.

Google 這套機制是爲 Third Party 公司設計的. 如果我們的需求只是想把公司的 Reviews 拉下來放到網站做展現. 真的是小題大做. 但也沒有其它辦法了.

關於 OAuth 的機制可以看這篇 Identity – 安全基礎知識, Google 使用的是 OAuth 2.0 + authorization code flow.

簡單說就是 User 訪問 App, 然後登入 Google 賬號並授權給 App 讓 App 有權限訪問 Google Reviews.

這個 App 就是網站, User 就是公司老闆, Google Reviews 就是公司的 Reviews.

 

Prerequisites

參考: Docs – Prerequisites

1. 需要有一個 Google Account (最好是有給錢的 workspace, 下面會提到好處)

2. 開通 Google Cloud (要有一個 Project), 之前介紹 Google Maps Embed API & JavaScript API 也是需要 Google Cloud, 可以回去參考以下.

3. 需要開通 Google Business (這個自然啦, 不然那來的 reviews 呢)

4. 需要提交申請, 這個超級麻煩的咯...

到 Business Profile APIs: Application Form For Basic Access 填寫表格.

有幾個地方要特別注意

1. Project ID & Number 

它指的是 Google Cloud Project 的 ID 和 Number

到 Google Cloud > 選定 Project > Project settings

這裏

2. Your Email

這個 email 必須和網站 domain 一致. @gmail, @hotmail 都不行.

3.Third-party / Agency

third-party 就表示, App 不是企業網站, 而是一個讓 User 管理 Google Reviews 的 Web App.

我的項目自然是選 Local Business 了.

4. 提交後 Confirmation

提交後幾天, Google 會發一封 confirmation email 到上面的電郵地址.

reply confirm 後, 幾天內就會收到申請成功的通知

 

Basic setup

參考: Docs – Basic setup

申請批准以後, 我們就可以開始一些 basic setup 了 (before 我們發送 Reviews API)

Enable the APIs

首先要去 Google Cloud enable API, 這個和做 Google Map 類似, 都是要先 enable 纔可以用

下面這些全部都要 enable

  • Google My Business API
  • My Business Account Management API
  • My Business Lodging API
  • My Business Place Actions API
  • My Business Notifications API
  • My Business Verifications API
  • My Business Business Information API
  • My Business Q&A API

到 Google Cloud > Apis & Services > Library

搜索

點擊 enable (我已經 enable 了所以變成 manage)

 

記得, 全部都要 enable 哦.

OAuth 2.0 Setup

接着要去 Google Cloud 創建 App 獲取 Client ID 和 Secret 了.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章