This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Repository files navigation

⚠ This SDK has been deprecated ⚠

This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.

The new Dropbox.Sign SDK can be found at hellosign/dropbox-sign-dotnet!

The new SDK and this legacy SDK are not backwards-compatible!

Please see here for a comprehensive migration guide.


HelloSign .NET SDK

Build status

An official library for using the HelloSign API written in C#.NET and powered by RestSharp.

Getting Help

Installation

The HelloSign .NET SDK can be installed using the NuGet package manager, under the package name HelloSign (package details).

If you prefer not to use NuGet, you can download a ZIP archive containing the built .dll files from the Releases page, or clone this repository and build the project yourself (see "Build from Source" below).

Usage

First, use our namespace:

usingHelloSign;

Create a client object:

// Using your account's API Keyvarclient=newClient("ACCOUNT API KEY HERE");// Or, using an OAuth 2.0 Access Token:varclient=newClient();client.UseOAuth2Authentication("OAUTH ACCESS TOKEN HERE");

Error Handling

Most methods will throw a relevant exception if something goes wrong. This includes when our server returns an error message documented here.

You should always be prepared to catch these exceptions and handle them appropriately. Refer to HelloSign/Exceptions.cs in this repository for information about the custom exception classes this library defines.

Warnings

Some API responses include one or more warnings if there was a non-fatal problem with your request. At any time, you may inspect the contents of client.Warnings (a List of HelloSign.Warning objects) and output them as you see fit.

Callback Event Parsing

If you're implementing a server that will receive callbacks from HelloSign, this library can parse the received JSON into a native object and perform the hash-based integrity check for you.

StringeventJson= ...;// Get this string from the 'json' POST parameter in the HTTP requestEventmyEvent=client.ParseEvent(eventJson);// The Event object contains accessors for all related data.Console.WriteLine("Received event with type: "+event.EventType);SignatureRequestrequest=myEvent.SignatureRequest;

Injecting Custom Request Parameters

In cases where this SDK might not directly support specifying a particular API request parameter that needs to be passed, there is now a way to inject your own custom parameters into the request before the SDK performs it.

Client.AdditionalParameters is a Dictionary object you can add these extra keys and values to. These parameters will be injected into all following API calls made by the SDK until you remove them. Here's an example:

client.AdditionalParameters.Add("white_labeling_options","{'primary_button_color':'#00b3e6'}");varapp=newApiApp{Name="Foo",Domain="example.com"};app=client.CreateApiApp(app)
client.AdditionalParameters.Remove("white_labeling_options");

Account Methods

Get your Account details

varaccount=client.GetAccount();Console.WriteLine("My Account ID is: "+account.AccountId);

Update your Account Callback URL

varaccount=client.UpdateAccount(newUri("https://example.com/hellosign.asp"));Console.WriteLine("Now my Callback URL is: "+account.CallbackUrl);

Create a new Account

// Throws exception if account already existsvaraccount=client.CreateAccount("new.account@example.com");Console.WriteLine("The new Account's ID is: "+account.AccountId);

Signature Request Methods

