Attention: There will be major changes to the API soon that will require migration work. Please check our upcoming releases page frequently for updates.
v4.9 of the API has released! See change log.

Manage real-time notifications

In the Google My Business 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 Google My Business 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 Google My Business 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
  4. Follow the Subscriber overview guide to set up either push or pull notifications.
  5. To receive notifications, call the accounts.updateNotifications endpoint in the Google My Business API. In the call, use the topic name you created in Cloud Pub/Sub to link your GMB account to the topic.
  6. (Optional) Repeat step 5 for each Google My Business account that you want to receive notifications for.

Retrieve notification settings

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


The following function uses Mybusiness.Accounts.getNotifications to return the data for the accounts notification.

 * Demonstrates getting notification data.
 * @param name The name (account/`account_id`/notifications) for the notification to retrieve.
 * @return response The notification data.
private static GetNotifications getNotifications(String name) throws Exception {
  Mybusiness.Accounts.getNotifications sub =

  GetNotifications response = sub.execute();

  return response;

Update notification settings

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


  name: your/pubsub/topicName

The following function uses Mybusiness.Accounts.Locations.Reviews.Get.

 * Demonstrates getting a review by name.
 * @param reviewName The name (resource path) of the review to retrieve.
 * @return Account The requested review.
private static Review getReview(String reviewName) throws Exception {
Mybusiness.Accounts.Locations.Reviews.Get review =

  Review response = review.execute();

  return response;

Delete notification settings

The accounts.deleteNotifications endpoint deletes the Cloud Pub/Sub notification settings from an account. The following table shows how to call it in HTTP and Java:


The following function uses Mybusiness.Accounts.DeleteNotifications.

 * Demonstrates deleting the Google Cloud Pub/Sub settings.
 * @param notificationName The name (account/`account_id`/notifications) for the notification settings to delete.
 * @return The deleted notification setting.
private static DeleteNotifications deleteNotifications(String notificationName) throws Exception {
  Mybusiness.Accounts.DeleteNotifications toDelete =

  DeleteNotification response = toDelete.execute();

  return response;