Dropbox Integration with Salesforce – Benefits and steps to integrate

Dropbox is a cloud storage platform that is used to store all your content, be it documents, videos, photos or any other type of file. Dropbox allows you to use a number of tools to make your work easy and keep flow smoothly. It also organizes the files and keeps files stacked according to the priority of their use.


It’s the smartest workspace that is designed to reduce the work, provide easy storage, commenting and sharing of the files. Dropbox is a collaborative platform that allows you to share your creative ideas with your team, can iterate the content individually or as a team.

Benefits of Dropbox integration with Salesforce

There is a great assortment of benefits you can enjoy by integrating Dropbox with Salesforce. Some of them are mentioned below

Easy store and sharing

Dropbox is the most popular cloud platform that allows you to store the files regardless of their size. When you edit or update the content, it synchronizes faster. There is no need to wait for the updated content, you can directly get it into your Dropbox.

Higher security

The Dropbox is designed to keep all your data safe and secure. It also allows you to keep data or files backup; you can backup files from other apps.

Keep files organized

It helps you to organize files that matter most to you so you can get the right content at the right time. The content you are looking for, Dropbox will keep it all in one place and provide easy access whenever you are in need.

Increased productivity

As it offers easy sharing and faster synchronization, you will get a lot of time saved. This time you can use to perform another action that is essential for your business growth. Accessing, managing and sharing of content with customers from their Salesforce records become easier with Dropbox integration

Real-time collaboration

It allows you to review, edit and share the content with another team member and customers. It’s the best collaborative workspace that enables you sharing of documents without leaving Salesforce. Real-time collaboration allows the team to access the most recent content version. 


A step-by-step guide to integrate Dropbox with Salesforce



  • Create a dropbox account on this click on the “App console” button and create a new app.


  • After creating the app, open the app
  • It provides “App key” and “App secret.
  • It also provides “Access token.”




  1. Now go to your Salesforce.org and create the JavaScript button and pass all required parameters which you want in the Pdf page also add the below line in the js button.


window.location.href =



  1. Now click on JS button it will redirect to below screen

Enter your username and password whenever I click on the sign-in button. It will redirect on my visual force page

  1.           Whenever you click on “click to export” button it will show below the page         
  2.  Let’s start with generating Access token by code.

Whenever Js button clicks it redirect URL contain “code”, that code is nothing its Authentication code.




How to get accessToken: 

 For getting accessToken you can use the given code

 String tokenuri = ‘https://api.dropbox.com/1/oauth2/token?grant_type=authorization_code&code=’+code+’&redirect_uri=https://my.salesforce.org..visual.force.com/apex/DropboxPage?core.apexpages.request.devconsole=1’; 

        HttpRequest req = new HttpRequest();





        Blob headerValue = Blob.valueOf(‘App key’ + ‘:’ + ‘App secret’);

        String authorizationHeader = ‘Basic ‘ + EncodingUtil.base64Encode(headerValue);

        req.setHeader(‘Authorization’, authorizationHeader);

        Http h = new Http();

        String resp;

        HttpResponse res = h.send(req);

        resp = res.getBody();


        JSONParser parser = JSON.createParser(resp);

        while (parser.nextToken() != null) {

            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME)){

                String fieldName = parser.getText();


                if(fieldName == ‘access_token’) {

                    accesstoken = parser.getText();




        system.debug(‘accessToken==>‘+accessToken );


 How to create a folder on Dropbox

     Given below is the code to create a folder on Dropbox 

      string Body = ‘{\”path\”: \”/folder/’+Folder Name+’\”,\”autorename\”: false}’;

                Http http1 = new Http();

                HttpRequest req1 = new HttpRequest();



                req1.setHeader(‘Authorization’,’Bearer ‘+accessToken);

                req1.setHeader(‘Content-Type’, ‘application/json’);


                HttpResponse res1 = http1.send(req1);

                statusCode = res1.getStatusCode();

                status = res1.getStatus();


How to Upload Pdf in dropbox

 Using the code given below you can upload pdf in Dropbox

blob b;

            pdf = Page.YourVfPagePdf;



             b = pdf.getContent();

            scholarName = app.Scholarship__r.Name;

            Http http = new Http();

            HttpRequest req = new HttpRequest();



            req.setHeader(‘Content-Type’, ‘multipart/form-data’);

            req.setHeader(‘Authorization’,’Bearer ‘+AccessToken);

            req.setHeader(‘Content-Type’, ‘application/octet-stream’);

            req.setHeader(‘Dropbox-API-Arg’,’{“path”:”/folder/’+Folder Name+’/’+fileName+’.pdf”,”mode”:”add”,”autorename”:true,”mute”:false,”strict_conflict”:false}’);



            HttpResponse res = http.send(req);


Integration of Dropbox with Salesforce ease the work in many ways by making storage and sharing of the content easy with Salesforce, enables the use of various tools, and easy synchronization with other apps. It’s the best way to get an increase in productivity and achieve the goal of business success. 

Leave a comment