5

I have followed all the setups required in https://developers.google.com/google-apps/calendar/v3/push (I think) and I'm trying to register my callback URL to watch events, with this code:

calendar.events.watch({

    auth:jwtClient,
    resource: {
        id: "yourChannelId",
        type: 'web_hook',
        address: "https://api.mysite.com/notifications"
    },
    calendarId: "mycalendarId"
}, function(error, response) {
    if (error) {
        console.log(error);
        return;
    }
    console.log(response);

});

And I get the error message: 'No valid domain for WebHook callback: https://https://api.mysite.com', reason: 'pushWebhookBadDomain'. If I try to put the address as just "api.mysite.com/notifications" (as it seems that the https is getting duplicated), then I get the error message: 'WebHook callback must be HTTPS: api.mysite.com/notifications', reason: 'push.webhookUrlNotHttps'

Can anyone help me please? Thank you

  • Were you able to register your domain in the Domain verification page of the developer console before creating the notification channel? – adjuremods Jan 28 '16 at 04:23
  • @adjuremods Yes, registered in Webmasters with an html in the root directory and then added in the "allowed domains" of my calendar service. Is there any other place to add it? – danielapsmaior Jan 29 '16 at 12:35
  • Well, I went back to Webmasters Tools and I saw an error "“SSL/TLS certificate does not include domain name,”. So maybe it's that, I'll post when I fix it. – danielapsmaior Jan 29 '16 at 14:46

1 Answers1

4

I got it to work. I hope it can help someone. Here is the way:

on Developers Console, the URL must be without the https but with the method included.

on Webmaster Tools, the URL must be with the https but just the cannonical domain.

My problem was that on Developers Console I added all possibilities (4 domains in total), but the service just uses the first one, which was wrong.

In the call, It was right, with https and method:

resource: {
    id: "yourChannelId",
    type: 'web_hook',
    address: "https://api.mysite.com/notifications"
}
  • HI Daniel, your example helped me to sort things out, i get properly channel and start `sync` message but after that nothing happens. Have you idea what it should be? This is my question posted here: http://stackoverflow.com/questions/35434828/google-api-calendar-watch-doesnt-work-but-configured-well – snaggs Feb 16 '16 at 17:16
  • just to be sure, your changes in calendar happen before your channel expiration date, right? – danielapsmaior Feb 17 '16 at 19:19
  • yes, my channel was up to date, anyways it started to work , have no clue why. Sounds like Google glitch. Thanks anyways but your example helped me a lot – snaggs Feb 19 '16 at 17:19