Skip to main content

Dropbox Component

Manage files stored in Dropbox

Component key: dropbox

Description#

Dropbox is a file sharing platform that allows teams to collaborate and share files with one another. The Dropbox component allows you to interact with the Dropbox API. You can upload, download, list, and move files within a Dropbox account.

A common integration pattern involves listing files in a file store, and performing a series of actions on the array of files that are returned. See our looping over files quickstart for information about how to create a loop over an array of files.

Detecting changes in Dropbox#

The List Changes action allows you to detect changes in your user's Dropbox folders. Create a flow that runs on a schedule and begin your flow with a List Changes action. That action will return a list of changes that have occurred since the flow was last run.

Dropbox Connections#

OAuth 2.0#

This component uses OAuth 2.0 to connect to Dropbox's API. To create a Dropbox OAuth 2.0 app, log in to Dropbox and open https://www.dropbox.com/developers/apps:

  1. Select Create app.
  2. Select that you want Scoped access.
  3. Choose the type of access you want:
    1. App folder access gives you access to a single folder in the user's Apps/ directory. A folder will be created with the same name as your OAuth app.
    2. Full Dropbox access gives you access to all files and folders in a user's Dropbox account.
  4. Give your app a name and click Create app.

Take note of the App key and App secret - you'll enter these in a Dropbox connection config variable.

Under the OAuth2 section add https://oauth2.prismatic.io/callback as a Redirect URI.

Under the Permissions tab, choose the permissions your app will need. The actions supported in this component relate to files, so you should grant the files.metadata.read and files.content.read permissions if you need read-only access, and also include the files.metadata.write and files.content.write permissions if you need to write files to a user's Dropbox account. You can safely ignore permissions listed under Collaboration and Account Info.

InputDefaultNotes
Input
Authorize URL
string
/ Required
Hidden Field
authorizeUrl
Default
https://www.dropbox.com/oauth2/authorize?token_access_type=offline
Notes
The OAuth 2.0 Authorization URL for Dropbox
Input
App Key
string
/ Required
clientId
Default
Notes
Generate at https://www.dropbox.com/developers/apps
Input
App Secret
password
/ Required
clientSecret
Default
Notes
Generate at https://www.dropbox.com/developers/apps
Input
Scopes
string
Hidden Field
scopes
Default
Notes
Dropbox permission scopes are set within Dropbox on the OAuth application
Input
Token URL
string
/ Required
Hidden Field
tokenUrl
Default
https://api.dropboxapi.com/oauth2/token
Notes
The OAuth 2.0 Token URL for Dropbox

Triggers#

Dropbox Webhook Trigger#

Trigger for handling webhooks from Dropbox's change API | key: dropboxWebhook

InputNotes
Input
Signing Secret
password
/ Required
signingSecret
Notes
The 'App Secret' of your Dropbox app

Many other SaaS apps allow you to configure webhook URLs on a per-customer basis. They allow you to say "when data is updated for Acme Corp, notify Acme Corp's instance webhook URL".

Dropbox does not have customer-specific webhooks. Instead, they allow your OAuth application to designate a single webhook URL to be notified when updates occur. Whenever any of your users update data in Dropbox, your single webhook URL receives a request with an array of Dropbox account IDs that have changes.

In Prismatic the best way to handle these Dropbox requests is to create a "Router Integration" that routes Dropbox webhook requests to the correct customer instance(s).

  • When an instance of your Dropbox integration is created, it notifies the "Router Integration" of a new mapping between the authenticated user's Dropbox Account ID and the instance's flow's webhook URL.
  • When a webhook request comes from Dropbox with a list of Dropbox Account IDs with changes, the "Router Integration" loops over the account IDs, looks up the mapping of account ID to webhook URL, and makes a request to the webhook URL of the appropriate instance, causing it to run a flow that queries for changes.

An example "Router Integration" and a Dropbox integration that register itself with the router integration is available in GitHub. You can import and extend the integrations how you see fit.


Actions#

Copy Object#

Copy a Folder or File from one path to another | key: copyObject

InputNotesExample
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
From Path
string
/ Required
fromPath
Notes
The location of a source file within a Dropbox share. Include a leading /.
Example
/path/to/source/file.txt
Input
To Path
string
/ Required
toPath
Notes
The location of a destination file within a Dropbox share. Include a leading /.
Example
/path/to/destination/file.txt

Output Example Payload#

{  "data": {    "status": 200,    "headers": {},    "result": {      "metadata": {        ".tag": "file",        "name": "myCopy",        "id": "exampleId",        "client_modified": "Wed, 01 Jan 2020 00:00:00 GMT",        "server_modified": "Wed, 01 Jan 2020 00:00:00 GMT",        "size": 2048      }    }  }}

