cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

Webhook Notifications Not Being Recieved

Webhook Notifications Not Being Recieved

draos
New member | Level 2

Hello, I am trying to implement webhooks, but I am encountering some issues.

Screen Shot 2017-07-24 at 1.27.45 PM.pngScreen Shot 2017-07-24 at 1.28.20 PM.png

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.

Screen Shot 2017-07-24 at 1.35.45 PM.png

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.

4 Replies 4

Greg-DB
Dropbox Staff
It 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.)

draos
New 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?

draos
New 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-DB
Dropbox Staff
Yes, 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!
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    draos New member | Level 2
What do Dropbox user levels mean?