无法订阅GMB业务的发布/订阅推送通知

时间:2019-04-19 20:50:35

标签: google-api

我花了几个小时试图解决这些问题。
我需要订阅一个gmb企业来发布/订阅推送通知。我能够通过gcloud控制台发送/接收消息。成功创建主题和订阅。问题是我需要订阅gmb帐户,但出现此错误:

(必须编辑此问题,代码比图像更好)

请求:

PUT https://mybusiness.googleapis.com/v4/accounts/102834134483270918765/notifications
{
    "topicName": "projects/probable-pager-194417/topics/fetchReviews",
    "notificationTypes": [
    "NEW_REVIEW", "UPDATED_REVIEW", "GOOGLE_UPDATE"
  ]
}

响应:

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
        "errorDetails": [
          {
            "code": 3,
            "message": "Invalid topic name provided for subscription. Ensure that the topic exists and is shared with the GMB API service account.",
            "value": "projects/probable-pager-194417/topics/fetchReviews"
          }
        ]
      }
    ]
  }
}

1 个答案:

答案 0 :(得分:1)

最后我找到了解决方案。您需要在该主题中授予对此帐户的发布/订阅发布者权限:'mybusiness-api-pubsub@system.gserviceaccount.com。不知道为什么。

**正是那个字符串