Downloading a file from IBM Cloud Object Storage S3 to a Dropbox folder
Learn how to create an event-driven flow that downloads a file from IBM® Cloud Object Storage S3 automatically when a contact is created in Salesforce. The flow can then send the downloaded file to a specific folder in Dropbox.
IBM Cloud Object Storage S3 is ideal for holding large amounts of production data and large files, such as backups, archives, video files, and genomic data. Cloud Object Storage S3 is a reliable, durable, and resilient object storage service.
Scenario
This scenario uses Salesforce to manage customers and Cloud Object Storage S3 to store some related documents. The scenario also uses Dropbox to share files in folders that are specific to users. When a new contact is created, you want to create a folder in your Dropbox account and send a "getting started" document to this contact. The getting started document is a PDF file that is stored in your Cloud Object Storage S3 account.

Before you begin
- Find the following account details, which you need to connect IBM App
Connect to your applications.
- For Salesforce, you need a user ID and password to connect. If you want to create a free Salesforce account to test App Connect, make sure that you create a Developer account rather than a trial account. For more information, see How to use IBM App Connect with Salesforce
- To connect to a Cloud Object Storage S3 account, you need the following
values. You can get these values from the Endpoint and Service
Credentials pages in the side navigation of your Cloud Object Storage S3 dashboard.
- Enpoint URL
- Find the Cloud Object Storage S3 Endpoint PUBLIC or PRIVATE URL value for your region; for example, s3.us.cloud-object-storage.appdomain.cloud (PUBLIC URL for the us-geo region)
- Secret access key
- Go to Cloud Object Storage S3 Service credentials, then View credential (with HMAC), then cos_hmac_keys/secret_access_key.
- Access key ID
- Go to Cloud Object Storage S3 Service credentials, then View credential (with HMAC), then cos_hmac_keys/access_key_id.
- Region
- Go to Cloud Object Storage S3 Endpoint and select the value of Location; for example, us-geo.
Note: To get a secret access key and Access Key ID, you need to create a credential with the option to generate HMAC credentials. (When you add a credential, specify{"HMAC":true}in the field Add Inline Configuration Parameters (Optional). For more information, see Service credentials in the Cloud Object Storage S3 documentation.Figure 2. Credential with HMAC keys on Cloud Object Storage S3 console 
- You can create a connection to Dropbox either by using a Dropbox user ID and password or by using a Google account.
Create your flow
By using App Connect, you can create your flow from a template or from scratch if you want to explore the steps that are taken to create a flow.
Complete the following steps in App Connect.
- Go to Design, then click (or in earlier versions).
Complete the following steps. As you progress, App Connect automatically saves your changes. If you move away from the flow at any stage, the flow is saved as a draft flow that you can complete at another time.
- Enter a name that identifies the purpose of your flow; for example: Share Document with Salesforce Contact
- Select as the event that is to trigger the flow.
- Click the (+) and then scroll down to IBM Cloud Object Storage S3.
- Select as the action that App Connect
uses to download the ‘Getting Started’ document.
Figure 3. Cloud Object Storage S3 Download object action 
- If you have not connected App Connect to Cloud Object Storage S3, click Connect and then complete and
submit the request by using the account details that you obtained previously.
Figure 4. Specify details to connect to Cloud Object Storage S3 
- Select the ‘Bucket’ where your document is stored on Cloud Object Storage S3.
Figure 5. Download the object from Cloud Object Storage S3 
- Select the type of file as ‘binary’ since you are downloading a PDF document
- Set the Object name as the name of your ‘Getting_Started’ manual.
- For the next node, click the (+) after the IBM Cloud Object Storage S3
node and scroll down to the Dropbox.
You next create a folder for the new Salesforce contact.
- Select as the action that App Connect
uses to create a folder.
Figure 6. Create a folder on Dropbox 
- Set the Path field to uniquely identify a folder for the contact. For an example, you can create a folder with the given name and surname of the contact, and separate them with an underscore. The value is mapped from the New contact field of the Salesforce node into the Path field of the Dropbox Create folder action
- Next, create the ‘Getting Started’ manual that was downloaded from Cloud Object Storage S3 in this folder on Dropbox.
- Click the Add node icon (+) after the Dropbox Create folder node and select Dropbox.
- This time, select as the action that App Connect uses to create a file.
- Set the following values for the fields in the Create file action.
- For the Path, map the given name and surname (which are separated by an underscore) to the Salesforce New contact field.
- Map the File content field to the Object content from the Cloud Object Storage Download object.
- Set Auto rename to false because the file is being created for the first time.
- Set Mute to false.
- Set the FileName field to the name of your getting started document (for example, Getting_Started.pdf).
- Set Is text to false because you're uploading a PDF file.
- To test the flow, click Start flow, then click Design to exit the flow editor. Your flow is shown on the
Design page and is listening for your event (the
addition of a new contact in Salesforce).
Figure 7. The flow tile on the Design page, showing that the flow is running and listening for events 
Test your flow
- Log in to Salesforce using the account that you configured in App Connect.
- Create a Salesforce contact and save the contact.
Figure 8. Creating a contact in Salesforce 
- After a short while, check your Dropbox account for a new folder and document.
- Examine the Design page. If the flow ran successfully, the flow tile shows a green tick

Conclusion
You created a flow that is triggered when a new contact is added to Salesforce. The flow downloads a document from Cloud Object Storage, creates a folder on Dropbox, and places the downloaded document in the folder.