Have you created an app on Clappia which allows users to upload images, videos and other files? Do you need a copy of these files in an S3 Bucket of your AWS Account? You can use these files to render on your own application, train ML models on these or you might just want to keep a backup with you.
The following workflow allows you to do that in real-time. As soon as a user uploads an image or any other file from web or from the Clappia mobile app, the file gets copied to your S3 Bucket at a location of your choice.
Features of this workflow
Supports all kinds of file uploads - images, videos, documents.
Works for files uploaded from web, Android or iOS apps.
Works for images captured using Clappia App's camera.
Workflow has an option to make the file public, in case you want to share the public links of these files with your users.
The path inside the S3 bucket can be dynamic in a way that it can contain variables from the app - like customer_name, customer_city etc.
This workflow is available for a minimum user billing of 30 users
How to configure the workflow?
Prerequisites
An AWS Account with an S3 Bucket.
Clappia's AWS Account needs to have write permissions to your AWS S3 Bucket. You will need our AWS Account Canonical User ID for that. Here it is - 1c51ca097949c9eaf90fb3a116b6fe267a3a774d5f0beaac4413a21fc0103f1f. See the video below to understand how to assign the permissions correctly.
An app on Clappia which has at least one block of type "Camera, images and files" (i.e., the File Upload block)
A secret API Key for you to access the workflow. Please ping us or drop us an email at contact@clappia.com to get this Key.
Steps to configure
Once your app is ready with at least field for File Uploads, go to the Workflows tab.
Choose one of New Submission, Edit Submission or Review Submission Flows. You might want to copy the files only for approved submissions. Use the Review Submission Flows in that case. More on these flows here.
Add a Rest API Step. You can add other steps before this, if required. For example, an IF Step to check a certain condition before uploading, or a WAIT step to wait for some time before uploading.
Add the following details to configure the REST API.
Server URL: https://apiv2.clappia.com/public/storage/uploadFileToExternalStorage
Headers: Should be a valid JSON. {"x-api-key":"<API_KEY_RECEIVED_ABOVE>", "Content-Type": "application/json"}
Body: Should be a valid JSON in a single line. Following attributes are required in the JSON.
appId: App Id of the Clappia App that you are working on.
workplaceId: Workplace Id of your company's workplace on Clappia. You can get it from <your_domain>.clappia.com/workplace
submissionId: Use the {$submissionId} variable for this.
fieldNames: A list of fields from the app whose file upload data needs to be copied. Get the field names from the Design App view of the App.
targetOptions: Is also a JSON object. Following is a sample. The keyPrefix can be dynamic. Any variable from the app can be used in that. "targetOptions": {"storageType": "S3","storageOptions": {"bucket": "<YOUR_AWS_BUCKET_NAME>","keyPrefix": "some-const-prefix/<APP_ID>/{location}", "makePublic": false}}
That's it. Your workflow is configured. You can try by making a submission on the App with a few images. All images will get copied to your S3 Bucket instantly.