Get Gmail Watch Status - Which Pub sub topic is linked to it

In our application we have a functionality to configure push triggers for gmail mailboxes, we are creating Gmail watch linked with a pub sub topic for it.
And we have a functionality to delete the trigger as well.

So during delete I want to have a check like, whether I am deleting the correct one.
For example, I created watch for topic A. Someone creates a new watch request to link it with topic B (Lets assume not from my application - so I don’t have any tracking). As gmail support only one watch per mailbox, it will override the current watch and link it with topic B.

From our app, I am trying to delete watch for topic A, but in Unwatch (Stop) API we are not passing the topic, so I want to ensure whether topic A is still linked in watch or some other topic.
If this check is not happening and we call the stop api, Watch with topic B also will get stopped.

This will help two things:

  • While creating a second watch with B, they can already know if already a watch is present
  • Wrong un watches can be prevented
1 Like