Dropbox Integration with Salesforce

Dropbox Integration with Salesforce

Hi All,

Today I will show you how to copy files to Dropbox from Salesforce using Dropbox integration.

You don’t need to buy costly AppExchange apps or services like Zapier to do this. We will show you how to do this with a simple Apex class.

First of all, we need is a Dropbox account and a Salesforce org with which we will integrate with.

If you don’t have a Dropbox account, you can get one at https://www.dropbox.com/. We have one already, so we won’t be signing up again.

Capture1 Dropbox SignUp pag1

Fill up the form, and you will get your Dropbox account.

Now, go to the developer section of Dropbox. To do so type https://www.dropbox.com/developers in the URL and press Enter. Here we will be creating a Dropbox app that will act as a listener between the Salesforce org and the Dropbox account.

Capture2 Dropbox developer page

Click on Create your app tab to start creating the app.

Screen Create app page in Dropbox

On the next page, select Dropbox API, and access as Full Dropbox. Give a name to your app and click on Create app button.

(Refer to the image below to create the app)

Screen App settings

After the app is created, there are a few more settings you need to do to proceed. Keep the App key and App secret handy. You have to update the Redirect URIs in the OAuth 2 section later on.

Screen App advanced settings

Now, create the Visualforce page from where you will be uploading the files to Dropbox. Set the URL of the visual force page in the Redirect URIs of the Dropbox app. (image below)

Screen Update the Redirect URI with vf page URL

Click the Dropbox login button to log in to Dropbox and authorise it to upload files to your Dropbox account.

Screen Click Dropbox login

Login to your Dropbox account to give authorisation.

Screen Login to Dropbox

Now you can see the email id of the connected Dropbox account and a file uploaded.

Select a file and Upload to Dropbox.

Screen Select file and Upload

[code language=”java”]

public DropboxUploadController() {
connected = false;
success = false;
apiKey = ”; // this is your dropbox apikey
apiSecret = ”; // this is your dropbox api secret
redirectURI = ‘https://souravmoy-dev-ed–c.ap2.visual.force.com/apex/DropboxUpload’; // url of the vf page in which the dropbox login is done
Dropbox_Account_endpoint = ‘https://api.dropboxapi.com/1/account/info’;
Dropbox_files_endpoint = ‘https://content.dropboxapi.com/1/files_put/auto/’;
Dropbox_OAuth_authorize = ‘https://www.dropbox.com/1/oauth2/authorize’;
Dropbox_OAuth_token = ‘https://api.dropboxapi.com/1/oauth2/token’;

code = ApexPages.currentPage().getParameters().get(‘code’);
if(code != null) {
connected = true;
authorizationCode = code;
getRefreshToken();
retrieveUserInfo();
}
}

[/code]

In lines 4, 5 write the App Key and App Secret of your Dropbox app.

References:

The code in GitHub.

Leave a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

how can salesforce experience cloud drive customer engagement rates
How Can Salesforce Experience Cloud Drive Customer Engagement Rates?
salesforce world tour essentials mumbai
Salesforce World Tour Essentials Mumbai (19 June, 2024)
benefits of using salesforce for higher education Industry
Benefits Of Using Salesforce For Higher Education Industry?
salesforce for real estate
Salesforce for Real Estate: How Salesforce CRM Can Help Realtors
salesforce consumer goods cloud store setup
A Detailed Look into Salesforce Consumer Goods Cloud Store Setup
Scroll to Top