- Visual Studio
- Basic Knowledge of ASP.NET MVC
- Basic Knowledge of C#
Article Flow
- Introduction about DocuSign
- Create an account on DocuSign portal
- Activate DocuSign account
- Generate Integrator Key
- Create ASP.NET MVC Empty project
- Create a Controller and View
- Install Docusign Integrations client from NuGet and enable it in our application
- Validate the DocuSign Connection
Introduction to DocuSign
DocuSign is a top eSignature brand that provides electronic signature technology and digital transaction management services for facilitating electronic exchanges of contracts and signed documents. The features of DocuSign include authentication services, user identity management, and workflow automation. Nowadays, no one is ready to make an in-person meeting, or contract, or bonding. Even a lot of software companies ask us to sign on a device to accept their offer letter, right? Okay, now we will move to the first step of creating an account on DocuSign. We can use the trial account until it goes to production.
Create an account on the DocuSign portal
To create an account, click
here. It's a Sandbox account and it will take you to the screen mentioned below. Fill in the required fields and get started into the DocuSign portal.
Activate DocuSign account
After registration, you will get a mail from the DocuSign team to activate your account. There, you need to reset your password and then you can redirect to your dashboard.
Generate Integrator Key
The Integrator key serves as the client id for the OAuth token. I'd first make sure that you're connecting the correct integrator key to the correct account. You can generate multiple integrator keys in the demo environment but when your API gets certified, only one integrator key can be promoted to production. Make sure that you are pointing to the demo environment with a valid integrator key. With the help of the integrator key only, we can integrate this DocuSign account to our application and this integrator key will act as a token for the user.
Given below is your dashboard and opt for the "Go to Admin" option to generate the integrator key.
By default, our account will be without integrator key, so we have to create that. To create an integrator key, click "Add integrator key".
While creating the API integrator key, give a proper name because, in the trial account, we can have multiple keys. Now, we will create an application.
In the below image, you can see that we got the integrator key. Now, we have got enough things to connect with our application.
Create ASP.NET MVC Empty project
- To create an ASP.NET MVC empty project, follow the below steps one by one. Here, I have used Visual Studio 2017.
- Select New Project -> Visual C# -> Web -> ASP.NET Web Application and enter your application name. Here, I named it "DocusignDemo".
- Now, click OK.
- Then, select Empty ASP.NET MVC template and click OK to create the project.
- Once you click OK, the project will be created with the basic architecture of MVC. If you are not aware of how to create an Empty ASP.NET Web Application, please visit Step 1 and Step 2 to learn
Once you complete these steps, you will get the screen as below.
Create a Controller and View
Now, create an empty Controller and View. Here, I created a Controller with the name of "DocusignController". Whenever we create an empty Controller, it is created with an empty Index action method. And create an empty View of this action method "Index".
Install Docusign Integrations client from NuGet and enable it in our application,
Select Package Manager Console
and Install-Package DocuSign.Integration.Client.dll -Version 1.7.2.
After installation, it will be integrated into our application as below.
Now, write the logic in your controller to validate this integration and account credentials.
- RestSettings.Instance.DocuSignAddress = "https://demo.docusign.net";
- RestSettings.Instance.WebServiceUrl = RestSettings.Instance.DocuSignAddress + "/restapi/v2";
- RestSettings.Instance.IntegratorKey = "******************************";
- DocuSign.Integrations.Client.Account account = new DocuSign.Integrations.Client.Account();
- account.Email = credential.UserName;
- account.Password = credential.Password;
- bool result = account.Login();
- if (result) {
- Console.WriteLine("Docusign Integration Success");
- } else {
- Console.WriteLine("Docusign Integration Failed");
- }
The above code is straightforward. Just run your application.
We successfully integrated the DocuSign with our application. In my next article, we will see how to send the documents for signature and how to track whether the documents are signed or viewed by the recipient.
Complete Controller
- using DocuSign.Integrations.Client;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace DocusignDemo.Controllers {
- public class DocusignController: Controller {
- MyCredential credential = new MyCredential();
-
- public ActionResult Index() {
- RestSettings.Instance.DocuSignAddress = "https://demo.docusign.net";
- RestSettings.Instance.WebServiceUrl = RestSettings.Instance.DocuSignAddress + "/restapi/v2";
- RestSettings.Instance.IntegratorKey = "PasteYour Integrator key";
- DocuSign.Integrations.Client.Account account = new DocuSign.Integrations.Client.Account();
- account.Email = credential.UserName;
- account.Password = credential.Password;
- bool result = account.Login();
- if (result) {
- Console.WriteLine("Docusign Integration Success");
- } else {
- Console.WriteLine("Docusign Integration Failed");
- }
- return View();
- }
- }
- public class MyCredential {
- public string UserName {
- get;
- set;
- } = "Enter Your Username";
- public string Password {
- get;
- set;
- } = "Enter Your Password";
- }
- }
Summary
In this article, we have seen how to Integrate DocuSign and Validate with our ASP.NET MVC5 Web application
I hope you enjoyed this article. Your valuable feedback and comments about this article are always welcome.