Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section

The Story

In order not to have to create the same envelope again and again for constant situations, the seller creates a template that he/she can use for constant contract. To create a template and use it in constant situations does not only save time but also prevents mistakes such as for example a text field being forgotten.

Use Case Description

Following steps are necessary:

  1. Create a template
  2. Use the template

This case leads you through the process of creating a template with the UI and working with the template with the API. In order not to create the same envelope again and again this case explain how to create a template. Thus, time can be saved. First, we have to create a template with the UI. The following screenshot shows where you can find the template section:

FigureDescription

  1. You can create a new template in this section
  2. Click this button to create the first template

If you click on “create your first template” the following window appears:

You can either define a recipient for the template like it is shown in the figure above, or you can define placeholder. Note: If you define placeholders for your template you have to override them if you use the template.

Here you can find a figure of a template with two placeholders:

There you can configure all settings for the template. After the configurations you can update the template which is shown in the next screenshot:

FigureDescription

  1. Update and save the template

After saving the template you can now use the Id of the template and work with the API. If you open the template you can see the template in the URL:

e. g.: https://demo.esignanywhere.net/Templates/Detail/##TemplateID##



Section

Integration

Info

Note: If you have defined placeholders for the template you want to use with the API, you have to override the email address of the placeholders.

To get the email addresses of the placeholders you need the get envelope API call (envelope/##templateId##). In the response in the section steps you can find the email address of the placeholder. Afterwards you have to override the email address in the sendFromTemplate API call.

Please see the following configuration:

Code Block
languagejava
themeEclipse
{
  "TemplateId": "##templateId##",
  "EnvelopeOverrideOptions": {
    "Recipients": [
      {
        
        "OrderIndex": 1,
        "Email":"Placeholder:first signer",
        "Recipient": {
          "Email": "##email_of_the_signer##",
          "FirstName": "SomeName",
          "LastName": "SomeName",
          "LanguageCode": "en"
        }
        },




Section

Copy Document from template

For this api call you just need the templateId. The response of this call is a new SspFileId and the workstep configuration of the template. You can use the SspFileId and the workstep configuration to send an envelope.

api endpoints:

  • REST: /v4/envelope/{templateId}/copyFromTemplate
  • SOAP: CopyDocumentFromTemplate_v1

Create envelope from template

You can also create an envelope from a template via api. You can find a configuration in the next section. After finishing the api call you will get a draftId for the created envelope.

Code Block
languagejava
themeEclipse
{
  "TemplateId": "##TemplateId##",
  "EnvelopeOverrideOptions": {
    "Recipients": [
      {
        "RecipientId": "##RecipientId##",
        "OrderIndex": 1,
        "Email": "##EMAIL##",
        "Recipient": {
          "Email": "##EMAIL##",
          "FirstName": "##NAME##",
          "LastName": "##NAME##",
          "LanguageCode": "en",
          "EmailBodyExtra": "string",
          "DisableEmail": false,
          "AddAndroidAppLink": false,
          "AddIosAppLink": false,
          "AddWindowsAppLink": false,
          "AllowDelegation": true,
          "SkipExternalDataValidation": false,
          "AuthenticationMethods": [
            {
            }
          ],
          
          "SwissComCertificateData": {
            "PhoneNumber": "string",
            "MobileId": "string",
            "Parameters": [
              {
                "Key": "string",
                "Value": "string"
              }
            ]
          },
          "RemoteCertificateData": {
            "UserId": "string",
            "DeviceId": "string"
          },
          "OtpData": {
            "PhoneMobile": "string"
          },
          "Pkcs7SignerData": {
            "AllowedPkcs7SignatureTypes": [
              "LocalCertificate"
            ]
          }
        }
      }
    ],
    "AddFormFields": {
      "Forms": {
       
        
      }
    },
    "OverrideFormFieldValues": {
      "Forms": {
       
        
      }
    },
    "Name": "string",
    "EmailSubject": "string",
    "EmailBody": "string",
    "EnableReminders": true,
    "FirstReminderDayAmount": 1,
    "RecurrentReminderDayAmount": 1,
    "CallbackUrl": "string",
    "StatusUpdateCallbackUrl": "string",
    "WorkstepEventCallback": {
      "Url": "string",
      "Blacklist": [
        "string"
      ],
      "WhiteList": [
        "string"
      ]
    },
    "MetaDataXml": "string"
  },
  "CreateDraftOptions": {
    "AfterSendRedirectUrl": "string",
    "AfterSendCallbackUrl": "string",
    "RedirectPolicy": "None",
    "AllowAgentRedirect": true,
    "IframeWhiteList": "string"
  }
}


Expand
titleAlternative: SOAP implementation (deprecated)


Code Block
languagexml
themeEclipse
  <overrideOptions>
   <name>new name</name>
   <eMailSubject>new subject</eMailSubject>   
   <eMailBody>new body</eMailBody>  
   <callbackUrl></callbackUrl> 
   <statusUpdateCallbackUrl></statusUpdateCallbackUrl>   
   <enableReminders>true</enableReminders>   
   <firstReminderDayAmount>1</firstReminderDayAmount>
   <recurrentReminderDayAmount>2</recurrentReminderDayAmount>
   <beforeExpirationReminderDayAmount>1</beforeExpirationReminderDayAmount>  
   <daysUntilExpire>20</daysUntilExpire>
   <recipientOverrides>
      <recipientOverride>
         <recipientLookUp>	
            <eMail>##EMAIL##</eMail>
            <orderIndex>1</orderIndex>
         </recipientLookUp>
         <recipient>
            <eMail>##EMAIL##</eMail>
            <emailBodyExtra>some extra text</emailBodyExtra>
            <firstName>Hello</firstName>
            <lastName>World</lastName>
            <languageCode>en</languageCode> 
         </recipient>
      </recipientOverride>
   </recipientOverrides>
</overrideOptions>


For a SOAP implementation the following information (draftOptions) must be also filled in:

Expand
titleAlternative: SOAP implementation (deprecated)


Code Block
languagexml
themeEclipse
  <draftOptions>
    <afterSendRedirectUrl></afterSendRedirectUrl>
    <afterSendCallbackUrl></afterSendCallbackUrl>
    <redirectPolicy>ToDesigner</redirectPolicy>
</draftOptions>


Send envelope from template

Now you can send an envelope from a template. For this call you need the template Id as well as the overrideOptions. The next configurations show you the override options:

Info

The configuration has not all settings included. It is just for testing the API call with some simple configuration. The whole configuration you can find in the next collapse.


Code Block
languagejava
themeEclipse
{
  "TemplateId": "##TemplateId##",
  "EnvelopeOverrideOptions": {
    "Recipients": [
      {
        "RecipientId": "##RecipientId##",
        "OrderIndex": 1,
        "Email": "##EMAIL##",
        "Recipient": {
          "Email": "##EMAIL##",
          "FirstName": "TESTNAME",
          "LastName": "TESTLASTNAME",
          "LanguageCode": "en",
          "EmailBodyExtra": "string",
          "OtpData": {
            "PhoneMobile": "string"
          },
          "Pkcs7SignerData": {
            "AllowedPkcs7SignatureTypes": [
              "LocalCertificate"
            ]
          }
        }
      }
    ],
    "AddFormFields": {
      "Forms": {
        
      }
    },
    "OverrideFormFieldValues": {
      "Forms": {
       
      }
    },
    "Name": "TEST",
    "EmailSubject": "TESTEMAILSUBJECT",
    "EmailBody": "string",
    "EnableReminders": true,
    "FirstReminderDayAmount": 2,
    "RecurrentReminderDayAmount": 1,
    "BeforeExpirationDayAmount": 1,
    "DaysUntilExpire": 25,
    "CallbackUrl": "string",
    "StatusUpdateCallbackUrl": "string",
    "MetaDataXml": "string"
  }
}


Expand
titleAlternative: SOAP implementation (deprecated)


Code Block
languagexml
themeEclipse
 <overrideOptions>

   <name>Sending with template</name>
   <eMailSubject>Subject of the envelope</eMailSubject>
   <eMailBody>Please sign the document!</eMailBody>
   <callbackUrl></callbackUrl>
   <statusUpdateCallbackUrl></statusUpdateCallbackUrl> 
   <enableReminders>true</enableReminders>
   <firstReminderDayAmount>1</firstReminderDayAmount>
   <recurrentReminderDayAmount>2</recurrentReminderDayAmount>
   <beforeExpirationReminderDayAmount>1</beforeExpirationReminderDayAmount>
   <daysUntilExpire>20</daysUntilExpire>
   
   <recipientOverrides>
      <recipientOverride>
		 <recipientLookUp>
            <eMail>##EMAIL##</eMail>
            <orderIndex>1</orderIndex>
		 </recipientLookUp>
         <recipient>
            <eMail>##EMAIL##</eMail>
            <emailBodyExtra>Some extra text</emailBodyExtra>
            <firstName>FIRSTNAME</firstName>
            <lastName>LASTNAME</lastName>
            <languageCode>en</languageCode>
           
         </recipient>
      </recipientOverride>
   </recipientOverrides>
</overrideOptions>




...