@zloidennnn

Google calendar api event watch?

Добрый день! Пытаюсь подключить к google calendar веб-хуки. Использую следующий код:
$client = getClient();
$channel =  new Google_Service_Calendar_Channel($client);
20fdedbf0-a845-11e3-1515e2-0800200c9a6689111
$channel->setId('20fdedbf0-a845-11e3-1515e2-0800200c9a6689123');
$channel->setType("web_hook");
$channel->setToken('target=myApp-myCalendarChannelDest2');
$channel->setAddress("https://xxx");
$timetoExpire = time()+360000;
$optParams = array(
    'ttl' => $timetoExpire,
);
$channel->setParams($optParams);
$calendarId = 'xxx@gmail.com';
$service = new Google_Service_Calendar($client);
$watchEvent = $service->events->watch($calendarId ,$channel);

Но работать не хочет. Если вывести $channel и $watchEvent, выдает:

Google_Service_Calendar_Channel Object
(
[address] => https://xxx
[expiration] =>
[id] => 20fdedbf0-a845-11e3-1515e2-0800200c9a6689124
[kind] =>
[params] => Array
(
[ttl] => 1541338255
)

[payload] =>
[resourceId] =>
[resourceUri] =>
[token] => target=myApp-myCalendarChannelDest2
[type] => web_hook
[internal_gapi_mappings:protected] => Array
(
)

[modelData:protected] => Array
(
)

[processed:protected] => Array
(
)

)
Google_Service_Calendar_Channel Object
(
[address] =>
[expiration] => 1543570256000
[id] => 20fdedbf0-a845-11e3-1515e2-0800200c9a6689124
[kind] => api#channel
[params] =>
[payload] =>
[resourceId] => P5pjoO3DvbNt_fKh2PHxIk1-BKA
[resourceUri] => https://www.googleapis.com/calendar/v3/calendars/x...
[token] => target=myApp-myCalendarChannelDest2
[type] =>
[internal_gapi_mappings:protected] => Array
(
)

[modelData:protected] => Array
(
)

[processed:protected] => Array
(
)

)

Можете подсказать, в чем ошибка и в каком направлении двигаться?
  • Вопрос задан
  • 423 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы