You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
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. ...
- 6 years ago
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-DB
Dropbox 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.
Infarch
6 years agoExplorer | 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-DB6 years agoDropbox 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.
- Infarch6 years agoExplorer | Level 4
It really works! There was a problem on my server receiving notifications, but I did not notice that at time due to some latency of application console. So the correct authorization workflow is enough for receiving hook requests.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,911 PostsLatest Activity: 7 hours 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!