How to watch Google Calendar Push notifications channel using PHP

Viewed 144

I'm following these guides:

I'm using these libraries:

Here's my current code:


// Get the API client and construct the service object.
// this comes from the Quickstart example:
// https://developers.google.com/calendar/quickstart/php
$client = getClient();
$service = new Google_Service_Calendar($client);

// My code to start watching a channel:

$channel = new Google_Service_Calendar_Channel($client);

// where do I get this ID?
//$channel->setId('20fdedbf0-a845-11e3-1515e2-0800200c9a6689000');

$channel->setType("web_hook");
$channel->setToken('target=myApp-myCalendarChannelDest2');
$channel->setAddress("https://beta.example.com/incoming");
$timetoExpire = time()+360000;
$optParams = array(
    'ttl' => $timetoExpire,
);
$channel->setParams($optParams);
$calendarId = 'developer@example.com';
$watchEvent = $service->events->watch($calendarId ,$channel);

Questions:

  • How do I start watching the channel for my calendar using those libraries?
  • Where do I get resourcePath for my calendar? (which is to be used in the above setId() method?
0 Answers
Related