If you’re new to Unstructured, read this note first.Before you can create a source connector, you must first sign in to your Unstructured account:
- If you do not already have an Unstructured account, go to https://unstructured.io/contact and fill out the online form to indicate your interest.
- If you already have an Unstructured account, sign in by using the URL of the sign in page that Unstructured provided to you when your Unstructured account was created. If you do not have this URL, contact Unstructured Sales at sales@unstructured.io.
- A Dropbox account.
-
A Dropbox app for your Dropbox account. To create a Dropbox app, do the following:
a) Sign in to the Dropbox Developers portal with the same credentials as your Dropbox account.
b) Open your App Console.
c) Click Create app.
d) For Choose an API, select Scoped access.
e) For Choose the type of access you need, select App folder.
f) Enter a name for your app, and then click Create app.
g) On the app’s Permissions tab, under Files and folders, check the boxes labelled files.content.read or files.content.write or both, depending on whether you want to read files, write files, or both. Then click Submit.
h) On the app’s Settings tab, note the value of the App folder name field. This is the name of the app folder that Dropbox will create under theAppstop-level folder in your Dropbox account that the Dropbox app will use for access. If you change the value of App folder name field here, Dropbox will create an app folder with that name under theAppstop-level folder instead.
i) Under OAuth 2, next to Generated access token, click Generate. Copy the value of this access token. You should only click Generate after you have completed all of the preceding steps first. This is because the access token is scoped to the specific app folder and settings at the time the access token is generated. If you change the app folder name or any of the permissions later, you should regenerate the access token.
Access tokens are valid for only four hours after they are created. After this four-hour period, you can no longer use the expired access token. Dropbox does not allow the creation of access tokens that are valid for more than four hours.To replace an expired access token, you must first generate a refresh token for the corresponding access token. To learn how to generate an access token and its corresponding refresh token, see Replace an expired access token, later in this article.If you do not already have the corresponding refresh token for an existing access token, or if you lose a refresh token after you generate it, you must generate a new access token and its corresponding refresh token.Instead of continualy replacing expired access tokens yourself, you can have Unstructured do it for you as needed; just supply Unstructured with the refresh token along with the Dropbox app’s App key and App secret values. To learn how to supply these to Unstructured, look for mentions of “refresh token,” “app key,” and “app secret” in the connector settings later in this article. -
The app folder that your Dropbox app will use for access can be found in your Dropbox account under the
Appstop-level folder. For example, if the value of the App folder name field above ismy-folder, then the app folder that your Dropbox app will use for access can be found underhttps://dropbox.com/home/Apps/my-folder
Your Dropbox app will not have access to upload or download files from the root of the app folder. Instead, you must create a subfolder inside of the app folder for your Dropbox app to upload or download files from. You will use the name of that subfolder when specifying your remote URL in the next step. For example, if your Dropbox app uses an app folder namedmy-folderfor access within theAppstop-level folder, and you create a subfolder nameddatawithin themy-folderapp folder, then the subfolder that your Dropbox app will upload and download files from can be found underhttps://dropbox.com/home/Apps/my-folder/data
-
Note the remote URL to your subfolder inside of the app folder, which takes the format
dropbox://<subfolder-name>. For example, if your Dropbox app uses an app folder namedmy-folderfor access within theAppstop-level folder, and you create a subfolder nameddatawithin themy-folderapp folder, then the remote URL isdropbox://data
Replace an expired access token
Dropbox app access tokens are valid for only four hours. After this time, you can no longer use the expired access token. To have Unstructured automatically replace expired access tokens on your behalf, do the following:-
Get the app key and app secret values for your Dropbox app. To do this:
a) Sign in to the Dropbox Developers portal with the same credentials as your Dropbox account.
b) Open your App Console.
c) Click your Dropbox app’s icon.
d) On the Settings tab, next to App key, copy the value of the app key.
e) Next to App secret, click Show, and then copy the value of the app secret. -
Use your web browser to browse to the following URL, replacing
<app-key>with the app key for your Dropbox app: - Click Continue.
- Click Allow.
- In the Access code generated tile, copy the access code that is shown.
-
Use the curl utility in your Terminal or Command Prompt, or use a REST API client such as
Postman, to make the following REST API call, replacing the following placeholders:
- Replace
<app-key>with the app key for your Dropbox app. - Replace
<app-secret>with the app secret for your Dropbox app. - Replace
<access-code>with the access code that you just copied.
- Replace
-
In the response, copy the following two values:
- The value of
access_token(starting with the characterssl) is the new, valid access token. - The value of
refresh_tokenis the refresh token that can be used to replace this access token much faster and easier next time. If you lose this refresh token, you must go back to Step 2.
- Add the
refresh_tokenvalue to the connector settings Refresh token field. - Add the
<app-key>value to the connector settings App key field. - Add the
<app-secret>value to the connector settings App secret field.
- Add the
refresh_tokenvalue to therefresh_tokenparameter. - Add the
<app-key>value to theapp_keyparameter. - Add the
<app-secret>value to the connector settingsapp_secretparameter.
- The value of
-
If for some reason you need to manually replace the expired access token yourself instead of having Unstructured do it for you, you can use the refresh token that you just copied to get a new access token:
- Replace
<refresh-token>with the refresh token. - Replace
<app-key>with the app key for your Dropbox app. - Replace
<app-secret>with the app secret for your Dropbox app.
- Replace
-
In the response, copy the following two values:
-
The value of
access_token(starting with the characterssl) is the new, valid access token. In the connector, replace the old, expired access token value with this new, valid access token value. -
The value of
refresh_tokenis the new, valid refresh token. To replace the expired access token yourself, go back to Step 8.
-
The value of
<name>(required) - A unique name for this connector.<remote-url>(required) - The remote URL to the target subfolder inside of the app folder for the Dropbox app.- Set
recursivetotrueto recursively process data from subfolders within the target subfolder. The default isfalseif not otherwise specified. <app-key>(required) - The app key for your Dropbox app. This allows Unstructured to automatically replace expired access tokens.<app-secret>(required) - The app secret for your Dropbox app. This allows Unstructured automatically to replace expired access tokens.<refresh-token>(required) - The refresh token for the Dropbox app. This allows Unstructured to automatically replace expired access tokens.

