> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Business Profile API

> 使用 Google Business Profile API 發布內容的選項

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

## 發布到 Google Business Profile

透過 Google Business Profile API（前身為 Google My Business）可以建立四種類型的貼文。
在下方範例中，`post` 文字會以更新內容的形式發布到使用者的 Google 商家頁面。
[進一步了解](https://www.ayrshare.com/blog/google-my-business-what-is-gmb-why-you-need-it-and-how-to-use-it/) Google Business Profile（GBP）。

<Warning>
  在將 Google Business Profile 頁面連結到 Ayrshare 之前，你必須先[認領](https://support.google.com/business/answer/2911778)你的頁面。授權連結時，請務必選擇管理該 GBP 頁面的 Google 帳號。此外，該商家檔案必須已通過驗證且為公開狀態。

  你可以在 [https://business.google.com/](https://business.google.com/) 存取 GBP 管理主控台並查看驗證狀態。
</Warning>

目前無法透過 Google Business Profile API 建立產品貼文。

發布純文字貼文到 GBP 的 JSON 範例，該貼文會出現在 "What's New" 區塊中：

```json Google Business Profile Post theme={"system"}
{
  "post": "The best GMB ever #best https://www.google.com",
  "platforms": ["gmb"] // Please note to use `gmb`
}
```

或是發布含圖片的基本貼文到 GBP 的 JSON 範例：

```json Google Business Profile Post with Image theme={"system"}
{
  "post": "The best GMB ever #best https://www.google.com",
  "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"],
  "platforms": ["gmb"]
}
```

<ul class="custom-bullets">
  <li>
    如果你的影片副檔名不是常見的影片格式（例如 mp4），請使用 `isVideo`
    參數。詳情請參閱 [/post 端點](/apis/post/overview)。
  </li>

  <li>
    更多資訊請參閱 [Google Business Profile 媒體指南](/media-guidelines/google_business_profile) 與 [Google Business Profile 授權](/dashboard/connect-social-accounts/google-business)。
  </li>
</ul>

## Google Business Profile 發布規範

請確認你的貼文不包含以下內容。否則 Google 會拒絕該貼文，貼文會顯示為 "This post is no longer available"，或在 Google Console 中顯示 "Rejected" 標籤：

<ul class="custom-bullets">
  <li>電話號碼。Google 會拒絕所有包含電話號碼的貼文。</li>
  <li>垃圾內容、不實聲明或虛假陳述。</li>
  <li>與商家業務無關的離題貼文。</li>
  <li>重複內容。</li>
  <li>不當內容。</li>
  <li>冒犯性用語。</li>
</ul>

更多資訊請參閱 [Google Business Profile 的內容政策](https://support.google.com/business/answer/7213077?hl=en)。

## 標準貼文（What's New）

標準的在地貼文會出現在 GBP 的「*Posts*」區塊，並歸類為 "What's New"。
此類貼文可包含文字、圖片，或行動呼籲按鈕（[請見下方](/apis/post/social-networks/google#call-to-action)）。

透過 Google Business Profile API 無法將影片發布到 What's New 區塊。
若要將影片發布到 Google Business Profile，請參閱 [圖片或影片貼文](#image-or-video-post)。

*這類貼文會顯示在 GMB 管理主控台的「**Posts -> What's New**」區塊。*

```json Google Business Profile Standard Post theme={"system"}
{
  "post": "A wonderful post",
  "platforms": ["gmb"],
  "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"], // optional - images only
  "gmbOptions": {
    "callToAction": {
      // optional
      "actionType": "learn_more",
      "url": "https://www.ayrshare.com"
    }
  }
}
```

## 圖片或影片貼文

你可以將圖片或影片貼文發布到 Google Business Profile。
圖片與影片會顯示在 GBP 管理主控台的「**Photos**」區塊。

### 需求

<ul class="custom-bullets">
  <li>
    每次只能為 GBP 位置新增一張圖片或一部影片，並會顯示在 GBP 主控台的 "Photos"
    區塊。
  </li>

  <li>每則貼文只能包含一張圖片或一部影片。</li>
  <li>端點要求必須提供貼文文字，但該文字不會被 GBP 使用。</li>
  <li>圖片或影片貼文不支援行動呼籲按鈕。</li>
  <li>請務必在 `gmbOptions` 物件中加入 `isPhotoVideo` 參數。</li>
</ul>

```json Google Business Profile Image Post {6} theme={"system"}
{
  "post": "What an image!",
  "platforms": ["gmb"],
  "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"], // required
  "gmbOptions": {
    "isPhotoVideo": true, //required
    "category": "product" // optional
  }
}
```

### 影片處理

Google 有時處理已上傳的影片會花較長的時間。

你可以在 Google Business Profile 主控台檢視媒體的狀態：

1. 前往你的 [Google Business Profile 主控台](https://business.google.com/us/business-profile/)。
2. 點擊「See your profile」按鈕，會被導向 GBP 頁面。
3. 點擊「Photos」分頁。
4. 你會看到照片與影片的清單。
5. 點擊你想檢視的照片或影片。

<Warning>
  如果你的影片狀態顯示為 "pending"，代表 Google 仍在處理中。請稍候幾分鐘後重新整理頁面。
  也請確認你的 Google Business Profile 已通過驗證且為公開狀態。

  如果影片一直卡在 "pending" 狀態，可能是 Google 端的 bug。
  請聯絡 [Google Business 客服](https://support.google.com/business/gethelp) 尋求協助。
</Warning>

### 產品類別

你可以為圖片或影片指定產品類別，讓媒體在 GBP 主控台的「Photos」區塊中分類。例如，若圖片的類別為 "product"，就會出現在 Photos 中的「Product」分頁下。

某些類別無法用於特定的商家類型。例如，Ayrshare 不能使用 `food_and_drink`，因為我們並非餐飲業。

可用的類別：

<ul class="custom-bullets">
  <li>`cover`：封面照片。每個位置只有一張封面照片。</li>
  <li>`profile`：個人檔案照片。每個位置只有一張個人檔案照片。</li>
  <li>`logo`：Logo 照片。</li>
  <li>`exterior`：外觀媒體。</li>
  <li>`interior`：內部空間媒體。</li>
  <li>`product`：產品媒體。</li>
  <li>`at_work`：工作情境媒體。</li>
  <li>`food_and_drink`：餐飲媒體。</li>
  <li>`menu`：菜單媒體。</li>
  <li>`common_area`：公共區域媒體。</li>
  <li>`rooms`：房間媒體。</li>
  <li>`teams`：團隊媒體。</li>
</ul>

## 活動貼文

宣傳你的商家活動。活動貼文需要標題、開始與結束日期，並可包含影片。例如，房仲業者可以刊登看屋開放活動。

<ul class="custom-bullets">
  <li>活動貼文支援行動呼籲按鈕。</li>
  <li>可透過 `mediaUrls` 參數加入選擇性圖片。</li>
  <li>活動貼文不支援影片。</li>

  <li>
    活動貼文會顯示在 GBP 管理主控台的「**Posts -> Events**」區塊。
  </li>

  <li>`post` 文字會作為活動詳細資訊使用。</li>
</ul>

```json Google Business Profile Event Post theme={"system"}
{
  "post": "A great event!", // Event Details
  "platforms": ["gmb"],
  "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"], // optional
  "gmbOptions": {
    "event": {
      "title": "Check this event out.", // required
      "startDate": "2021-08-12T20:17:46.384Z", // required
      "endDate": "2021-09-12T20:17:46.384Z" // required
    }
  }
}
```

## 優惠貼文

提供你的商家促銷或優惠。優惠貼文需要標題以及開始與結束的日期時間。系統會自動為貼文加上「View offer」行動按鈕。你也可以在貼文中加入照片、說明、優惠代碼、連結與條款細則。例如，玩具店可以刊登為期一週、所有 beanie babies 8 折的優惠。

透過 `mediaUrls` 參數加入圖片。

*優惠貼文不支援影片。*

*這類貼文會顯示在 GBP 管理主控台的「**Posts -> Offers**」區塊。*

```json Google Business Profile Offers Post theme={"system"}
{
  "post": "A great offer for everyone!",
  "platforms": ["gmb"],
  "gmbOptions": {
    "offer": {
      "title": "Great Sale.", // required
      "startDate": "2021-08-12T20:17:46.384Z", // required
      "endDate": "2021-09-12T20:17:46.384Z", // required
      "couponCode": "BOGO-JET-CODE", // required - max 58 characters
      "redeemOnlineUrl": "https://www.ayrshare.com", // required
      "termsConditions": "Offer only valid if you can prove you are a time traveler" // required
    }
  }
}
```

<ul class="custom-bullets">
  <li>`couponCode` 最多 58 個字元。</li>
</ul>

## 行動呼籲

提供關於你的商家的一般資訊，並以行動按鈕的形式呈現。例如，網站可能會顯示 *Learn More* 按鈕，將使用者引導至其官方網站。

行動呼籲按鈕可加在標準貼文或活動貼文上，優惠貼文則無法加入行動呼籲按鈕。

透過 `mediaUrls` 參數加入圖片。

```json Google Business Profile Call to Action Post theme={"system"}
{
  "post": "Take this action!",
  "platforms": ["gmb"],
  "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"], //optional
  "gmbOptions": {
    "callToAction": {
      "actionType": "order", // required
      "url": "https://www.ayrshare.com" // required for all action types but "call"
    }
  }
}
```

`actionType` 會以按鈕的形式顯示在貼文上。可能的值有：

<ul class="custom-bullets">
  <li>**book**：提示使用者預約、訂位或類似操作。</li>
  <li>**order**：提示使用者訂購某項商品。</li>
  <li>**shop**：提示使用者瀏覽產品目錄。</li>
  <li>**learn\_more**：提示使用者在網站上查看更多資訊。</li>
  <li>**sign\_up**：提示使用者註冊、加入或報名。</li>

  <li>
    **call**：提示使用者致電商家。使用 `call` 時不需要 `url` 欄位，
    但你必須先在 Google Business Profile 中設定電話號碼，通話動作按鈕才會出現在貼文上。
  </li>
</ul>

`url` 參數是使用者點擊後會被導向的網址。

更多 [Google Business Profile 資訊](https://www.ayrshare.com/blog/google-my-business-what-is-gmb-why-you-need-it-and-how-to-use-it/)。

<Card title="Google Business Profile 連結" icon="link" href="/dashboard/connect-social-accounts/google-business" horizontal />

## 首則留言

Google Business Profile 不支援貼文留言，因此對於僅發布到 Google Business Profile 的貼文，`firstComment` 參數會被略過。
系統會回傳一個 `firstComment` 的警告/略過物件，但貼文本身仍會發布成功，不會拋出錯誤。

## Google Business Profile 提及

雖然你可以在 Google Business Profile 貼文中加入 `@handle`，但 Google Business Profile 不支援解析貼文文字中的提及。
`@handle` 將保持為純文字顯示。

## 字元限制

更多資訊請參閱 [Google Business Profile 字元限制](/help-center/technical-support/character_limits#google-business-profile-character-limits)。
