Manage real-time notifications

In the My Business Notifications API, notifications are published in the Cloud Pub/Sub service. After you set up Cloud Pub/Sub and create a topic, you can perform the following operations on notifications:

New or updated reviews, questions and answers, media uploads, Google updates for review, location state changes, and more are supported. The NotificationType object lists and describes the available notification types.

Before you begin

To use the My Business Notifications API, register your application and obtain OAuth 2.0 credentials. For details on how to get started with the API, see Basic setup.

Cloud Pub/Sub setup

To set up API notifications with Cloud Pub/Sub, perform the following steps:

  1. Follow the Cloud Pub/Sub guide to set up your application.
  2. Create a topic in your Cloud Pub/Sub project and note the name of the created topic.
  3. Give at least pubsub.topics.publish permissions to mybusiness-api-pubsub@system.gserviceaccount.com.
  4. Follow the Subscriber overview guide to set up either push or pull notifications.
  5. To receive notifications, call the accounts.updateNotificationSetting endpoint in the My Business Notifications API. In the call, use the topic name you created in Cloud Pub/Sub to link your Business Profile account to the topic.
  6. (Optional) Repeat step 5 for each Business Profile account that you want to receive notifications for.

Retrieve notification settings

The accounts.getNotificationSetting endpoint returns the current Cloud Pub/Sub notification settings for an account. The following table shows how to call it:

HTTP
GET
https://mybusinessnotifications.googleapis.com/v1/accounts/{accountId}/notificationSetting

Update notification settings

The accounts.updateNotificationSetting endpoint updates the Cloud Pub/Sub notification settings associated with an account. The following table shows how to call it:

HTTP
PATCH
https://mybusinessnotifications.googleapis.com/v1/accounts/{accountId}/notificationSetting?updateMask={commaSeparatedFieldsToUpdate}

{
  pubsubTopic: your/pubsub/topicName
}

Delete notification settings

Calling the accounts.updateNotificationSetting with an empty pubsubTopic deletes the Cloud Pub/Sub notification settings from an account. The following table shows how to call it:

HTTP
PATCH
https://mybusinessnotifications.googleapis.com/v1/accounts/{accountId}/notificationSetting?updateMask=pubsubTopic