I need to fill some fields in our fillabe .pdf, apply our Docusign template to it and do a bulk send for 2 roles, so here is my approach:
1- I create a draft envelope from the pre-filled .pdf and I use the template in creating the envelope:
POST
"https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes"
Body:
{
"status": "created",
"documents": [{
"documentId": "documentId_placeholder",
"name": "RaymondJames_prefilled.pdf",
"documentBase64": "lcDocumentBase64",
"transformPdfFields": "true"
}],
"templateId": "TemplateID_placeholder",
"templateRoles":
[
{
"roleName": "RecipientNo1RoleName_placeholder",
"isBulkRecipient": "true",
"name":"Name_placeholder",
"email":"Email_placeholder",
"emailSubject": "EmailSubject_placeholder",
"tabs":{
"textTabs":[
{
"tabLabel":"First Name",
"value": "FirstName_placeholder"
},
{
"tabLabel":"managertext",
"value": "ManagerText_placeholder"
}
]
}
},
]
}
2- Then I upload the bulk csv to the envelope bulk_recipients:
PUT "https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes/"+{envelopeId}+"/recipients/"+{recipientId}+"/bulk_recipients"
Body:
"Name,Email,Email Subject,managertext,Home Phone,First Name John
S.,test1#test1.com,Please revise the form and sign,Manager #1,888-111-1111,JS_firstname Mary S.,test2#test2.com,Please revise the form and sign,Manager #2,888-111-1111,MS_firstname"
3- Then I change the status of the envelope to "Sent" and send the envelope to the bulk recipients.
The above is working but as soon as change the csv filed name from Name to Role1::Name (the way that is mentioned in the documentations), it looks for filed "Name" and doesn't accept the roles at all.
so for adding roles I tried other endpoint but none could do what I need for having pre-filled pdf + docusign template and docusign fileds added + bulk_recipients.
I would appreciate your help on this.
Thanks,
Kathy
for step #2 you do not use a CSV but a JSON
here is an example JSON
{
"name": "sample.csv",
"bulkCopies": [{
"recipients": [{
"recipientId": "39542944",
"role": "signer",
"tabs": [],
"name": "Alice UserName",
"email": "alice.username#example.com"
},
{
"recipientId": "84754526",
"role": "cc",
"tabs": [],
"name": "Bob CarbonCopied",
"email": "bob.carboncopy#example.com"
}],
"customFields": []
},
{
"recipients": [{
"recipientId": "39542944",
"role": "signer",
"tabs": [],
"name": "Carol NextUser",
"email": "carol.nextuser#example.com"
},
{
"recipientId": "84754526",
"role": "cc",
"tabs": [],
"name": "Dave NextCarbon",
"email": "dave.nextcarbon#example.com"
}],
"customFields": []
}]
For a complete code example showing how to use Bulk Send go to:
https://developers.docusign.com/esign-rest-api/code-examples/bulk-sending-envelopes
Related
I need some help to identify how to send Document Custom Fields' values at the stage of creating an envelope. Below is the workflow:
Create the Document Custom Fields (account specific) with name, type and initial value through API (POST [BaseURI]/tab_definitions)
Create a template with document through API and place the required Document Custom Fields in the document through DocuSign UI
Create an envelope and send specific values for the Document Custom Fields through API (POST [BaseURI]/envelopes)
Creating an envelope is working fine referring (https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create). I have tried sending the values through:
document -> documentFields
customFields -> textCustomFields
{
"templateId": "51234567-1244-1234-1234-12345a857203",
"templateRoles": [
{
"roleName": "Role1",
"name": "Jane Doe",
"email": "jane#doe.com"
},
{
"roleName": "Role2",
"name": "John Doe",
"email": "john#doe.com"
}
],
"customFields": {
"textCustomFields": [
{
"name": "Account.Name",
"value": "account-name1234"
},
{
"name": "Candidate.FullName",
"value": "candidate-name1234"
},
{
"name": "Candidate.Mobile",
"value": "0412345678"
}
]
},
"status": "sent"
}
The CustomFields parameter is for Envelope Custom Fields. If you want to define tag values for a recipient, the tag parameters should be nested under the TemplateRole. You'll also want to use the tabLabel parameter to identify tabs instead of the name. Finally, make sure your Role Names and TabLabels match exactly between your template and your API call. Try this:
{
"templateId": "51234567-1244-1234-1234-12345a857203",
"templateRoles": [
{
"roleName": "Role1",
"name": "Jane Doe",
"email": "jane#doe.com"
"tabs": {
"TextTabs": [
{
"tabLabel": "Account.Number",
"value": "00000000"
},
{
"tabLabel": "Account.Name",
"value":"ExampleAccount"
}
],
},
{
"roleName": "Role2",
"name": "John Doe",
"email": "john#doe.com"
}
],
"status": "sent"
}
Finally, you may want to consider using a Composite Template instead of the basic Envelope Creation call. Details as to why are available here: https://www.docusign.com/blog/dsdev-why-use-composite-templates/
I am creating an envelope from template using the REST api. Recipient 2 on the template is signer type "signer". Is it possible to adjust this in the template roles portion of the JSON body so recipient 2 becomes an in-person signer?
You cannot do at the time of creating an envelope, but you can update envelope the envelope with below API call:
PUT /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients
For instance, create an envelope in created (draft) status,
POST /v2/accounts/{accountId}/envelopes
{
"compositeTemplates": [{
"inlineTemplates": [{
"recipients": {
"signers": [{
"email": "signer1#1mail.com",
"name": "Signer1 Name",
"recipientId": "1",
"roleName": "Signer1"
},
{
"recipientId": "2",
"email": "hostEmail#email.com",
"name": "Host Name",
"roleName": "Signer2"
}]
},
"sequence": "1"
}],
"serverTemplates": [{
"sequence": "1",
"templateId": "267c3673-3381-4b3d-9040-706b341c721g"
}]
}],
"status": "created"
}
then call EnvelopeRecipients: update to update the recipientId2 to Inperson Signer.
PUT /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients
{
"inPersonSigners": [{
"roleName": "Signer2",
"routingOrder": 1,
"hostEmail": "hostemail#email.com",
"hostName": "Host Name",
"recipientId": "2",
"signerName": "Signer Name"
}]
}
I'm confused about the difference between "tabs" and "custom fields," perhaps --
When I send a json to DocuSign API's baseURL/envelopes, asking the API to send an envelope with a template, it works fine:
{ "accountId": "xxx",
"status": "sent",
"emailSubject": "Please sign this document",
"emailBlurb": "Here's a document for you to sign",
"templateId": "xxxx",
"templateRoles": [
{
"email": "test#email.com",
"name": "Test Person",
"roleName": "parent_signer" }] }
When I try to add parameters for custom field filling, I get a 400 error:
{ "accountId": "xxx",
"status": "sent",
"emailSubject": "Please sign this document",
"emailBlurb": "Here's a document for you to sign",
"templateId": "xxxx",
"templateRoles": [
{
"email": "test#email.com",
"name": "Test Person",
"tabs": [
{ "textTabs":
[
{"tabLabel": "Doc_Name",
"name": "Doc_Name",
"value": "Doc Name Data Would Go Here"}
]
}
],
"roleName": "parent_signer" }] }
And the single document in my template in question has custom fields with those names.
https://imgur.com/z519zm3
You need to specify the document and page in which the tab needs to be displayed.
In JSON, it would look like below :
"textTabs": [
{
"tabLabel": "Doc_Name",
"name": "Doc_Name",
"value": "Doc Name Data Would Go Here",
"DocumentId": "123",
"PageNumber": "1"
}
"tabs" is not an array. There is a docusign exmaple here:
https://developers.docusign.com/esign-rest-api/guides/features/templates
You're code should look like this:
...
"templateRoles": [ // is an array
{
"email": "test#email.com",
"name": "Test Person",
"tabs": { // is not an array (an object)
"textTabs": [ // is an array (of objects)
{
"tabLabel": "Doc_Name", // should match Template "Data Label"
"name": "Doc_Name", // this field is unnecessary
"value": "Doc Name Data Would Go Here"
}
] // , other arrays of tabs like checkboxTabs may go here as well
}
"roleName": "parent_signer" }] }
I have an embedded signing application where users going through a web interview have to sign certain documents at the end. The documents are generic templates, currently defined with the user name and email address left blank. I am providing the user name, email address and a clientUserId in the envelope creation, matching the role that is defined in the template. But I keep getting the error UNKNOWN_ENVELOPE_RECIPIENT - The recipient you have identified is not a valid recipient of the specified envelope. What constitutes a "valid recipient" of a generic template? Am I supposed put something in the user and email fields of the template? I'm confused.
In answer to Larry K below, that appears to be exactly what I have done. Here's the JSON for the create envelope request that results in the error:
{
"accountId":"1234567",
"emailSubject":"Certification Documents",
"status":"sent",
"compositeTemplates":[
{
"serverTemplates":[
{
"sequence":"1",
"templateId":"5ed3d600-5a57-4fee-931f-53233858dc65"
}
],
"inlineTemplates":[
{
"sequence":"1",
"recipients":{
"signers":[
{
"name":"John Doe",
"roleName":"Applicant",
"recipientId":"1",
"clientUserId":"62",
"email":"jd#mydomain.com",
"tabs":{
"textTabs":[
{
"tabLabel":"EmplName",
"value":"John Doe"
},{
"tabLabel":"SSN",
"value":"123456789"
},{
"tabLabel":"DoB",
"value":"08\/26\/1991"
}
]
}
}
]
}
}
]
}
]
}
Here is the Get Recipients response:
{
"signers": [
{
"isBulkRecipient": "false",
"name": "",
"email": "",
"recipientId": "63543029",
"recipientIdGuid": "29a731f6-2f82-490f-9589-f551727414d9",
"requireIdLookup": "false",
"smsAuthentication": {},
"routingOrder": "1",
"note": "",
"roleName": "Applicant",
"status": "created",
"declinedReason": "",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [
{
"name": "Real Person",
"email": "rp#mydomain.com",
"recipientId": "83856197",
"recipientIdGuid":
"0f80a5ab-2050-472a-b072-7a18794a4726",
"requireIdLookup": "false",
"smsAuthentication": {},
"routingOrder": "1",
"note": "",
"roleName": "Mancon",
"status": "created",
"declinedReason": ""
}
],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2"
}
I've got it. Too many iterations of messing with code, mixing live code with debug stuff. It looked like the error was coming from the envelope creation because I had stepped on a debug message. But in fact the code was going through to the signing view request, which actually was generating the error. And there, as you might guess, was a debug clientUserId, which did not match the envelope. I hate it! Thanks for the coaching. It eventually led me to the real problem.
To troubleshoot, I'd suggest executing a Get Template Recipients request for the Template you're using (GET /v2/accounts/{accountId}/templates/{templateId}/recipients), then compare the contents of that response with the recipients portion of your Create Envelope From Template request that's resulting in the error UNKNOWN_ENVELOPE_RECIPIENT. If you can't spot a difference, feel free to update your post (question above) with the trace of your original Create Envelope request as well as the response from Get Template Recipients (removing any sensitive info, of course), and perhaps someone here can spot the issue.
Another answer from a second DocuSign consultant:
He suggests that perhaps the reason you received the error was that you didn't use the exact same triplet of {recipient/signer name, email, client id} in both your call to Envelopes: create and to EnvelopeViews: createRecipient
The following should work:
Call to Envelopes: create:
{
"emailSubject":"My subject",
"emailBlurb":"My blurb",
"templateId":"My template id",
"templateRoles":[
{
"clientUserId":"123456789",
"roleName":"My role",
"name":"Name",
"email":"email"
}
],
"status":"sent"
}
Call to EnvelopeViews: createRecipient:
{
"authenticationMethod": "password",
"email": "email",
"returnUrl": "https://www.docusign.com",
"userName": "Name",
"clientUserId": "123456789"
}
A solution from one of our DocuSign consultants is below. He recommends compositing the recipient information with the template. Here's the json for the Envelopes: create call:
{
"emailSubject": "Create Envelope with embedded recipient",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "{Template ID}"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"clientUserId": "Unique Identifier",
"email": "signer1#example.com",
"name": "Signer One",
"recipientId": "1",
"roleName": "Customer"
}
]
}
}
]
}
]}
I am facing issue while trying to enable "ID Check $" through docusign Rest API.
I could see there were lot of work arounds provided. Still following I am not successful.
It would be great if someone can comment if the issue with KBA is still there or any sample code for REST JSON would be greatly appreciated.
Due to this I am thinking of TWO templates one with KBA enabled and other without. So I can take a decision to use the template based on my business rule
Appreciate your time
The following way of creating the envelope did not result in KBA to the signer
{
"accountId": "YYY",
"templateId":"ZZZ",
"status": "SENT",
"templateRoles": [
{
"name": "AAA",
"roleName": "CCC",
"email": "test#test.com",
"tabs": {
"textTabs": [],
"checkBoxTabs": [],
"emailTabs": [],
"dateTabs": [],
}
},
{
"name": "BBB",
"roleName": "DDD",
"email": "example#example.com",
"accessCode": "A380",
"requireIdLookup": "true",
"idCheckConfigurationName": "ID Check $",
"tabs": {
"textTabs": [],
"checkBoxTabs": [],
"emailTabs": [],
"dateTabs": []
}
}
]
}
If you're creating an Envelope using a DocuSign Template, and want to sometimes require ID Check authentication and other times not, the way you can accomplish this is to use Composite Templates in your Create Envelope API call.
In your template (i.e., via the DocuSign UI), don't select any form of advanced recipient authentication (i.e., simply set Identify = "Email").
Then, to create an envelope using the template via the API, and specify ID Check as the recipient authentication method, the Create Envelope request would look like this:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"emailSubject": "Please sign",
"emailBlurb": "Please sign...thanks!",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": 1,
"templateId": "YOUR_TEMPLATE_ID"
}
],
"inlineTemplates": [
{
"sequence": 2,
"recipients": {
"signers": [
{
"email": "sallysemail#test.com",
"name": "Sally Adamson",
"recipientId": "1",
"roleName": "Signer1",
"requireIdLookup": "true",
"idCheckConfigurationName": "ID Check $"
}
]
}
}
]
}
]
}
The request for creating an envelope (using the same template) that does NOT require any advanced form of recipient authentication would look identical to the request above -- except that it would NOT include the requireIdLookup property or the idCheckConfigurationName property.