1

We are trying to get push notifications from google drive. We are developing a web platform with several users.

We need to receive whichever users' changes on a webhook. According to documentation it's not clear how to build these channels and their lifecycle.

We need once a user has signed in in our platform automatically receive all changes.

We don't know when to create a channel:

  1. Once, I mean, it's created and platform will receive notifications "forever" (until channel is explicitly deleted)?
  2. Or we need to create a channel each time we want to watch out changes (note: we want to watch out changes anytime, regardless user is logged in in our platform). We want to receive notification forever.

How should we handle channel then?

Jordi
  • 20,868
  • 39
  • 149
  • 333

2 Answers2

0

According to the documentation you've provided, you just need to set up a notification channel for each resource you want to watch. After your notification channels are set up, the Drive API will inform your application when any watched resource changes so you don't need to create a channel each time you want to watch out changes.

You may check this thread which stated that as soon as changes arrive in the callback url, changes are to be fetched by making a get request to changes resource uri.

abielita
  • 13,147
  • 2
  • 17
  • 59
0

it's created and platform will receive notifications "forever" (until channel is explicitly deleted)?

The documentation (v3) says:

Note: For the Drive API, the maximum expiration time is 86400 seconds (1 day) after the current time for File resources and 604800 seconds (1 week) for Changes. If you don’t set the expiration property in your request, the expiration time defaults to 3600 seconds after the current time.

I'm having the same issue as you mention in the question. What strategy to take, in order to switch from one watch to the next. Did you get something up?

akauppi
  • 17,018
  • 15
  • 95
  • 120