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
draos
8 years agoNew member | Level 2
Webhook Notifications Not Being Recieved
Hello, I am trying to implement webhooks, but I am encountering some issues.
As you can see I have 1 developer user added, and I have also managed to get my site enabled. I used Generate Access Token, so that's why I didn't go through the OAuth process.
<%
import Foundation
import SwiftEngine
import SwiftyJSON
let reqVal = Request.server["REQUEST_METHOD"] ?? ""
if(reqVal == "GET")
{
let params = Request.get
let challengeCode = params["challenge"]!
Response.write(challengeCode);
}
else
{
var path = "data.txt"
let text = "some text"
try! text.write(toFile:path, atomically: false, encoding: String.Encoding.utf8 )
Response.write("Done");
}
%>
Above is my code. Upon a GET request it validates the Webhook by echoing the Dropbox challenge.
The else clause handles every other HTTP request, and thus should handle the POST notification that is supposed to be sent upon a file change; this isn't working. Essentially, upon a POST the code will write to a file in the current local directory of my server (not dropbox) called data.txt. I used Charles to see if it was just Dropbox or if the handler wasn't working.
the POST succeeded and wrote to the file as expected. For that reason, I think I either misunderstood something when reading the docs or Dropbox isn't even making a request for some reason. Any help on this would be much appreciated.
- Greg-DBDropbox StaffIt looks like you do have your webhook URI registered successfully, and webhook notifications appear to be working properly on our side right now.
There are a few ways for this to fail like this though. Please check:
- Make sure you're making changes in the account linked to the app.
- Since this is an app folder app, make sure you're making changes in the special app folder (at /Apps/<app folder name>).
- Make sure the webhook notification is following the code path you expect in your handler. (Try adding some logging at each step just to make sure.)- draosNew member | Level 2
On point 1 I am making the changes in the correct account. I am also doing it in the folder. I don't think the post is even getting run though, which is why I'm a little confused, espsecially since it runs when i make a POST request manually. Theoretically, it should send a POST if I create or alter a file in the folder right?
- draosNew member | Level 2
ok so i have verified that dropbox doesn't seem to be making any sort of HTTP request to the page. I added a log that runs if any request is made, but it isn't even being run. Does the URI need to be HTTPS or something, because I don't see any other reason it shouldn't be sending any data.
- Greg-DBDropbox StaffYes, you should be receiving a webhook POST notification when you create or alter a file in the app folder in a linked account.
The URI doesn't need to be HTTPS. HTTP is allowed.
We'll have to investigate this for your app and account specifically. Please open an API ticket from the affected account so we can look into it:
https://www.dropbox.com/developers/contact
Thanks in advance!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days 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!