Z
Z
zloidennnn2018-10-31 12:31:29
Google
zloidennnn, 2018-10-31 12:31:29

Google calendar api event watch?

Good afternoon! I'm trying to connect webhooks to google calendar. I am using the following code:

$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 = '[email protected]';
$service = new Google_Service_Calendar($client);
$watchEvent = $service->events->watch($calendarId ,$channel);

But he doesn't want to work. If you output $channel and $watchEvent, it gives:

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
(
)
)

Can you tell me what is wrong and in what direction to move?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question