我花了几个小时试图解决这个问题。 我需要订阅gmb业务到pub / sub推送通知。我能够通过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"
}
]
}
]
}
}
最后我找到了解决方案。您需要将主题中的Pub / Sub Publisher权限授予此帐户:'[email protected]。不知道为什么。
**正好是那个字符串