Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Joni
Product and Topic Expert
Product and Topic Expert

Introduction


This blog post extends existing NIVEDITA Valluru Lakshmi's blog post, but instead of using SAP Intelligent RPA Desktop Studio validating digital signature via DocuSign API, this blog show you how you can achieve the same using SAP Intelligent RPA Cloud Studio (based on requests from other colleagues, partners, and customers).

For the motivation or objective of validating digital signature, please check out her blog.

Prerequisites



  • Subscription to SAP Intelligent RPA service

  • Access to SAP Intelligent RPA Cloud Studio


Automation Options


DocuSign provides 2 ways of validating digital signature of digital document: Web-based and API-based.
With SAP Intelligent RPA, you can choose do run automation via UI (web) or API (web service).
Whenever API is available always use consume API approach, this way you can directly go to workflow development and skipping handling capturing application, and its pages also identifying the UI elements.

This blog is focusing on automation via API approach. It's more robust and save more time in RPA bot development.


Validator API Specification


One thing to take note here is the API requires us to encode the file binary into Base64 for data transmission without loss or modification of the contents itself.


Designing Automation Workflow in Cloud Studio


Before you begin any of below steps, please create an Automation Project first.

Add Read file activity, and ensure you have selected encoding as binary in Input Parameters section.
Return fileContent in Output parameters section.



Add Encode String activity with fileContent as input. Remember to set isBinary as true otherwise you will get an error during API call. Return base64EncodedOutput as an output parameter.



Add Custom Script activity and create base64Encoded as input parameter, and optionsPost as an output parameter.
Map base64Encoded with base64EncodedOutput from previous step as we will pass base64Encoded into our custom script later.

Add the following script:
var payload = {
"bytes": base64Encoded,
"mimeType": {
"mimeTypeString": "pdf"
}
};
return {
method: 'POST',
url: "https://validator.docusign.com/api/v1/rest/validation/validateSignature",
responseType: 'json',
resolveBodyOnly: true,
json: payload
};

Return the script as optionsPost.



Add Call Web Service activity and configure options input field with optionsPost from previous step in Input Parameters section.
Return the result as apiResponse in Output Parameters section.



Below onward are optional steps, it show you how you can output the API response as a log message and display custom message on a dialog box.

Configure apiResponse in message input field in Input Parameters section.



Below just show you example how you can parse API response from JSON and output it into formatted message such as dialog box.
Create res input parameter and map the input with apiResponse later in Input Parameters section.

Add the following script:
let signatureCount = res.signaturesReports.simpleReport.signaturesCount;
if (signatureCount > 0) {
let signatureFrom = res.signaturesReports.simpleReport.signature[0].signedBy;
let signatureFormat = res.signaturesReports.simpleReport.signature[0].signatureFormat;
var displayMsg = "Found " + signatureCount + " digital signature.";
displayMsg = displayMsg + " Signature from: " + signatureFrom + ".";
displayMsg = displayMsg + " Signature format: " + signatureFormat + ".";
return displayMsg;
} else {
return "No digital signature found.";
}

Set formattedOutput as a return string in Output Parameters section.



Finally add Open Message Dialog. Select Custom Data in dialogParams field and map formattedOuput in message input field.



You can try with any digital signed document you have, and if there's a digital signature detected in the document by DocuSign, you should get this output and perform additional digital signature validation:


For more information on SAP Intelligent RPA


2 Comments