I have propblem with Onboard locations with Business Profiles.
I have working My Business App where i can make actions on Locations, reviews etc. Also I added in Business Communications Brand, Agent and Location with id from GMB.
Now I have problem with 'request agent verification':
$dir = "service_account_from_business_communications.json";
$accessToken = exec($dir . '/oauth2l fetch --json ' . $dir . '/config/'.$file.' --scope business.manage,businesscommunications,businessmessages');
$data = [...];
$brandId = "...";
$agentId = "...";
$curl = curl_init("https://businesscommunications.googleapis.com/v1/brands/$brandId/agents/$agentId:requestVerification");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'User-Agent: curl/business-messages',
'Authorization: Bearer ' . $accessToken,
));
Varification is added but mail is sent, and it shouldn't:
the verification process won't send an email to the brand if the agent name matches the Business Profile name and if you obtained the OAuth token with the correct scopes.
So OAuth Token isn't correct, so now im trying wit my GMB application, by adding new businesscommunications
scope.
So according to docs:
In your existing OAuth consent flow where a Business Profile account owner grants you access to call the Google My Business APIs on their behalf, update the API scopes to include:
When Im adding new scope businesscommunications
to my app (all working with GMB stuff) I have error on OAuth Login saying i have incorrect scope and it is not enabled in project:
Business Communications API has not been used in project XXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/businesscommunications.googleapis.com/overview?project=XXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
But that scope not exists in API Library.
I need to add and the end that when I set agent and location in Business Communications in panel i can send replies on messages by API but not that from My Business Locations.
How can I combine these two working separate scopes and the API?
"Business Communications" is an umbrella term, not an individual API ...
A search query turns up a few "My Business" API, but no "Business Communications" API:
https://console.cloud.google.com/apis/library/browse?project=_&q=My%20Business
But when browsing the documentation, there's a link to the relevant console page:
https://business-communications.cloud.google.com/console/
One can only request individual scopes, as there is no such scope.
From a PHP perspective, I'd suggest to also obtain the access token with cURL.