Create Folder#

Create a Folder at the specified path | key: createFolder

InputNotesExample
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
Path
string
/ Required
path
Notes
The location of a file within a Dropbox share. Include a leading /.
Example
/path/to/file.txt

Output Example Payload#

{  "data": {    "status": 200,    "headers": {},    "result": {      "metadata": {        "id": "exampleId",        "name": "myFolderName"      }    }  }}

Delete Object#

Delete a Folder or File at the specified path | key: deleteObject

InputNotesExample
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
Path
string
/ Required
path
Notes
The location of a file within a Dropbox share. Include a leading /.
Example
/path/to/file.txt

Output Example Payload#

{  "data": {    "status": 200,    "headers": {},    "result": {      "metadata": {        ".tag": "file",        "name": "myCopy",        "id": "exampleId",        "client_modified": "Wed, 01 Jan 2020 00:00:00 GMT",        "server_modified": "Wed, 01 Jan 2020 00:00:00 GMT",        "size": 2048      }    }  }}

Download File#

Download the file (< 150MB) at the specified path | key: downloadFile

InputNotesExample
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
Path
string
/ Required
path
Notes
The location of a file within a Dropbox share. Include a leading /.
Example
/path/to/file.txt

Output Example Payload#

{  "data": {    "type": "Buffer",    "data": [      101,      120,      97,      109,      112,      108,      101    ]  },  "contentType": "application/octet"}

Get Current Account#

Get information about the currently authenticated user | key: getCurrentAccount

InputNotes
Input
Connection
connection
/ Required
dropboxConnection
Notes
 

Output Example Payload#

{  "data": {    "account_id": "dbid:EXAMPLE",    "name": {      "given_name": "John",      "surname": "Doe",      "familiar_name": "John",      "display_name": "John Doe",      "abbreviated_name": "JD"    },    "email": "john.doe@example.com",    "email_verified": true,    "profile_photo_url": "",    "disabled": false,    "country": "US",    "locale": "en",    "referral_link": "",    "is_paired": true,    "account_type": {      ".tag": "basic"    },    "root_info": {      ".tag": "user",      "root_namespace_id": "123456789",      "home_namespace_id": "123456789"    }  }}

List Changes#

List changes that have been made to files in this folder since the last time this action was run. | key: listChanges

InputDefaultNotesExample
Input
Directory Path
string
directoryPath
Default
Notes
The path to a directory within a Dropbox share. Include a leading /.
Example
/path/to/my/directory/
Input
Connection
connection
/ Required
dropboxConnection
Default
 
Notes
 
Example
 
Input
Include Deleted?
boolean
/ Required
includeDeleted
Default
false
Notes
If true, the results will include entries for files and folders that used to exist but were deleted.
Example
 
Input
Recursive
boolean
/ Required
recursive
Default
false
Notes
If true, the response will contain contents of all subfolders.
Example
 

The first time this action runs, it takes note of the current cursor returned by Dropbox, and returns no changes. Subsequent runs of this step use that cursor to determine what has changed since the last time this step ran.

Output Example Payload#

{  "data": {    "entries": [      {        ".tag": "deleted",        "name": "my-old-image.png",        "path_lower": "/my-old-image.png",        "path_display": "/my-old-image.png"      },      {        ".tag": "file",        "name": "my-new-image.png",        "path_lower": "/my-new-image.png",        "path_display": "/my-new-image.png",        "id": "id:BTY6k_2K8PAAAAAAAAAX9g",        "client_modified": "2022-12-12T21:39:30Z",        "server_modified": "2022-12-12T22:40:57Z",        "rev": "5efa9326918a601c39731",        "size": 1758021,        "is_downloadable": true,        "content_hash": "dc05a61ecd59d294da1e971c4e40a980b9042c633b7bc777367991a046d2b32d"      }    ],    "cursor": "AAFCBKRdVxEXAMPLE",    "has_more": false  },  "instanceState": {    "step-id": "AAFCBKRdVxEXAMPLE"  }}

List Folder#

List Folder contents at the specified path | key: listFolder

InputNotesExample
Input
Cursor
string
cursor
Notes
Specify the cursor returned by your last call to list_folder or list_folder/continue.
Example
lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
Limit
string
limit
Notes
The maximum number of results to return per request. Note: This is an approximate number and there can be slightly more entries returned in some cases.
Example
25
Input
Directory Path
string
path
Notes
The path to a directory within a Dropbox share. Include a leading /.
Example
/path/to/my/directory/

Output Example Payload#

