> ## 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 Business Profile（前身为 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>
  在与 Ayrshare 关联之前，你必须[认领](https://support.google.com/business/answer/2911778)你的 Google Business Profile 主页。请在链接授权期间选择作为 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 控制台中带有 "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）

标准本地帖子出现在 "*Posts*" GBP 部分，并归类为 "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 端的错误。
  请联系 [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`：徽标照片。</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" 操作按钮。你还可以在帖子中包含照片、描述、优惠券代码、链接以及条款和条件。例如，一家玩具店可能会宣传所有毛绒玩具一周内八折。

使用 `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` 参数是用户点击后将被引导到的 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)。
