We continue the TechTalk section dedicated to the technologies implemented on Webitel’s platform. In our new article, Vitalii Kovalyshyn, CTO at Webitel, reveals detailed steps of connecting Google Reviews API to ensure automated review processing using the platform services.
When your business is on Google Maps and your customers leave feedback, you may need to process the reviews. Of course, you can assign this task to some employee. But we offer an easier way: to automate review processing with Webitel. For example, thank a customer for a 5-star rating, or send a comment to an available operator for processing. No additional licenses or programming skills are required, all you need is the Flow Manager designer with the right settings. So, let’s begin 😉
Google My Business API You need to create a project in Google Cloud to activate the API and connect access keys. For the beginning, you need the Project number and Project ID which you can find on the first page:
With this data, you have to fill out the Google My Business API access form and wait for confirmation (it may last up to 2 weeks, but I received confirmation after 3 work days).
After confirmation, you need to activate API:
Google My Business API
My Business Business Information API
My Business Account Management API
Congrats! You have finished the first stage of setting, thus we can move to the authorization 😎
Google OAuth 2.0 Client
You need to go to the Credentials section and create OAuth 2.0 Client:
Copy the field values for further receipt of tokens:
Client ID
Client secret
Next, generate the string with the access list necessary for further integration. Please, pay attention to %%CHANGE-ME%%, you have to replace it with your Client ID:
Open the generated string in the browser, after this, the system will ask you to go through authorization. When finished, you will be redirected to a blank page. Don’t be afraid, everything is ok. You need to get the code value from the string of this page:
Finally, the last step at this stage is to get access_token and refresh_token. Open HTTP Rest Client and send a request (replacing variables with your values):
POST https://oauth2.googleapis.com/token HTTP/1.1Content-Type: application/json; charset=utf-8{ "code": "{{code_from_site}}", "client_id": "{{client_id}}", "client_secret": "{{client_secret}}", "redirect_uri": "http://127.0.0.1", "access_type": "offline", "grant_type": "authorization_code"}
You will receive an answer with a token available for 1 hour:
{ "access_token": "HIDDEN", "expires_in": 3599, "refresh_token": "HIDDEN", "scope": "https://www.googleapis.com/auth/business.manage https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid", "token_type": "Bearer", "id_token": "HIDDEN"}
We will set up automatic renewal of this token later. Now let’s move to the next stage of configuration.
Account and Location Identifier
To receive reviews, you must know your Google Account and Location code. For this purpose, you should send the API request using access_token from the previous step.
Your ID:
GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts HTTP/1.1Authorization: Bearer {{access_token}}
Location ID:
GET https://mybusinessbusinessinformation.googleapis.com/v1/accounts/{{account_id}}/locations?read_mask=name,title HTTP/1.1Authorization: Bearer {{access_token}}
You will receive numbers like 113478846864290431250. Save value, and let’s move to Webitel.
Webitel preparation
Here, we have two main requirements for Webitel:
version no less v23.09
flow_manager with Redis support
Speaking about the second point, I used our new cache application to save the token and information about recent review synchronization. If you do not connect Redis, these configurations will be stored in RAM. Thus, after each restart, the system will collect all reviews from Google Maps instead of new ones.
So, we recommend installing Redis and connecting it to the flow_manager service by adding startup options in the file: /etc/systemd/system/flow_manager.service
-redis_host=127.0.0.1 -redis_port=6379 -redis_database=0
Restart the service. The second requirement is implemented ✔️
Google Refresh Token
For a token refresh, I have created a simple scheme that sends an HTTP request and writes the new token value to Redis. You can download a ready-for-use ‘Refresh token’ scheme and replace values with your own:
"client_id": "%%CHANGE_ME%%",
"client_secret": "%%CHANGE_ME%%",
"refresh_token": "%%CHANGE_ME%%"
Then let’s move to the Triggers section and create a task for running this scheme every hour:
Done! The refresh token works fine and we can set up the review sync with Webitel.
Getting reviews from Google Maps
Every hour (it also can be more often, or vice versa) we run the scheme that will collect only new reviews and write them as subscribers’ requests into the Inbound task queue.
The review has the following format:
{ "reviewId": "HIDDEN", "reviewer": { "profilePhotoUrl": "https://lh3.googleusercontent.com/a/HIDDEN=s120-c-rp-mo-ba2-br100", "displayName": "HIDDEN" }, "starRating": "FIVE", "comment": "Професіональний підхід до клієнтів!молодці\n\n(Translated by Google)\nProfessional approach to customers! Well done", "createTime": "2019-06-01T10:30:32.110545Z", "updateTime": "2019-06-01T10:30:32.110545Z", "name": "accounts/HIDDEN/locations/HIDDEN/reviews/HIDDEN"}
You need to save:
reviewId - review identifier, necessary for giving a response. We will write it to the ‘number’ of queue subscribers. This will simplify our search for duplicates. When the user changes his/her review, we delete the previous entry in the queue and add the new one;
updateTime - necessary for uploading only new entries;
starRating - stars, always present. We will replace a word with an emoji;
comment - although sometimes reviews can be without comments;
displayName - Google user’s name;
profilePhotoUrl - link to the user’s profile photo.
Then, it is necessary to create a new communication type in the directory:
As well as a new queue of inbound tasks:
Next step: you will need my scheme for review synchronization. You can download the Sync data scheme here and save it to Webitel not forgetting to specify Google Account & Location IDs in the scheme:
For Patch Member and Callback Queue elements, choose your Inbound tasks queue and a Communication type created before:
Now let's add this scheme to the Trigger so that review synchronization also occurs hourly:
After the first launch, you will get all reviews as subscribers in the task queue.
Agent’s work with reviews
To make it possible for the agent to process reviews, you need one more scheme, 'Reply to a review', ready for downloading. Just specify the Google Account & Location, as you did with the previous scheme. Then, attach it to our queue:
And assign it to the agents. Congrats! 🥳 The review is automatically distributed to the free agent who can write the response:
Conclusion
Using Webitel tools and services, I have precisely configured integration with reviews on Google Maps and created a form for agent responses. And most importantly, it took only a few days while waiting for API activation was the longest.
With the help of my templates and the extensive functionality of Webitel’s platform, you can improve the service scenarios, automate responses to let agents respond only to bad reviews, or implement any of your ideas to build great customer interaction.
コメント