Я настроил тему и подписку в Cloud Pub / Sub, и теперь я пытаюсь настроить наблюдение за своей учетной записью Gmail, но по какой-то причине я получаю (500) Backend Error
.
Ниже приведен код, который я использую:
$client = new Google_Client();
$client->setClientId('google_client_id');
$client->setClientSecret('google_client_secret');
$client->setRedirectUri('google_redirect_url');
$client->addScope("https://mail.google.com/");
$client->setAccessType("offline");
$client->setApprovalPrompt('force');
$service = new Google_Service_Gmail($client);
try {
$watch = new Google_Service_Gmail_WatchRequest($client);
$watch->setTopicName("projects/project-id/topics/topic-id");
$messagesResponse = $service->users->watch("me", $watch, array("topicName" => "projects/project-id/topics/topic-id"));
} catch(Exception $e) {
print_r($e);
}
Я получаю ответ ниже:
Array
(
[userId] => me
[postBody] => Google_Service_Gmail_WatchRequest Object
(
[collection_key:protected] => labelIds
[labelFilterAction] =>
[labelIds] =>
[topicName] => projects/project-id/topics/topic-id
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
[topicName] => projects/project-id/topics/topic-id
)
Google_Service_Exception Object
(
[errors:protected] => Array
(
[0] => Array
(
[domain] => global
[reason] => backendError
[message] => Backend Error
)
)
[retryMap:Google_Service_Exception:private] => Array
(
[500] => -1
[503] => -1
[rateLimitExceeded] => -1
[userRateLimitExceeded] => -1
)
[message:protected] => Error calling POST https://www.googleapis.com/gmail/v1/users/me/watch: (500) Backend Error
Кто-нибудь может мне помочь, пожалуйста?