0

Currently running into an issue where when I apply a change to a shared drive, rather than just the shared drive's watch channel getting notified, all 4 channels get notified. Causing 4 webhooks to send on a single change from 1 drive. I've tried doing different combinations of settings restrictToMyDrive, supportsAllDrives, includeItemsFromAllDrives but they don't seem to work. Is it possible to get notified for a change in a shared drive specifically from it's corresponding channel?

Using the /drive/v3/changes/watch endpoint, I created a webhook on every drive returned from the /drive/v3/drives endpoint. For each drive I generated a startPageToken from the /drive/v3/changes/startPageToken endpoint:

{
 "driveId": [drive_id],
 "supportsAllDrives": "true"
}

and created a watch channel using the POST /drive/v3/changes/watch endpoint with a request body of:

{
 "driveId": [drive_id],
 "pageToken": [page_token from startPageToken response],
 "includeRemoved": "true"
 "restrictToMyDrive": "true"
}

For example, I have 3 shared drives, so I've set 3 watch channels at this point.

At the end of the loop I created another watch channel for the account (to catch all changes as an extra layer of security) to the POST /drive/v3/changes/watch endpoint with a request body of:

{
 "pageToken": [page_token],
 "includeRemoved": "true",
 "restrictToMyDrive": "false",
 "supportsAllDrives": "true",
 "includeCorpusRemovals": "true",
 "includeItemsFromAllDrives": "true"
}

So in total I have 4 watch channels now.

For a single change in a shared drive, all 4 channels get notified of a change and send 4 webhooks for a single change.

asked Mar 13 at 12:54

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.