Dropbox trigger

Has anyone tried to create a tigger that tells you about newly added files to Dropbox?

1 Like

Hey @Max_T,

I don’t think we have a dropbox trigger node so you would need to implement your own logic by listing all the files and comparing it against a local list.

From what I can see in the documentation, a dropbox can be made a webhook. However, I do not understand everything

Ah maybe, Without looking at the documentation I am not sure. If it has the ability to post to a webhook you can add a webhook node in n8n then tell Dropbox to use that and implement any checks it wants and you should be all good.

how can this be done in n8n ?

my webhook is receiving data, but i can’t do it to dropbox as a reply

The verification request

To set up a new webhook, find your app in the App Console, and add the full URI for your webhook (e.g. https://www.example.com/dropbox-webhook) in the “Webhooks” section. Note that the URI needs to be one publicly accessible over the internet. For example, 127.0.0.1 and localhost URIs will not work, since Dropbox’s servers will not be able to contact your local computer.

Once you enter your webhook URI, an initial “verification request” will be made to that URI. This verification is an HTTP GET request with a query parameter called challenge. Your app needs to respond by echoing back that challenge parameter. In order to avoid introducing a reflected XSS vulnerability, set the following headers in your response to the verification request:

‘Content-Type: text/plain’ ‘X-Content-Type-Options: nosniff’

The purpose of this verification request is to demonstrate that your app really does want to receive notifications at that URI. If you accidentally entered the wrong URI (or if someone maliciously entered your server as their webhook), your app would fail to respond correctly to the challenge request, and Dropbox would not send any notifications to that URI.

Hì @Max_T, I’d start by adding a webhook node handling the GET request to your workflow. Then take a look at the exact data structure you receive from Dropbox and then take it from there.

It might be as simple as adding a Respond to Webhook node returning the challenge value using an expression afterwards.

that is, in addition to the webhook module, I have to add respond to webhook?

You might not need to, but I find that it usually makes workflows much easier to read. But again, I’d take it one step at a time. First step is to make sure you receive the verification webhook from Dropbox. Everything else comes afterwards.

the verification webhook is definitely replaced. dropbox wants what it gets returned to dorpbox but i’m doing something wrong because it gets a bug

Can you share the JSON data received by your webhook node as well as a screenshot of the error you are getting?

is already working to this point.

That’s great news. So next I’d try to respond with the challenge parameter only. Again, I have no clue how the Dropbox webhook data looks like as you didn’t share, so I can only guess.

But I think setting the Respond option in your webhook node to Using ‘Respond to Webhook’ Node like so can make things a bit easier:

image

Then, in the Respond to Webhook node I’d start by setting Respond With to Text:

image

Lastly, my Response Body would be an expression pointing towards the challenge value:

Now a request sent to the webhook URL would receive a response containing the value of the challenge URL parameter.

1 Like

Thank you for the information, that was the problem. it’s ok now. Now I wanted to check if I would get any information when I upload a file to the dropbox, but I didn’t get any information.

So from the Dropbox documentation it sounds like they are sending a POST request for that. Meaning you’d need an additional webhook node with the same Path value as your existing one, but a HTTP Method of POST.

1 Like

Ok, the next step is done. Now it’s time for the next stage. I wonder how to do this next because webhook doesn’t return the file id or filename. The assumption was that my automation was to update the list of files in Sheet as soon as I added files to the dropbox.

Hey @Max_T,

Once you have the webhook information back you will need to call the /files/list_folder URL for the userId and that is meant to them return the files.

It is covered under the " Receiving notifications" section of the Dropbox Webhook docs.

1 Like

I don’t understand a bit. he gets information from the webhook that the user with this number has made changes. If I understand correctly, the next module is to be / files / list_folder. I don’t know how to use this user id to get / files / list_folder to find these files for me. / files / list_folder no fields for the user id.

Looking at the Python example they just want you to call /files/list_folder and use the credentials for the user in the response from the webhook.

how can i transfer this to n8n

In theory…

Add an HTTP Request node set to POST, Add the URL and select the dropbox oauth credentials, It looks like you will need to set a path in the body (just use path and leave the value empty).

Once ran this will give you a cursor ID, You will need to store this somewhere and on the next trigger you use the /continue URL and add cursor to the values being sent.