cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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

Re: Webhook Notifications Not Being Recieved

Greg-DB
Dropboxer
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.)

Re: Webhook Notifications Not Being Recieved

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?

Re: Webhook Notifications Not Being Recieved

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.

Re: Webhook Notifications Not Being Recieved

Greg-DB
Dropboxer
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!
Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    draos New member | Level 2
What do Dropbox user levels mean?
Need more support?