Video Walk through of This Use Case

If you would like to see the "NDA Agreement Signing Use Case Using Google API Connectors" in action, in action, watch video below.

General Description

This use case demonstrates how ProcessMaker I/O combines with Google services to create and manage a Google document within sets of Google connectors. Both software programs provide the tools to build effective processes while satisfying a variety of business needs.

Non-disclosure agreement (NDA) documents are used in many industries. To show how ProcessMaker I/O works well with document templates, this example demonstrates how an NDA template can be customized for a specific person and format based on particular needs. In this example, a person must request a company's NDA to initiate business with that company. This person is called the "NDA requester" in this example. The NDA requester enters information about herself into a Google Form on the company's web site or portal. After submitting the Google Form to request the customized NDA document, the business process delivers the company's ready-to-use NDA into a Google Drive, and then shares it with NDA requester for signing.

Refer to the following topics regarding the description of this example:

Prerequisites

The following are prerequisites to use this example:

  • A Google Drive
  • Access tokens to allow the business process to read and write files to the Google Drive
  • A Gmail or G Suite email address
  • The means to view DOCX files if you want to view the NDA template used in this example

Process Scheme of This Example

Below is the process scheme:
"NDA Agreement Signing" process scheme

Process Description

Below is a description of the process:

  1. The NDA requester initiates the process by requesting an NDA. The NDA requester enters information about herself in the company's Google Form. Aside from basic information such as her name and email address (which is used to deliver the NDA to the NDA requester), she also specifies she is one of the following:

    • A vendor or partner representative with a third-party company that wants to initiate business
    • A new employee with the company
  2. After she submits the Google Form to request the NDA, the NDA Requester process lane ends.

  3. The Company process lane receives the request and begins.

  4. The Company process lane generates the NDA from a DOCX template called NON-DISCLOSURE-AGREEMENT-TEMPLATE.docx stored in the company's Google Drive. The generated NDA is customized to the NDA requester, including her name and other information she entered into the Google Form. The generated NDA has "Only for comment" permission, so the NDA requester cannot revise the NDA. In this example, the NDA is generated following this process:

    • If the NDA requester indicated that she represents a company, the NDA is generated into DOCX format.
    • If the NDA requester indicated that she is a new employee, the NDA is generated into HTML format, and then converted to DOCX format.
  5. The Company process lane places the NDA into the folder NDA docx result within the company's Google Drive. The NDA is named NDA_docx_result.docx.

  6. The Company process lane shares the NDA with the NDA requester.

  7. The NDA requester goes to the Check NDA status page to get the link to her personalized NDA. Refer to Complete the process for information how to use the Check NDA status page.

  8. The NDA requester reviews the NDA that has been shared from the company's Google Drive. Since the NDA has "Only for comment" permission, she cannot make changes to the NDA. She approves or denies the NDA.

  9. After the NDA requester approves or denies the NDA, the Company process lane renames the NDA to {Requester Full Name}_NDA_docx_result_Signed.docx or {Requester Full Name}_NDA_docx_result_Unsigned.docx, depending on whether the NDA requester approved or denied the NDA. The Company process lane ends.

Get Started with the Use Case

Refer to the following topics in this order to get started with the use case:

Run a ProcessMaker I/O Environment and Download the BPMN File

ProcessMaker I/O is an "always on" cloud service. In this document, an Environment refers to an installation of ProcessMaker I/O in a virtual machine or a container. This environment is created, run, and managed directly through the ProcessMaker I/O web management console.

If you don't have a ProcessMaker I/O Environment yet, do the following:

  1. Log on to your ProcessMaker I/O account. If you do not have a free ProcessMaker I/O account, please create one.
  2. Click Environments from the top menu.
  3. Click the Create Environment button.

