cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Implement an exhaustive notification system with API V2

How to Implement an exhaustive notification system with API V2

nskobov
Explorer | Level 4
Go to solution

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?

 

 

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.)

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

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
Explorer | Level 4
Go to solution

Thanks Greg, I really appreciate it.

nskobov
Explorer | Level 4
Go to solution

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?

Greg-DB
Dropbox Staff
Go to solution
You can specify a particular time range, and/or a particular member, via the `time` and `account_id` parameters, respectively. You can find more information on those in the documentation:

https://www.dropbox.com/developers/documentation/http/teams#team_log-get_events

The API v2 Explorer may be helpful for building/testing these queries:

https://dropbox.github.io/dropbox-api-v2-explorer/team/#team_log_get_events
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    nskobov Explorer | Level 4
What do Dropbox user levels mean?