Adobe eSign integration with ASP.NET

Adobe eSign integration with ASP.NET

Adobe eSign integration steps:

  1. Setup developer account
  2. Configure API application
  3. Get Adobe Sign Token
  4. Integration with your application
  5. Integrate webhook application in your code

1. Setup developer account

To setup a developer account, visit the following link:

https://acrobat.adobe.com/in/en/sign/developer-form.html

Fill up the details asked in ‘Sign up to create your account’ form and click on ‘Continue’.

2. Configure API application

Once the developer account is created through Step – 1 mentioned above, open https://secure.echosign.com/public/login  link to login.

Once you logged on using your credentials, follow below steps to Configure API application:

  • Click on Account Tab.
  • Go to Adobe Sign API.
  • Click on API Application.

Adobe eSign integration

  • Click on add (+) Button to Create API Configuration.

Adobe eSign integration

  • Fill up requested details and Click on Save Button.
  • It will Create Your API Configuration Account which you can see in the list. Select that and you will see other options – i.e. View / Edit|Deactivate|Configure OAuth above the grid.
  • Click on View Edit. You can see a popup like below image. You can edit the name of application configuration.

Adobe eSign integration

  • Now Click on Configure OAuth for Application.
  • You need to fill redirect URL and select checkbox as you needed and select option as per permission.
  • Now you had successfully created your Adobe sign configure an account.

 3. Get Adobe Sign Token

  • To get Adobe Sign token, we will need an authorization code. To get the authorization code, you need to create the URL and paste it in your browser:

The URL looks like:

 https://secure.in1.echosign.com/public/oauth?redirect_uri={RedirectURI}&response_type=code&client_id={Client ID}&scope= {SCOPE}

  • Redirect URL, ClientID & SCOPE: you will get this from the API application, which you set up, in Step – 2 above.

In our case, the URL will look like:

https://secure.in1.echosign.com/public/oauth?redirect_uri=https://example.com/oauthDemo&response_type=code&client_id=xxxxxxxxxxxxxxx&scope=user_login:self+agreement_write:account

  • Once you paste the above URL in the browser, it will send a request to Adobe Sign; Adobe Sign will process your request and will redirect you to redirection URI that you provided in above URL. Along with the redirection URL, you will see additional parameters that Adobe Sign has added in redirection URL. Among that parameters, copy the value of ‘Code’, ‘Web access point’ and ‘API access point’ parameters, as we will need those to generate Adobe Sign token as well as call other Adobe Sign APIs from our code. Please see following same redirection URL for your reference:

https://example.com/oauthDemo?code=d5Q3HC7EGNH36SE3N&state=S6YQD7KDA556DIV6NAU4ELTGSIV26ZNMXDSF7WIEEP0ZLQCLDQ89OYG78C3K9SROC8DXCGRVSGKU1IT1&api_access_point=https://api.in1.echosign.com/&web_access_point=https://secure.in1.echosign.com/

  • To get Adobe Sign Access Token, make an HTTP POST to the /oauth/token endpoint (using the api_access_point retrieved in the previous step) with the following parameters:

Adobe eSign integrationAdobe eSign integrationYou will Get Response like

Adobe eSign integrationThe Access_Token & Refresh_Token in response is Adobe Sign Access token store that as we will need that while calling Adobe Sign API through our code.

4. Integration with your application

To sign the document through Adobe Sign, you need to do three things as mentioned below:

  1. Create an API client object:

You can do that using the following statement:

var apiClient = new ApiClient(configuration.ClientId, configuration.SecretId, configuration.AccessToken, configuration.RefreshToken, configuration.AccessPointURL);

  1. Upload the document to Adobe Sign

You can upload your document to Adobe Sign server by calling upload document API. Following code outlines how to do that:

var transientDocumentsApi = apiClient.GetTransientDocumentsApi();

var transientDocumentResponce = transientDocumentsApi.CreateTransientDocument(fileByteArray, fileName, mimeType);

  1. Send the document for the signature

To send the document for signature, you first need to create the agreement for the uploaded document. You can do that by calling Adobe Sign API as outlined below:

var agreementsApi = apiClient.GetAgreementsApi();
var agreementCreationInfo = new AgreementCreationInfo();
agreementCreationInfo.FileInfos = new List<FileInfo>()
{
new FileInfo()
{
TransientDocumentId = transientDocumentResponce.TransientDocumentId
}
};
agreementCreationInfo.ExternalId = new ExternalId()
{
Id = DateTime.Now.Ticks.ToString()
};
agreementCreationInfo.Name = documentName + DateTime.Now.ToString();
var participantSetsInfo = new List<ParticipantSetInfo>();
foreach (var participant in userListDetails)
{
participantSetsInfo.Add(
new ParticipantSetInfo()
{
MemberInfos = new List<ParticipantSetMemberInfo>()
{
new ParticipantSetMemberInfo()
{
Email = participant.Email,
}
},
Name = (string.IsNullOrEmpty(participant.FirstName) ? string.Empty : participant.FirstName) + (string.IsNullOrEmpty(participant.LastName) ? string.Empty : participant.LastName),
Role = “SIGNER”, // SENDER / SHARE
Order = (participant.Sequence == 0 ? 1 : participant.Sequence)
}
);
}
agreementCreationInfo.ParticipantSetsInfo = participantSetsInfo;
agreementCreationInfo.EmailOption = new EmailOption()
{
SendOptions = new SendOptions()
{
InitEmails = “ALL”,
InFlightEmails = “ALL”,
CompletionEmails = “ALL”,
}
};
agreementCreationInfo.SignatureType = “ESIGN”;
agreementCreationInfo.State = “IN_PROCESS”;
var agreementResponse = agreementsApi.CreateAgreement(agreementCreationInfo);

As soon as you create the document, it will route through defined participate(s) in defined order for signature.

5. Get real time status update

You can get the real time signature status updates of your document by integrating Adobe Webhook with your application.