We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Infarch
6 years agoExplorer | Level 4
Can you help me understand and use WebHooks?
Hi all!
I experience problem with understanding and using web hooks. Hope that someone can help me. So, let me explain the case.
I use Chooser on my site, configured for getting 'preview' links. I send these links to the server, which downloads and stores files. I want to extend this functionality and monitor changes in files at user side. When a new version is uploaded, my site automatically gets this version.
That could be implemented by keeping the link and asking API with some interval. But I don't want to spam API by a large number of request. So the idea is to use web hooks. I've registered a hook for my application. But it was called only once, during verification. Chosing of files in Chooser does not fire events.
I think that my way is wrong, but cannot figure out how to achieve my goal. May be someone could help me?
Dropbox webhooks are only sent for changes in the accounts "connected" or "linked" to your app. That is, accounts for users who went through the OAuth app authorization flow to authorize your app to access their accounts.
When you use the Dropbox Chooser, users can share links to specific files/folders with your app, without fully connecting their accounts to your app. The Chooser lets the user just choose which specific item(s) to supply to your app, without going through the full OAuth app authorization. Dropbox doesn't offer a way to get webhook notifications for changes to shared links just from having the shared links.
That being the case, you won't get any webhook notifications for users who just used the Chooser for your app. If you want webhook notifications, you'll need to prompt them to authorize your app. You can find more information on how that works in the OAuth Guide and the authorization documentation.
- Greg-DBDropbox Staff
Dropbox webhooks are only sent for changes in the accounts "connected" or "linked" to your app. That is, accounts for users who went through the OAuth app authorization flow to authorize your app to access their accounts.
When you use the Dropbox Chooser, users can share links to specific files/folders with your app, without fully connecting their accounts to your app. The Chooser lets the user just choose which specific item(s) to supply to your app, without going through the full OAuth app authorization. Dropbox doesn't offer a way to get webhook notifications for changes to shared links just from having the shared links.
That being the case, you won't get any webhook notifications for users who just used the Chooser for your app. If you want webhook notifications, you'll need to prompt them to authorize your app. You can find more information on how that works in the OAuth Guide and the authorization documentation.
- InfarchExplorer | Level 4
Thank you for the reply!
Trying to follow your suggestion, I've changed my code a bit. Now the workflow is:
a) I redirect a user to authorization endpoint:
b) <my_callback_url> gets <code> from dropbox.
c) I ask dropbox again for a token, posting the following values:
my $endpoint = 'https://api.dropbox.com/oauth2/token';
my $post_parameters = {
code => $code,
grant_type => 'authorization_code',
client_id => $AppKey,redirect_uri=>$uri,
client_secret => $AppSecret
};As the result I get a token which allows to download files not only by shared url, but also by ID.
But there still is a problem with hooks: I do not receive calls from Dropbox when I (or other test users) change files in personal account or upload new ones. May be I have to start monitoring by some explicit command?
- Greg-DBDropbox Staff
What you've described here is the correct way to connect a user if you want webhook notifications for changes in their account. You don't need to send any other explicit command to start monitoring.
If you're still not able to receive the webhook notifications, please open an API ticket with the details (the app name, the webhook URI, and the relevant user ID) so we can check on this for you.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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!