My Business
1.8K members online now
1.8K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

reply to the specified review

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm creating the application to reply my location reviews using GMB using c# library.

 

Can you guide me the steps to be followed. 

 

i have valid project created for my business account.

 

i retrieved the details using the following code:

UserCredential credential;
// The scope of Google My Business API
string mybusinessServiceScope = "https://www.googleapis.com/auth/plus.business.manage";
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { mybusinessServiceScope },
"user", CancellationToken.None, new FileDataStore("Mybusiness.Auth.Store")).Result;
}

// Creates the service.
var service = new MybusinessService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Google My Business API Sample",
});

var accountsListRequest = service.Accounts.List();
ListAccountsResponse accountsResult = accountsListRequest.Execute();

Account account = accountsResult.Accounts[0];

// Lists all locations for the specified account
var locationsListRequest = service.Accounts.Locations.List(account.Name);
ListLocationsResponse locationsResult = locationsListRequest.Execute();

1 Expert replyverified_user
Marked as Best Answer.
Solution
Accepted by topic author Mahender S
September 2016

Re: reply to the specified review

[ Edited ]
Google Employee
# 2
Google Employee

Hi @Mahender S,

 

It looks like you are able to use OAuth 2.0 to authorize requests judging from the source code you posted. Please note that only a verified location can have reviews. You can follow the code snippet below to update a reply to the specified review (or create a new reply if one doesn't exist) with the C# client library:

           // Gets all accounts for the authenticated user.

           var accountsListRequest = service.Accounts.List();

           ListAccountsResponse accountsResult = accountsListRequest.Execute();

 

           // For testing purposes, selects the very first account in the accounts array.

           Account account = accountsResult.Accounts[0];

 

           // Lists all locations for the specified account.

           var locationsListRequest = service.Accounts.Locations.List(account.Name);

           ListLocationsResponse locationsResult = locationsListRequest.Execute();

 

           // For testing purposes, selects the very first location in the locations array.

           Location location = locationsResult.Locations[0];

 

           if (location.LocationState.IsVerified == true)

           {

               // Lists all reviews for the specified location.

               var reviewsListRequest = service.Accounts.Locations.Reviews.List(location.Name);

               ListReviewsResponse reviewsResult = reviewsListRequest.Execute();

 

               // For testing purposes, selects the very first review in the reviews array.

               Review review = reviewsResult.Reviews[0];

 

               // Updates a reply to the specified review (or creates a new reply if one doesn't exist).

               review.ReviewReply.Comment = "Thank you for visiting our business!";

               var reviewReplyRequest = service.Accounts.Locations.Reviews.Reply(review.ReviewReply, location.Name + "/reviews/" + review.ReviewId);

               ReviewReply reviewReplyResult = reviewReplyRequest.Execute();

           }

           else

           {

               Console.WriteLine("Location {0} is not verified, and therefore has no reviews.", location.Name);

           }

 

Thanks,

Terry

Re: reply to the specified review

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hello Terry,
Thanks for the reply and I was able to post the reply for reviews now.

Best Regards,
Mahender S.

reply to the specified review

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Thanks Terry. Much appreciated

 

reply to the specified review

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi Terry, 

I am trying to read our reviews via clicking read review from the googlemybusinessnoreply@google.com email sent to my inbox. Each review I receive returns error 500. Is there any way to stop this?? I've tried logging in and out again, different browsers and recaching my browsers and nothing allows me to read these reviews. Can you help?

Thanks,
Taylor 

reply to the specified review

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Hello, Thank you for responding!