How to integrate Google drive API with ProcessMaker to download file in input documents?
There can be a scenario where we may like to refer some documents in the case, for which ProcessMaker provide us with an input document. There can be different sources to upload file in input documents.
What will you do if you have to upload files from Google drive?
In order to do this you will download file from Google drive manually, then create a case in ProcessMaker and upload that file in input documents. But now you can automate this process by following solution.
Let’s take an example; we have a CSV file with basic case field data and Google drive link.
When you upload that CSV, the automation process will read the CSV. It creates a case by mapping the CSV fields data with dynaform fields, if drive link exists in CSV then it downloads the documents/files from that link into ProcessMaker and attaches it to the respective case(s) as input document.
Let’s see how it works.
1. A CSV file consisting of case data and drive link.
2. Google Drive API credentials
3. A custom plugin to upload CSV and download documents from Google drive.
We have to make sure that the CSV file we are going to refer should contain case data which will be used to map CSV fields with the dynaform fields while the case is created. It should also contain Google drive link from which we will download files for input documents.
Google Drive Api Credentials:
The Google Drive platform gives you a group of APIs along with client libraries, language-specific examples, and documentation to help you develop apps that integrate with Drive. The core functionality of Drive apps is to download and upload files in/from Google Drive. This page describes some of that functionality and points you to resources for building it into your app.
Complete the steps described in this
https://developers.google.com/drive/web/quickstart/php page, and in about five minutes you’ll have a simple PHP command-line application that makes requests to the Drive API.
The plugin can be developed that can handle following things by writing script for each:
1. Uploading CSV File.
2. Read CSV files data and map CSV fields with dynaform fields.
3. Create case in ProcessMaker.
4. Download drive files and attach those files against associative case created as input document.
To develop plugin in ProcessMaker you can refer to following link Click Here
By following these simple steps one can achieve multiple goals at a time. Like in this example we created new case(s) without manually creating each case, multiple cases can be created at one instance and lastly downloading files from Google drive.