Scrive Plugin
The Scrive plugin helps you start a signing process for uploaded agreements, or template based agreements stored in Scrive. The signing process sends requests to the parties selected in the service.
Use the activity Start signing process from file in your Zervicepoint workflow to send a basic signature request for an uploaded agreement.
Use the activity Start signing process from template in your Zervicepoint workflow to send a basic signature request for an agreement based on a template in Scrive.
Use Get document status to see if the signature was signed or rejected.
For more advanced configurations, you can pass a JSON object using the Start signing process from file with json input or Start signing process from template with json input activities.
A complete documentation of Scrive's capabilities and json definitions can be found here: Scrive Document API
To get up to speed using this plugin, check out the usage section.
Activities
Activity | Internal name | Description |
---|---|---|
Start signing process from file | StartSigningProcessFromFile | Starts a document signing process based on an uploaded file and sends requests to parties. |
Start signing process from file with json input | StartSigningProcessFromFileWithJsonInput | Starts a document signing process based on an uploaded file and sends requests to parties specified in json. |
Start signing process from template | StartSigningProcessFromTemplate | Starts a document signing process based on a Scrive template and sends requests to parties. |
Start signing process from template with json input | StartSigningProcessFromTemplateWithJsonInput | Starts a document signing process based on a Scrive template and sends requests to parties specified in json. |
Get document status | GetDocumentStatus | Get a documents status. Returns a 'Status' variable with values: Preparation, Sent, Finished, or Rejected. |
Get document | GetDocument | Get a documents pdf file. Returns the pdf file as a Zervicepoint File. |
Installation and Configuration
Prerequisites
OAuth Token
The Scrive plugin uses an oauth token when communicating with Scrive. You need to craft a custom oauth token either by:
- Following the steps described in the Scrive OAuth Token Documentation
- Or by using the script below.
Once the oauth token is crafted, you need to add the values to the credential store as described in the Credential Store section below.
The script below helps you craft an oauth token using PowerShell.
Input | Description |
---|---|
ConsumerKey | Get value from https://scrive.com/new/integrations |
ConsumerSecret | Get value from https://scrive.com/new/integrations |
CallbackUrl | Currently not used by ZervicePoint. Can be set to: https://test.local |
#==========================
# 0. Generate Client Credentials in Scrive
# https://scrive.com/new/integrations
#==========================
# Add client credentials identifier
$consumerKey = ""
# Add client credentials secret
$consumerSecret = ""
# Callback Url
$callbackUrl = "https://test.local"
#==========================
# 1. Temporary credentials request and response
#==========================
# Scrive host environment (scrive.com for production or api-testbed.scrive.com for testing)
$hostName = "scrive.com"
$privileges = "FULL_ACCESS"
$uri = "https://$hostName/oauth/temporarycredentials?privileges=$privileges"
$callbackUrlEscaped = $([uri]::EscapeDataString($callbackUrl))
$authorizationString = "OAuth oauth_consumer_key=`"$consumerKey`",oauth_signature_method=`"PLAINTEXT`",oauth_callback=`"$callbackUrlEscaped`",oauth_signature=`"$($consumerSecret)%26`""
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authorizationString)
$temporaryCredentialResponse = Invoke-RestMethod -Uri $uri -Method GET -Headers $headers
#==========================
# 2. Authorization redirect
#==========================
$token = $temporaryCredentialResponse -replace "oauth_token=" -replace "\&.*"
"https://$hostName/oauth/authorization?oauth_token=$token"
#==========================
# 2.1 MANUAL STEPS:
# 1. Open the url generated above (Step 2. Authorization redirect) in a web browser
# 2. Click on Grant Access
# 3. Copy the url from the web browser
# It should look similar to this string: https://test.local/?=&oauth_token=123_456&oauth_verifier=123456
# 4. Paste the url in the $grantAccessResponse variable below.
#==========================
$grantAccessResponse = ""
#==========================
# 3. Token request and response
#==========================
$oauthToken = $temporaryCredentialResponse -replace ".*oauth_token=" -replace "\&.*"
$oauthSignature = $consumerSecret + "&" + ($temporaryCredentialResponse -replace ".*oauth_token_secret=" -replace "\&.*")
$oauthVerifier = $grantAccessResponse -replace ".*oauth_verifier="
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$authorizationString = "OAuth oauth_consumer_key=`"$consumerKey`",oauth_token=`"$oauthToken`",oauth_signature_method=`"PLAINTEXT`",oauth_timestamp=`"1636012927`",oauth_nonce=`"X4ZB5W4NCbq`",oauth_version=`"1.0`",oauth_callback=`"$callbackUrlEscaped`",oauth_verifier=`"$oauthVerifier`",oauth_signature=`"$oauthSignature`""
$headers.Add("Authorization", $authorizationString)
$credentialResponse = Invoke-RestMethod "https://$($hostName)/oauth/tokencredentials" -Method GET -Headers $headers
$accessToken = $credentialResponse -replace ".*oauth_token=" -replace "\&.*"
$tokenSecret = ($credentialResponse -replace ".*oauth_token_secret=" -replace "\&.*")
$verifier = $oauthVerifier
#===========================
# Output
#===========================
New-Object PSObject -Property @{
CallbackUrl = $callbackUrl
ConsumerKey = $consumerKey
ConsumerSecret = $consumerSecret
AccessToken = $accessToken
TokenSecret = $tokenSecret
Verifier = $verifier
}
Credential Store
Add the values as credential objects on the ProvisioningSystem server. The credential objects need to be added in the context of the service account running the ProvisioningSystem. The user name does not have any affect.
Name | Value |
---|---|
ScriveConsumerKey | Value of ConsumerKey |
ScriveConsumerSecret | Value of ConsumerSecret |
ScriveAccessToken | Value of AccessToken |
ScriveTokenSecret | Value of TokenSecret |
ScriveVerifier | Value of Verifier |
#==============================================================================
# Start PowerShell in context of the service account running ProvisioningSystem
#==============================================================================
# Add Values
$consumerKey = ""
$consumerSecret = ""
$accessToken = ""
$tokenSecret = ""
$verifier = ""
New-PFCredential -Name ScriveConsumerKey -UserName 'scrive' -Password $consumerKey
New-PFCredential -Name ScriveConsumerSecret -UserName 'scrive' -Password $consumerSecret
New-PFCredential -Name ScriveAccessToken -UserName 'scrive' -Password $accessToken
New-PFCredential -Name ScriveTokenSecret -UserName 'scrive' -Password $tokenSecret
New-PFCredential -Name ScriveVerifier -UserName 'scrive' -Password $verifier
Update Provider Config
ProvisioningSystem
Update the provider config with the settings applicable for your environment
scrive.provisioningsystem.providers.xml
Key | Example Value | Description |
---|---|---|
ConsumerKey | ScriveConsumerKey | Identifier for OAuth Consumer Key |
ConsumerSecret | ScriveConsumerSecret | Identifier for OAuth Consumer Secret |
AccessToken | ScriveAccessToken | Identifier for OAuth Access Token |
TokenSecret | ScriveTokenSecret | Identifier for OAuth Token Secret |
Verifier | ScriveVerifier | Identifier for OAuth Verifier |
BaseUrl | https://scrive.com/api/v2/ | Scrive API url. Either scrive.com or api-testbed.scrive.com |
CallbackUrl | https://test.local | Callback Url used when configuring oauth |
ZPAPIURL | https://portal.zervicepoint.com:30000/StoreName | URL To WebApi of your Store. The url must be set up as a key authentication in ZervicePoint. |
UICulture | en-US | language to display state messages in (en-US or sv-SE) |