Forum Discussion

nskobov's avatar
nskobov
Explorer | Level 4
8 years ago
Solved

How to Implement an exhaustive notification system with API V2

I am tasked with building an email notification system for my company which will alert our employees whenever a file is changed, moved, deleted, created, etc.

 

I have properly set up webhooks with the Business API, so whenever somebody makes a change I get a list of all user id's relevant to that folder.

 

From that ID I call files_list_folder_continue and pass in a cursor from the last time that specific user was notified of something.

 

This gives me deletedMetadata, fileMetadata, and FolderMetadata, but only within the FileMetadata am I able to see information about who made the action 

 

From deletedMetadata, and FolderMetadata it doesn't give me information like the timestamp, or the id of the person who made the folder, or deleted the item.

 

My question is what other ways do I have of finding information like the name of the person who deleted a folder, or created a new shared folder etc. ?

 

Also, when somebody creates a new shared folder and invites several people into it, my webhook only gets the userid of the person who created the shared folder, so how am I supposed to notify the people who got shared into the folder?

 

 

 

  • The Dropbox API doesn't directly return a few of these pieces of information unfortunately, such as file ID in DeleteMetadata, modified/deleted time in FolderMetadata/DeletedMetadata, or modified_by for FolderMetadata, but I'll pass these along as feature requests.

     

    There are some other things you can do though. You can store the last known (File|Folder)Metadata object for a particular path and id, so that when you get a DeletedMetadata, you can check what the last known file ID was for that path.

     

    You can check who is the owner, and that access level other members have, for any particular folder using /2/sharing/list_folder_members[/continue].

     

    Additionally, for Business apps, you can use /2/team_log/get_events to get a log of events for all members.

     

    Also, when members are invited to a shared folder, that doesn't automatically add the folder to their accounts, so it won't trigger a webhook. They will receive notifications of the invite directly from Dropbox itself anyway though. (You will then receive webhooks when they do accept the invite and add the folder to their accounts.)

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The Dropbox API doesn't directly return a few of these pieces of information unfortunately, such as file ID in DeleteMetadata, modified/deleted time in FolderMetadata/DeletedMetadata, or modified_by for FolderMetadata, but I'll pass these along as feature requests.

     

    There are some other things you can do though. You can store the last known (File|Folder)Metadata object for a particular path and id, so that when you get a DeletedMetadata, you can check what the last known file ID was for that path.

     

    You can check who is the owner, and that access level other members have, for any particular folder using /2/sharing/list_folder_members[/continue].

     

    Additionally, for Business apps, you can use /2/team_log/get_events to get a log of events for all members.

     

    Also, when members are invited to a shared folder, that doesn't automatically add the folder to their accounts, so it won't trigger a webhook. They will receive notifications of the invite directly from Dropbox itself anyway though. (You will then receive webhooks when they do accept the invite and add the folder to their accounts.)

    • nskobov's avatar
      nskobov
      Explorer | Level 4

      Thanks Greg, I really appreciate it.

    • nskobov's avatar
      nskobov
      Explorer | Level 4

      Sorry I marked the post as answered, but I actually have an additional question regarding the team log get events call.

       

      I've tried using that call, and I get back a lot of potentially useful information, but it gives me the team log starting with the creation of the team which was several months ago, I then recursively call team log get events continue with the previous cursor, to try to go through the entire events log to try to get the most recent events, but after several minutes this crashes my program because I'm guessing its just so much data.

       

      Is there any way to get the most recent event cursor, or better yet, get an event log for a specific person?

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,949 PostsLatest Activity: 3 hours ago
352 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!