I have the template setup un the sandbox. Whenever I want to be redirected to demo.docusign.net and take action on the PDF, it is auto-populating the tabs. But my requirement is to simply generate the PDF without redirecting to docusign on click of a button. I am sending user information on click of a button to docusign and it has to generate the auto populated customer data on PDF for viewing (draft version). Currently it is generating the template without any dynamic user data, even though I pass the values. Please let me know, if there is any api to perform this.
Thanks in advance
I'm not completely sure I understand what you're trying to do. But sounds like you want:
1. Remote signing. Not Embedded Signing.
2. Populate values of tabs in templates.
You also didn't specify which coding lang you used, so I'm going to give you some C#. You can find the full code examples in all langs in the links above.
// Step 1: Obtain your OAuth token
var accessToken = RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN}
var accountId = RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}
// Step 2: Construct your API headers
var config = new Configuration(new ApiClient(basePath));
config.AddDefaultHeader("Authorization", "Bearer " + accessToken);
// Step 3: Create Tabs and CustomFields
// Set the values for the fields in the template
// List item
List colorPicker = new List
{
Value = "green",
DocumentId = "1",
PageNumber = "1",
TabLabel = "list"
};
// Checkboxes
Checkbox ckAuthorization = new Checkbox
{
TabLabel = "ckAuthorization",
Selected = "true"
};
Checkbox ckAgreement = new Checkbox
{
TabLabel = "ckAgreement",
Selected = "true"
};
RadioGroup radioGroup = new RadioGroup
{
GroupName = "radio1",
// You only need to provide the readio entry for the entry you're selecting
Radios = new List<Radio> { new Radio { Value = "white", Selected = "true" } }
};
Text includedOnTemplate = new Text
{
TabLabel = "text",
Value = "Jabberywocky!"
};
// We can also add a new tab (field) to the ones already in the template
Text addedField = new Text
{
DocumentId = "1",
PageNumber = "1",
XPosition = "280",
YPosition = "172",
Font = "helvetica",
FontSize = "size14",
TabLabel = "added text field",
Height = "23",
Width = "84",
Required = "false",
Bold = "true",
Value = signerName,
Locked = "false",
TabId = "name"
};
// Add the tabs model (including the SignHere tab) to the signer.
// The Tabs object wants arrays of the different field/tab types
// Tabs are set per recipient/signer
Tabs tabs = new Tabs
{
CheckboxTabs = new List<Checkbox> { ckAuthorization, ckAgreement },
RadioGroupTabs = new List<RadioGroup> { radioGroup },
TextTabs = new List<Text> { includedOnTemplate, addedField },
ListTabs = new List<List> { colorPicker }
};
// Create a signer recipient to sign the document, identified by name and email
// We're setting the parameters via the object creation
TemplateRole signer = new TemplateRole
{
Email = signerEmail,
Name = signerName,
RoleName = "signer",
Tabs = tabs //Set tab values
};
TemplateRole cc = new TemplateRole
{
Email = ccEmail,
Name = ccName,
RoleName = "cc"
};
// Create an envelope custom field to save our application's
// data about the envelope
TextCustomField customField = new TextCustomField
{
Name = "app metadata item",
Required = "false",
Show = "true", // Yes, include in the CoC
Value = "1234567"
};
CustomFields cf = new CustomFields
{
TextCustomFields = new List<TextCustomField> { customField }
};
// Step 4: Create the envelope definition
EnvelopeDefinition envelopeAttributes = new EnvelopeDefinition
{
// Uses the template ID received from example 08
TemplateId = RequestItemsService.TemplateId,
Status = "Sent",
// Add the TemplateRole objects to utilize a pre-defined
// document and signing/routing order on an envelope.
// Template role names need to match what is available on
// the correlated templateID or else an error will occur
TemplateRoles = new List<TemplateRole> { signer, cc },
CustomFields = cf
};
// Step 5: Call the eSignature REST API
EnvelopesApi envelopesApi = new EnvelopesApi(config);
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeAttributes);
Related
I create an envelope and I want to implement the Correct functionality same as the DocuSign portal from API.
On creation I setup the authentication type to a signer and working perfectly.
Signer signer = new Signer
{
Email = email,
Name = name,
RecipientId = recipientId
};
//On Create
RecipientSMSAuthentication smsAuth = new RecipientSMSAuthentication();
smsAuth.SenderProvidedNumbers = new List<string>();
foreach (var telephone in telephoneNumbers)
{
smsAuth.SenderProvidedNumbers.Add(telephone);
}
signer.IdCheckConfigurationName = "SMS Auth $";
signer.SmsAuthentication = smsAuth;
When I try to correct this signer and remove or change (etc phone) this authentication type is not working
//On Update
signer.IdCheckConfigurationName = "";
signer.SmsAuthentication = null;
I use the UpdateAsync api call
Recipients Recipients = new Recipients();
List<Signer> Signers = new List<Signer>();
Signers.Add(signer);
Recipients.Signers = Signers;
await envelopesApi.UpdateAsync(accountId, envelopeId, new Envelope() { Recipients = Recipients }, new EnvelopesApi.UpdateOptions() { resendEnvelope = "true" });
A couple of things.
First, you're using the old method for SMS verification in this code. A new method which is going to give you more flexibility was introduced recently. It looks like this:
RecipientIdentityVerification workflow = new RecipientIdentityVerification()
{
WorkflowId = workflowId,
InputOptions = new List<RecipientIdentityInputOption> {
new RecipientIdentityInputOption
{
Name = "phone_number_list",
ValueType = "PhoneNumberList",
PhoneNumberList = new List<RecipientIdentityPhoneNumber>
{
new RecipientIdentityPhoneNumber
{
Number = phoneNumber,
CountryCode = countryAreaCode,
}
}
}
}
};
Signer signer1 = new Signer()
{
Name = signerName,
Email = signerEmail,
RoutingOrder = "1",
Status = "Created",
DeliveryMethod = "Email",
RecipientId = "1", //represents your {RECIPIENT_ID},
Tabs = signer1Tabs,
IdentityVerification = workflow,
};
Note that your account may not have the new auth method enabled, you can either create a new developer account or contact support to enable it for you,.
Second, updating recipients of an existing envelopes has some limits. It can only be done if the envelope is in a "Draft" status ("created") and not after it was sent ("sent"). You may need to use the Correct action in that case.
I have problem with prefilling tabs from prefillTabs group while creating envelope using docusign api. It's impossible to assign values through templateRoles, since these tabs do not have any recipientId. Is it possible somehow to assign values to this kind of tabs?
Yes, you can do that, here is how to do that from the C# SDK:
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, env);
string envelopeId = results.EnvelopeId;
PrefillTabs prefill = new PrefillTabs();
prefill.TextTabs = new List<Text>();
prefill.TextTabs.Add(new Text { PageNumber = "1", DocumentId = "1", Value = "!!!test-inbar!!!" });
Tabs tabs = new Tabs();
tabs.PrefillTabs = prefill;
envelopesApi.CreateDocumentTabs(accountId, envelopeId, "1", tabs);
Or you can use raw JSON API call this way:
Endpoint:
/restapi/v2.1/accounts/[AccountId]/envelopes/[EnvelopeId]/documents/[DocumentId]/tabs
JSON body:
{"prefillTabs":{"textTabs":[{"value":"!!!test-inbar!!!","pageNumber":1,"documentId":"1","xPosition":316,"yPosition":97}]}}
I'm successfully sending envelopes via the DocuSign eSignature API and have a question about the emails that are sent as part of the signing process. When a request is sent I'm receiving the following emails (using the Sandbox environment):
email to each recipient from dse_demo#docusign.net with a reply to of my name/email address
email to me when each recipient clicks the link to view the agreement to sign (e.g. "John Smith viewed Acme Co Customer Agreement")
email to me (and each recipient) when agreement has been completed.
I'm trying to understand what options are available for each of these as far as:
enabling/disabling each of these emails
changing the email address used for each of these (and if this can be done via the API)
Appreciate any insights into whether and how I can make any changes to these.
The completion emails can be enabled/disabled in the settings for your DocuSign account. This can be found in: Settings > Signing Settings > Envelope Delivery. You can also enable/disable the "envelope viewed" notification emails and completion emails for both the sender and signer in: Settings > Email Preferences.
Which language are you integrating the API with? In C# you can change the email when adding the envelope recipient in the envelope definition e.g.
private static EnvelopeDefinition MakeEnvelope(string recipientEmail)
{
recipientEmail = "recipientEmail#email.com"
byte[] buffer = System.IO.File.ReadAllBytes("filePath");
Document doc1 = new Document();
string b64 = Convert.ToBase64String(buffer);
doc1.DocumentBase64 = b64;
doc1.Name = "Document Name";
doc1.FileExtension = "pdf";
doc1.DocumentId = "1";
env.Documents = new List<Document> { doc1 };
Text textTab = new Text
{
DocumentId = "1",
PageNumber = "1",
XPosition = "168",
YPosition = "513",
Height = "17",
Width = "369",
Value = "envelopeTabText",
Locked = "true"
};
SignHere signer1signhere = new SignHere
{
DocumentId = "1",
PageNumber = "1",
XPosition = "128",
YPosition = "775"
};
**Signer signer1 = new Signer
{
Email = recipientEmail,
Name = "customerName",
RecipientId = "1",
RoutingOrder = "1"
};**
Tabs signer1Tabs = new Tabs
{
TextTabs = new List<Text> { textTab },
SignHereTabs = new List<SignHere> { signer1signhere }
};
signer1.Tabs = signer1Tabs;
Recipients recipients = new Recipients
{
Signers = new List<Signer> { signer1 }
};
env.Recipients = recipients;
env.Status = "sent";
return env;
}
I am using Authorizatio Code Grant for authorization and wanted to send envelope as draft to other envelope recipient(editor). But in this case it is going to draft of whoever is logging and sending envelope request. I can send that envelope to other recipient's draft simply using "Transfer Owenership" from sender's draft but wanted to automate this while sending envelope request.
Here is the envelope request I am sending:
try
{
// create the envelope definition
EnvelopeDefinition env = new EnvelopeDefinition();
env.EmailSubject = $"Please Sign - { DateTime.Now.ToString() }";
//Get document extension
var fileContentByteArray = System.IO.File.ReadAllBytes("D:\\ESign1.docx");
Document documentToSign = new Document
{
DocumentBase64 = Convert.ToBase64String(fileContentByteArray),
Name = "ESign1.docx",
FileExtension = "docx",
DocumentId = "1"
};
env.Documents = new List<Document> { documentToSign };
var signatureHandler = new Editor
{
Email = "abc#test.com",
RecipientId = "1",
RoutingOrder = "1",
};
List<Signer> signers = new List<Signer>();
signers.Add(new Signer { Email = "xyz#test.com", Name = "xyz", RecipientId = "3", RoutingOrder = "3" });
signers.Add(new Signer { Email = "abc#test.com", Name = "abc", RecipientId = "2", RoutingOrder = "2" });
// Add the recipients to the envelope object
Recipients recipients = new Recipients
{
Editors = new List<Editor> { signatureHandler },
Signers = signers
};
//Attache all recipients to envelope
env.Recipients = recipients;
//Webhook to listen envelope status
EventNotification eventNotification = new EventNotification
{
IncludeDocuments = "true",
IncludeDocumentFields = "true",
IncludeTimeZone = "true",
Url = "https://webhook-endpoint",
LoggingEnabled = "true",
EnvelopeEvents = new List<EnvelopeEvent>
{
new EnvelopeEvent{ EnvelopeEventStatusCode = "completed", IncludeDocuments = "true" }
}
};
env.EventNotification = eventNotification;
env.Status = "created";
var config = new Configuration(baseUrl);
config.AddDefaultHeader("Authorization", "Bearer " + access_token);
var apiClient = new ApiClient(baseUrl)
{
Configuration = config
};
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
EnvelopeSummary result = envelopesApi.CreateEnvelopeAsync(account_id, env).Result;
}
catch (Exception ex)
{
}
What you need to do is set the envelope to 'sent' status instead of 'created'(env.Status="sent"). This will start the workflow and allow the recipient specified to edit the envelope as you're looking for. It's important to note that this will then continue along in the workflow after that recipient has finished their action on the envelope.
If you're looking for collaboration on an envelope and it's going to be going back and forth a bit before you actually want it signed, you might want to check out DocuSigns markup feature.
I have the DocuSign API working to pre-fill existing tabs on a template. I am trying to add some additional tabs dynamically for the templaterole signers, but the tabs are not showing up.
Here is my code that I am working with.
string SigningGroupID = "12345";
string RoleName = "Test Signing Group"';
string TemplateId = "XXX-XX-XXXX-XXX";
List<TemplateRole> templateRoles = new List<TemplateRole>();
DocuSign.eSign.Model.Tabs tabs = new DocuSign.eSign.Model.Tabs();
List<Text> TextTabs = new List<Text>();
Text text = new Text();
text.TabLabel = "test_label";
text.XPosition = "100";
text.YPosition = "150";
TextTabs.Add(text);
if (TextTabs.Count > 0) tabs.TextTabs = TextTabs;
TemplateRole doc_signer = new TemplateRole
{
SigningGroupId = SigningGroupID,
RoleName = RoleName,
RoutingOrder = "1",
Tabs = tabs
};
templateRoles.Add(doc_signer);
EnvelopeDefinition envelope = new EnvelopeDefinition();
envelope.EmailSubject = "This is a test";
envelope.Status = "created";
envelope.TemplateId = TemplateId;
envelope.TemplateRoles = templateRoles;
EnvelopesApi envelopeApi = new EnvelopesApi(_apiClient.Configuration);
EnvelopeSummary results = envelopeApi.CreateEnvelope(AccountID, envelope);
Console.WriteLine(results.ToJson());
Do I need some additional items populated on the new Text object (e.g. TabID)? I am not sure why this is not working.
Thanks
jlimited
Correct. You're missing a few properties for your Text object. When you define your Text tab, be sure to connect it to the appropriate recipient, document, and page by specifying the following:
text.documentId
text.pageNumber
text.recipientId
text.xPosition
text.yPosition
text.tabLabel
To determine the three missing values, you can make a request to GET /templates, which will return to you the IDs. SDK method is Templates:get
There are many more properties you can add, but you'll need these to get your tab to display properly.