If you already have a ProcessMaker I/O Environment, do the following:

  1. Log on to your ProcessMaker I/O account.
  2. Click Environments from the top menu, and then run a ProcessMaker I/O Environment. Ensure that your Environment is running. If your Environment is stopped, click the Run button.
  3. Click the Environment name to display your Environment's dashboard.
  4. Click the Info tab.
  5. From the API URL: field, copy the API URL link. This URL is your Environment's URL, and is required. Example: https://MYENVIRONMENT.api.processmaker.io/api/v1, where MYENVIRONMENT is your ProcessMaker I/O Environment name. Paste the URL into a text file to remember it for later.

    Copying the API URL for the ProcessMaker I/O Environment

  6. Click the Copy button to the right of the Access token: field, and then paste your Environment's access token into your text file.
  7. Save the text file because you will paste more information into it.
  8. From the Examples: field, click the Example: Click to open link to display the ProcessMaker I/O Examples Portal.
  9. From the left menu, click the NDA Agreement Signing Process tab.
  10. Click the NDA BPMN file link to download the BPMN file to your computer. You will use this BPMN file for this example.
  11. From your Environment, click the Import tab, and then click the Choose File button to upload the BPMN file from your computer to your Environment.

Create Credentials for Your Google Drive

Your ProcessMaker I/O Environment requires OAuth 2.0 credentials to the Google Drive API service. Follow these steps to create credentials to the Google Drive service:

  1. Log on to your Google Account, and then go to Google APIs & Services.
  2. Click the Select a project drop-down at the top of the page. The Select screen displays.
  3. Click the Create project button.

    Create a new Google API project

  4. In the Project name field, enter a name for the project, and then click the Create button. It takes a few seconds for the project to create.
  5. Click Library from the left menu.
  6. In the Search for APIs & Services field, search for, and then select the Google Drive tile.
  7. Click the Enable button.

    Enable the Google Drive API for your project

  8. Click Credentials from the left menu, and then click on the OAuth Consent Screen tab.
  9. In the Product name shown to users field, enter the name shown to users. Click the Save button.

    OAuth consent screen

  10. Go back to Credentials, click the Create Credentials button, and then select OAuth Client ID. The Create client ID page displays.

    Create credentials with OAuth client ID

  11. From the Application type group, select the Web application check box.
  12. In the Name field, enter a name for the web application.
  13. In the Authorized redirect URIs field, enter your authorized redirect URIs following these guidelines:
    • Enter your test server URL (http://mysite.dev).
    • Enter your production server URL (https://mysite.com).
    • Enter https://developers.google.com/oauthplayground to your redirect URLs temporarily, because you will need to use it in upcoming steps.
    • Alternatively, create a separate production key later.
  14. Click the Create button.

    Creating your web application

  15. The OAuth client screen displays your application's client ID and client secret. Document these values in the same text file as your Environment API URL, and then click the OK button.

    Client ID and client secret for your web application

  16. Go to https://developers.google.com/oauthplayground. The OAuth 2.0 Playground page displays.
  17. Click the settings icon in the top-right corner of the page. The OAuth configuration screen displays.
  18. Select the Use your own OAuth credentials check box.

    Check the "Use your own OAuth credentials" check box to enter client ID and secret

  19. The OAuth Client ID: and OAuth Client secret: fields display. Enter these values for your web application that you documented from the OAuth client screen, and then click the Close button.

    Enter your web application's OAuth 2.0 client ID and secret values

  20. In Step 1 Select & authorize APIs, scroll to Drive API v3, and then check each of the scopes.

    Authorize use of the Google Drive API scopes

  21. Click the Authorize APIs button, and then allow access to your account when prompted.
    Please note, during this step your account must be pre-approved by Google to use OAuth keys. You must fill in the form https://support.google.com/code/contact/oauth_app_verification if you are going to use the app only for personal verification purposes. Refer to the form section Apps for testing or personal use only.
  22. In Step 2 Exchange authorization code for tokens, the authorization code for your web application displays in the Authorization code: field. Select the Auto-refresh the token before it expires. check box, and then click the Exchange authorization for tokens button.

    Exchange authorization code for tokens before they expire

  23. When you get to Step 3 Configure request to API, click on Step 2 again to display your refresh token. Document the current refresh token in the same text file as your Environment URL, Google Drive client ID, and client secret values.

Configure Your Google Form That Captures Information for the NDA Requester

In this example, use a Google Form to enter values that customize the NDA document to the NDA requester, including information such as the person's name and address.

To configure the Google Form, follow these steps:

  1. View the Google Form titled "NDA request form."
  2. Copy the Google Form by clicking the Google Form menu, and then selecting the Make a copy option.

    Make a copy of the Google Form

  3. The Copy document screen displays. Select My Drive from the Folder option, and then click the OK button.
  4. Open your copy of the Google Form.
  5. Access the script editor by clicking the Google Form menu, and then selecting the Script editor... option.

    Access the script editor in your copy of the NDA request form

  6. Delete the existing script.
  7. Copy, then paste the code below into the script editor.
  8. The script contains placeholders to make it easier to locate where you need to enter your ProcessMaker I/O Environment and Google Drive service credentials. Follow these guidelines:
    • Search for PM I/O Environment URL, and then replace that with your Environment API URL.
    • Search for access_token_for_Environment, and then replace that with your Environment access token.
    • Search for google_drive_client_id, and then replace that with your Google Drive client ID.
    • Search for google_drive_client_secret, and then replace that with your Google Drive client secret.
    • Search for google_drive_refresh_token, and then replace that with the Google Drive refresh token.
  9. Save the script.
function myFunction(e) {
  var host = "PM I/O Environment URL";  //Paste your ProcessMaker I/O Environment URL. Example: https://2xqvknfa.api.processmaker.io/api/v1
  var token = "access_token_for_Environment"; //Paste your ProcessMaker I/O Environment Access Token.
  var datamodel={};
  //Specify Google Drive credentials
  datamodel.client_id = "google_drive_client_id";
  datamodel.client_secret = "google_drive_client_secret";
  datamodel.refresh_token = "google_drive_refresh_token";
  var headers = 
      { 
        "content-type": "application/json",
        "Accept": "application/json",
        "authorization": "Bearer "+token
      };
 
  var trigger_event_url = host+"/processes/Requester/events/NDA_form_request/trigger";
  var formResponse = e.response;
  var itemResponses = formResponse.getItemResponses();
  var replacement_array = {};
  for (var i=0; i<itemResponses.length; i++) {
    var key = itemResponses[i].getItem().getTitle();
    if (key == 'Name') {
      datamodel.RequesterName = itemResponses[i].getResponse();
      replacement_array.RequesterName = datamodel.RequesterName;
    }
    if (key == 'Address') {
      datamodel.RequesterAddress = itemResponses[i].getResponse();
      replacement_array.RequesterAddress = datamodel.RequesterAddress;
    }
    if (key == 'E-mail') {
      datamodel.RequesterEmail = itemResponses[i].getResponse();
    }
    if (key == 'Passport or ID number') {
      datamodel.RequesterID = itemResponses[i].getResponse();
      replacement_array.RequesterID = datamodel.RequesterID;
    }
    if (key == 'Phone number') {
      datamodel.RequesterPhone = itemResponses[i].getResponse();
      replacement_array.RequesterPhone = datamodel.RequesterPhone;
    }
    if (key == 'Choose NDA template') {
      datamodel.template = itemResponses[i].getResponse().toLowerCase();
    }
    if (key == 'Company name (for Customer)') {
      datamodel.RequesterCompanyName = itemResponses[i].getResponse();
      replacement_array.RequesterCompanyName = datamodel.RequesterCompanyName;
    }
   }
  datamodel.replacement_array = JSON.stringify(replacement_array);
  datamodel = JSON.stringify(datamodel);
  //Making our request body
  var data = {
    'data': {
      'type':'data_model',
      'attributes': {
        'content':datamodel
      }
    }
  };
  
  data = JSON.stringify(data);
  //Logger.log(data);
  var options = 
      { 
        "content-type": "application/json",
        "method": "POST",
        "headers": headers,
        "payload": data
      };
  
  
  var response = UrlFetchApp.fetch(trigger_event_url, options);
  Logger.log(response.getContentText());
}

Create the Project Trigger That the NDA Be Requested When the Google Form is Submitted

Create the triggering event that notifies the business process to use the information entered into the Google Form to generate the NDA. To do so, configure the triggering event after the Google Form is submitted. Submitting the Google Form using the entered values triggers the business process to continue.

To create the trigger event, follow these steps:

  1. From the script editor, go to Edit > Current project's triggers. The Current project's triggers screen displays.

    Current project's triggers screen

  2. Click the No triggers set up. Click here to add one now. link. If any triggers already exist in the Current project's triggers screen, delete them, and then create a new trigger.
  3. From the Run drop-down menu, select myFunction.
  4. From the first Events drop-down menu, select From form.
  5. From the second Events drop-down menu, select On form submit.

    Trigger settings for the NDA request form

  6. Click the Save button.
  7. The Authorization required screen displays to request permission to access to your Google data.

    Authorization required screen

  8. Click the Review Permissions button. Google requests the following permissions:
    • Connect to an external service
    • View and manage your forms in Google Drive
  9. Click the Allow button.

    Grant permission

Download the NDA Template File

Download Example_template.docx to the root of your Google Drive. This is the NDA template with variable placeholders, such as the NDA requester's name and address. During the business process, the values for these variable placeholders are captured from the Google Form that the NDA requester enters.

Process Execution

After completing all these steps, you're ready to use this example. Refer to the following topics regarding process execution:

Initiate the Process

Initiate a case of this process in one of the following ways:

  • Open your copy of the "NDA request form," enter information as the NDA requester, and then submit the Google Form.
  • Start the process manually by calling the eventTrigger() method using a ProcessMaker I/O SDK.
  • Request the eventTrigger() endpoint and pass all the field values presented in the Google script to this datamodel: "https://"+{YOUR_ENVIRONMENT_URL}+"/api/v1/processes/"+"Requester"+"/events/"+"NDA%20form%20request"+"/trigger"

Complete the Process

To complete a case of the process, follow these steps:

  1. Verify that the NDA is generated and placed into your Google Drive in a folder called NDA docx result. The NDA in that folder is named NDA_docx_result.docx.
  2. Go to the Check NDA status page. For this example, this page displays all NDA requests by email address as well as a link to each requester's NDA. Use this page as an NDA requester to view your generated NDA, and then either deny or approve the NDA.
  3. In the API URL field, enter the URL to your ProcessMaker I/O Environment.
  4. In the Token key field, enter your ProcessMaker I/O Environment token.
  5. Click the Save API URL and key button to save these settings.
  6. Refresh the page.
  7. From the Check NDA status list box, select the email address corresponding with your NDA request. The link to the shared NDA on the Google Drive displays.

    Select the email address corresponding with an NDA requester

  8. Click on the link to open the generated NDA document that is personalized with the information you entered for that process case.
  9. On the Check NDA status page, click one of the following buttons:
    • Deny: Click Deny to reject the NDA.
    • Approve: Click Approve to approve the NDA.
  10. Return to your Google Drive and look at the how the NDA has been renamed in the NDA docx result folder. Notice how the NDA has been renamed to {Requester Full Name}_NDA_docx_result_Signed.docx or {Requester Full Name}_NDA_docx_result_Unsigned.docx, depending on whether you approved or denied the NDA.

View and Delete Processes

To view cases (or instances) run against a process, follow these steps:

  1. Log on to your ProcessMaker I/O account, and then access the Environment running the process.
  2. Click the Processes tab. If the process has cases against it, an arrow displays to the left of the process name.
  3. Click the arrow to display information about that process's cases.

To delete a process (and all cases for that process), click the Delete button for that process. To delete all processes for this example, delete Approver and Requester.

Detailed Description of the "NDA Agreement Signing Use Case Using Google API Connectors"

Refer to the following topics regarding a detailed description of this use case:

Process Lane Descriptions

Each process lane in this process is briefly described below.

Process Lane Description
NDA Requester The process begins when a user enters information into a Google Form to request an NDA from the company.
Company The company performs the following actions: (1) generate an NDA from a DOCX template stored on a Google Drive; (2) put the NDA customized to the NDA requster into the same Google Drive, then shares it with the NDA requester; and (3) adds the suffix "Signed" or "Unsigned" to the original NDA file name depending on whether the NDA requester approved or denied the NDA.

Process Task Descriptions

Tasks in this process are described below in the order they appear in the process scheme from left to right, top to bottom.

Task Type Connector/Form Method
NDA form request start event
Google Form Request sent intermediate throw event CorrelationKeys
NDA Request intermediate throw event CorrelationKeys
Read Template from the Google Drive service task Google/GDReaderConnector ReadFile
Generate NDA service task DocxConnector
Generate NDA based on HTML service task HTMLDocConnector
Upload generated NDA to Google Drive service task Google/GDConnector CreateFile
Set Permission service task Google/GDPermissionConnector ShareFile
Send Email to the requester service task SendEmailConnector
Check NDA Status user task JQuery form
Add to the file name mark "Signed" service task Google/GDConnector RenameFile
Add to the file name mark "UnSigned" service task Google/GDConnector RenameFile
Send Email with Signed NDA service task SendEmailConnector
Add NDA to Google Drive service task GDConnector

Forms

Refer to the following topics regarding forms in this use case:

Google Form to Manually Request an NDA

In this example, information is manually entered into a Google Form that triggers the “Manual Request” event when the Google Form is submitted.

Please note: This is a sample form that does not contain response validation. You must manually adjust this form from your Google Forms account. To use the form you need to copy the form to your Google Drive account, change the ProcessMaker I/O Environment API URL and authorization token in the Google script, and configure the form trigger.

Field ID Field Label Enabled Required Data Type Field Description
RequestorFullname Name Y N String Requester's full name that displays in the generated NDA.
RequestAddress Address Y Y String Requester's address that displays in the generated NDA.
RequestorEmail Email Y N String Requester's email address that displays in the generated NDA.
RequestorID Passport or ID number Y N String Requester's passport or ID number that displays in the generated NDA.
RequestorPhone Phone number Y N Integer Requester's phone number that displays in the generated NDA.
Business/Employee Choose NDA template Y N Multichoice Type of template to use for the generated NDA. This example uses the following templates:
{
Customer option generates an NDA for a vendor or partner representative with a third-party company
Employee option generates an NDA for a new company employee
}
CompanyName Company name (for Customer) Y N String Company name the requester represents. In this example, use only if Customer option is selected.

Check NDA Status Form

This is a jQuery implementation for the “Check NDA status" user task. In this example, the NDA requester goes to the Check NDA status form to locate her NDA based on the email address she entered into the Google Form.

Please note: This is a sample form that, if used in production, would require the NDA requester to enter the email address into a secure site to locate the generated NDA. The jQuery implementation used in this example is for demonstration purposes only.

For information how to use the Check NDA status form, request an NDA, and then refer to the Complete the process.

Messages

All messages are emailed and performed by the Email connector.

Message Title Task Content
Notification to requester Send email Hello {{RequesterFullname}},
Thank you for your interest in our company.
Your copy of the NDA has been shared via your email {{RequesterEmail}} and is located here {{RequesterGoogleDocLink}}
Please review and sign the NDA, then we will proceed with your data.
Best regards,