{  "data": {    "status": 200,    "headers": {},    "result": {      "entries": [        {          ".tag": "folder",          "id": "exampleId",          "name": "MyExampleFolder",          "path_lower": "/myexamplefolder"        },        {          ".tag": "file",          "id": "exampleId",          "name": "MyImage.jpg",          "path_lower": "/myexamplefolder/myimage.jpg",          "client_modified": "Wed, 01 Jan 2020 00:00:00 GMT",          "server_modified": "Wed, 01 Jan 2020 00:00:00 GMT",          "rev": "681a01c39731",          "size": 213654        }      ],      "cursor": "hgL45HTslKOhj1_GEut-DVuaNs4xrXzpwQZRyJ0-KCW0wWMQ5DZu68__ULJa0zDcBp3ZrMlCj3-ZuOy4kjc9H2o7Ohk9UsId0sxVZrXFX",      "has_more": true    }  }}

Move Object#

Move a Folder or File from one path to another | key: moveObject

InputNotesExample
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
From Path
string
/ Required
fromPath
Notes
The location of a source file within a Dropbox share. Include a leading /.
Example
/path/to/source/file.txt
Input
To Path
string
/ Required
toPath
Notes
The location of a destination file within a Dropbox share. Include a leading /.
Example
/path/to/destination/file.txt

Output Example Payload#

{  "data": {    "status": 200,    "headers": {},    "result": {      "metadata": {        ".tag": "file",        "name": "myCopy",        "id": "exampleId",        "client_modified": "Wed, 01 Jan 2020 00:00:00 GMT",        "server_modified": "Wed, 01 Jan 2020 00:00:00 GMT",        "size": 2048      }    }  }}

Raw Request#

Send Raw Request to Dropbox | key: rawRequest

InputDefaultNotesExample
Input
Connection
connection
/ Required
connection
Default
 
Notes
 
Example
 
Input
Data
string
data
Default
Notes
The HTTP body payload to send to the URL.
Example
{"exampleKey": "Example Data"}
Input
Debug Request
boolean
debugRequest
Default
false
Notes
Enabling this flag will log out the current request.
Example
 
Input
File Data
string
Key Value List
fileData
Default
Notes
File Data to be sent as a multipart form upload.
Example
[{key: "example.txt", value: "My File Contents"}]
Input
File Data File Names
string
Key Value List
fileDataFileNames
Default
Notes
File names to apply to the file data inputs. Keys must match the file data keys above.
Example
 
Input
Form Data
string
Key Value List
formData
Default
Notes
The Form Data to be sent as a multipart form upload.
Example
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Input
Header
string
Key Value List
headers
Default
Notes
A list of headers to send with the request.
Example
User-Agent: curl/7.64.1
Input
Max Retry Count
string
maxRetries
Default
0
Notes
The maximum number of retries to attempt.
Example
 
Input
Method
string
/ Required
method
Default
Notes
The HTTP method to use.
Example
 
Input
Query Parameter
string
Key Value List
queryParams
Default
Notes
A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.
Example
 
Input
Response Type
string
/ Required
responseType
Default
json
Notes
The type of data you expect in the response. You can request json, text, or binary data.
Example
 
Input
Retry On All Errors
boolean
retryAllErrors
Default
false
Notes
If true, retries on all erroneous responses regardless of type.
Example
 
Input
Retry Delay (ms)
string
retryDelayMS
Default
0
Notes
The delay in milliseconds between retries.
Example
 
Input
Timeout
string
timeout
Default
Notes
The maximum time that a client will await a response to its request
Example
2000
Input
URL
string
/ Required
url
Default
Notes
This is the URL to call.
Example
/file_requests/create
Input
Use Exponential Backoff
boolean
useExponentialBackoff
Default
false
Notes
Specifies whether to use a pre-defined exponential backoff strategy for retries.
Example
 

Upload File#

Upload a file to the specified path | key: uploadFile

InputNotesExample
Input
Connection
connection
/ Required
dropboxConnection
Notes
 
Example
 
Input
File Contents
data
/ Required
fileContents
Notes
The contents to write to a file. This can be a string of text, it can be binary data (like an image or PDF) that was generated in a previous step.
Example
My File Contents
Input
Path
string
/ Required
path
Notes
The location of a file within a Dropbox share. Include a leading /.
Example
/path/to/file.txt

Output Example Payload#

{  "data": {    "status": 200,    "headers": {},    "result": {      "id": "exampleId",      "client_modified": "Wed, 01 Jan 2020 00:00:00 GMT",      "server_modified": "Wed, 01 Jan 2020 00:00:00 GMT",      "size": 2048,      "name": "myFileName"    }  }}