Send Signature Request using files (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Send Signature Request using files and text tags with custom fields (non-Embedded)

This example uses custom fields and text tags, using the AdditionalParamaters.add method:

varrequest=newSignatureRequest();request.Title="Sokovia Accords as discussed";request.Subject="Sokovia Accords - Please Sign";request.Message="Please sign ASAP";request.AddSigner("tony@starkindustries.com","Anthony Stark");request.AddSigner("steverogers_1918@aol.com","Steven Rogers");request.AddCc("shield@shield.org");request.AddFile("sokovia_accords.PDF");client.AdditionalParameters.Add("custom_fields","[{\"name\": \"Address\", \"value\": \"123 Main Street\"}, {\"name\": \"Phone\", \"value\": \"555-5555\"}]");request.UseTextTags=true;request.HideTextTags=true;request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using files and form fields (non-Embedded)

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddFile("c:\users\me\My Documents\nda.pdf").WithFields(// id type page x y w h req signernewFormField("chk1",FormField.TypeCheckbox,1,140,72,36,36,true,0),newFormField("txt1",FormField.TypeText,1,140,144,225,20,true,0),newFormField("dat1",FormField.TypeDateSigned,1,140,216,225,52,true,0),newFormField("sig1",FormField.TypeSignature,1,140,288,225,52,true,0),);request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Signature Request ID: "+response.SignatureRequestId);

Send Signature Request using a template (non-Embedded)

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.SendSignatureRequest(request);Console.WriteLine("New Template Signature Request ID: "+response.SignatureRequestId);

Note: You can optionally pass an API App client ID as a second parameter to SendSignatureRequest.

Create Embedded Signature Request using files

varrequest=newSignatureRequest();request.Title="NDA with Acme Co.";request.Subject="The NDA we talked about";request.Message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.";request.AddSigner("jack@example.com","Jack");request.AddSigner("jill@example.com","Jill");request.AddCc("lawyer@example.com");request.AddFile("c:\users\me\My Documents\nda.txt");request.AddFile("c:\users\me\My Documents\AppendixA.txt");request.Metadata.Add("custom_id","1234");request.Metadata.Add("custom_text","NDA #9");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Embedded Signature Request ID: "+response.SignatureRequestId);

Create Embedded Signature Request using a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.Subject="Purchase Order";request.Message="Glad we could come to an agreement.";request.AddSigner("Client","george@example.com","George");request.AddCc("Accounting","accounting@hellosign.com");request.AddCustomField("Cost","$20,000");request.TestMode=true;varresponse=client.CreateEmbeddedSignatureRequest(request,"CLIENT ID HERE");Console.WriteLine("New Template-based Embedded Signature Request ID: "+response.SignatureRequestId);

Get info about an existing Signature Request

varrequest=client.GetSignatureRequest("SIGNATURE REQUEST ID HERE");Console.WriteLine("Signature Request title: "+request.Title);

List Signature Requests

varallRequests=client.ListSignatureRequests();Console.WriteLine("Found this many signature requests: "+allRequests.NumResults);foreach(varresultinallRequests){Console.WriteLine("Signature request: "+result.SignatureRequestId);if(result.IsComplete)==true){Console.WriteLine("Signature request is complete.");}else{Console.WriteLine("Signature request is not complete");}}

If you want to add an additional filter for account_id, you can add this line:

client.AdditionalParameters.Add("account_id","ACCOUNT_ID_HERE");

Cancel a Signature Request

client.CancelSignatureRequest("SIGNATURE REQUEST ID HERE");

Remind a Signer to Sign

client.RemindSignatureRequest("SIGNATURE REQUEST ID HERE","EMAIL ADDRESS HERE");

Update a Signature Request

client.UpdateSignatureRequest("SIGNATURE REQUEST ID HERE","SIGNATURE ID HERE","NEW EMAIL ADDRESS HERE");

Download a Signature Request (in its current state) and save to disk

// Download a merged PDFclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf");// Or download a ZIP containing individual unmerged PDFsclient.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE","/path/to/output.pdf",SignatureRequest.FileType.ZIP);

Download a Signature Request (in its current state) as bytes

// Download a merged PDFvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE");// Or download a ZIP containing individual unmerged PDFsvarbytes=client.DownloadSignatureRequestFiles("SIGNATURE REQUEST ID HERE",SignatureRequest.FileType.ZIP);

Get a temporary URL to download a Signature Request

varurl=client.GetSignatureRequestDownloadUrl("SIGNATURE REQUEST ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Release an On-Hold Signature Request

client.ReleaseSignatureRequest("SIGNATURE REQUEST ID HERE");

Embedded Methods

Retrieve Embedded Signing URL for a particular signer

varresponse=client.GetSignUrl("SIGNATURE ID HERE");Console.WriteLine("Signature URL for HelloSign.open(): "+response.SignUrl);

Retrieve Embedded Templates Editing URL

varresponse=client.GetEditUrl("EMBEDDED TEMPLATE ID HERE");Console.WriteLine("Editing URL for HelloSign.open(): "+response.EditUrl);

Unclaimed Draft Methods (for Embedded Requesting)

Create Unclaimed Draft with a file (non-Embedded)

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT 1.pdf");draft.AddFile("LEASE.pdf");draft.TestMode=true;draft.AllowDecline=true;varresponse=client.CreateUnclaimedDraft(draft,UnclaimedDraft.Type.SendDocument);Console.WriteLine("Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a file

vardraft=newSignatureRequest();draft.AddFile("DOCUMENT A.pdf");draft.RequesterEmailAddress="EMAIL HERE";draft.TestMode=true;varresponse=client.CreateUnclaimedDraft(draft,myClientId);Console.WriteLine("Embedded Unclaimed Draft Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Create Embedded Unclaimed Draft with a template

varrequest=newTemplateSignatureRequest();request.AddTemplate("TEMPLATE ID HERE");request.RequesterEmailAddress="REQUESTER EMAIL HERE";request.TestMode=true;request.AddSigner("Client","CLIENT EMAIL","CLIENT NAME");request.AddSigner("Witness","WITNESS EMAIL","WITNESS NAME");varresponse=client.CreateUnclaimedDraft(request,myClientId);Console.WriteLine("Embedded Unclaimed Draft w/ Template, Signature Request ID: "+response.SignatureRequestId);Console.WriteLine("Claim URL: "+response.ClaimUrl);

Edit & resend Unclaimed Draft

Not implemented

Template Methods

Get Template details

vartemplate=client.GetTemplate("TEMPLATE ID HERE");

Add an Account to a Template

vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.AddAccountToTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Remove an Account from a Template

vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE","ACCOUNT ID HERE");// Or...vartemplate=client.RemoveAccountFromTemplate("TEMPLATE ID HERE",null,"EMAIL ADDRESS HERE");

Download a Template as a PDF and save to disk

client.DownloadTemplateFiles("TEMPLATE ID HERE","/path/to/output.pdf");

Download a Template as a PDF, as bytes

varbytes=client.DownloadTemplateFiles("TEMPLATE ID HERE");

Get a temporary URL to download a Template's files

varurl=client.GetTemplateFilesDownloadUrl("TEMPLATE ID HERE");Console.WriteLine("The download URL is: "+url.FileUrl);Console.WriteLine("The URL expires at: "+url.ExpiresAt);

Delete a Template

client.DeleteTemplate("TEMPLATE ID HERE");

Create a new Embedded Template Draft

vardraft=newEmbeddedTemplateDraft();draft.TestMode=true;draft.AddFile(file1,"NDA.txt");draft.Title="Test Template";draft.Subject="Please sign this document";draft.Message="For your approval.";draft.AddSignerRole("Client",0);draft.AddSignerRole("Witness",1);draft.AddCcRole("Manager");draft.AddMergeField("Full Name",MergeField.FieldType.Text);draft.AddMergeField("Is Registered?",MergeField.FieldType.Checkbox);varresponse=client.CreateEmbeddedTemplateDraft(draft,"CLIENT ID HERE");

Reports Methods

varreportRequest=newReport();reportRequest.StartDate=DateTime.Now.AddYears(-1);reportRequest.EndDate=DateTime.Now;reportRequest.ReportType="user_activity, document_status";varreportResponse=client.CreateReport(reportRequest);Console.WriteLine($"Status for Report ({reportResponse.ReportType}) between {reportResponse.StartDate} - {reportResponse.EndDate}: {reportResponse.Success}");

Team Methods

Get your Team details

varteam=client.GetTeam();

Create a new Team

varteam=client.CreateTeam("NAME HERE");

Update your Team name

varteam=client.UpdateTeamName("NAME HERE");

Delete your Team

varteam=client.DeleteTeam();

Add a member to your Team

varteam=client.AddMemberToTeam("ACCOUNT ID HERE");// Or...varteam=client.AddMemberToTeam(null,"EMAIL ADDRESS HERE");

Remove a member from your Team

varteam=client.RemoveMemberFromTeam("ACCOUNT ID HERE");// Or...varteam=client.RemoveMemberFromTeam(null,"EMAIL ADDRESS HERE");

App Methods

Get information about an API app

varapp=client.GetApiApp(client_id);Console.WriteLine("API APP: "+app.ClientId);Console.WriteLine("This app is approved: "+app.IsApproved);Console.WriteLine("This app has callback URL: "+app.CallbackUrl);

List all API apps

varapiApps=client.ListApiApps();Console.WriteLine("Found this many API apps: "+apiApps.NumResults);foreach(varresultinapiApps){Console.WriteLine("API app: "+result.Name+" ("+result.ClientId+")");}

Create a new API app

varcapp=newApiApp();capp.Name="App for Production";capp.Domain="yourwebsite.com";varcresponse=client.CreateApiApp(capp);Console.WriteLine("This API app was just created: "+cresponse.ClientId);Console.WriteLine("App name: "+cresponse.Name);

Delete an API app

client.DeleteApiApp("CLIENT_ID_HERE");Console.WriteLine("API app was just deleted!");

Build from Source

Windows

Use Visual Studio (Express) 2017 or newer.

Linux (and OSX?) using DotNet SDK + Mono

To create Debug builds for both the library (HelloSign.dll) and the test application (HelloSignTestApp.dll), run:

dotnet build

Or, to create Release builds:

dotnet build -c Release

Note: The .NET Framework build target will not be used when running this on a non-Windows system. Only .NET Standard 2.0 artifacts will be created.

Packaging for NuGet

  1. cd HelloSign
  2. nuget pack HelloSign.csproj -Prop Configuration=Release

License

The MIT License (MIT)
Copyright (C) 2015 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

A .NET SDK for the HelloSign API

Resources

Contributing

Stars

26 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages