Related
I have my Json working for single document and transforms the PDF fields, but when I try to add second document. I Get JSON Parse error.
This works
"document": {
"documentId": "1",
"name": "Test Contract With Fields.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}
this also works but doesn't transforms the PDFFields.
"inlineTemplates": [
{
"documents": [
{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"name": "test",
"transformPdfFields": "true"
},
{
"documentBase64": "<Base64BytesHere>",
"documentId": "2",
"name": "test 2",
"order": "2"
}
],
Adding Square [] and second document breaks. Tried making Documents
"document": [{
"documentId": "1",
"name": "Test Contract With Fields.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
},
{
"documentId": "2",
"name": "Test Contract With Fields 2.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}]
**Update: Complete JSON
Looking to add a second **document****
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1","documents": [
{
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working", "order": "2"
}
],
"recipients": {
"signers": [
{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"tabLabel": "text 1",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "20",
"height": "10",
"width": "20",
"tabLabel": "Text 2",
"recipientId": "1"
}
],
"dateSignedTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "30",
"height": "10",
"width": "20",
"tabLabel": "text 3",
"recipientId": "1"
}
]
}
}
]
}
}
],
"document": {
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
} }
]
There are 3 "models" for constructing envelopes. I recommend using composite templates in the intended way, where you manage each document contribution to the envelope by enclosing within separate compositeTemplate elements. I reworked your JSON like this:
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [{
"compositeTemplateId": "1",
"document": {
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
},
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true"
}]
}
}]
},
{
"compositeTemplateId": "2",
"document": {
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working",
"transformPdfFields": "true"
},
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true"
}]
}
}]
}
]
}
In this fashion, any number of additional documents you wish to add would simply be another compositeTemplate element added to the array. This works for additional documents regardless of whether you wish to transform PDF fields, documents sourced from DocuSign templates, or any additional document for which you want to apply a template to overlay.
Note that the use of compositeTemplateId is only needed to relate multipart form attachments, which is a cleaner way to handle your documents rather than base64 encoding them in documentBase64 elements.
Here is the fixed JSON:
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1","documents": [
{
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working", "order": "2"
}
],
"recipients": {
"signers": [
{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"tabLabel": "text 1",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "20",
"height": "10",
"width": "20",
"tabLabel": "Text 2",
"recipientId": "1"
}
],
"dateSignedTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "30",
"height": "10",
"width": "20",
"tabLabel": "text 3",
"recipientId": "1"
}
]
}
}
]
}
},
{
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}
]}
]
}
My goal is to make SignHereTab location and size the same as one of my Pdf Form Field. Docusign guide
tells me that I can transform Pdf Form fields into DocuSign tabs. And according to the guide I shoud use CompositeTempates.
I have two recipients and two Pdfs. One pdf should be signed by both recipients, the second pdf should be signed by the first. Here is JSON example of envelop. I'm usign CreateEnvelop method from Docusign.eSign.dll (https://www.nuget.org/packages/DocuSign.eSign.dll/)
{
"compositeTemplates": [
{
"document": {
"documentBase64": "base64 data",
"documentId": "1",
"name": "MainPart.pdf",
"transformPdfFields": "True"
},
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"accessCode": "1239",
"email": "insured#gmail.com",
"name": "Insured ",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"recipientId": "1",
"tabLabel": "insured_sign_parta\\*"
}
]
}
},
{
"accessCode": "1212",
"email": "owner#gmail.com",
"name": "Owner",
"recipientId": "2",
"routingOrder": "2",
"tabs": {
"signHereTabs": [
{
"recipientId": "2",
"tabLabel": "owner_sign_parta\\*"
}
]
}
}
]
},
"sequence": "1"
}
]
},
{
"document": {
"documentBase64": "base64 data",
"documentId": "2",
"name": "AdditionalPart.pdf",
"transformPdfFields": "True"
},
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"accessCode": "1239",
"email": "insured#gmail.com",
"name": "Insured",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"recipientId": "1",
"tabLabel": "insured_sign_parta\\*"
}
]
}
}
]
},
"sequence": "2"
}
]
}
],
"emailBlurb": "Email Text",
"emailSubject": "Subject",
"status": "sent"
}
When I open documents SignHereTabs doesn't appear :(
Could anybody help me, please? What am I doing wrong?
I have seen tutorials from Docusign website and all related issues on StackOverflow, but still it didn't help. I've been investigating this issue for almost two days and I got nothing...
tabs should have a documentId as well as a recipientId so that they can refer to both the recipient that needs to sign them and the specific document that they should be in.
see here for full reference - https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeDocumentTabs
I am trying to work with visibility settings in a workflow using the docusign api. The workflow consists of two inline templates and I want to restrict it so a signer cannot see 1 document in the second inline template. Here is the json being sent to DocuSign:
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": ,
"name": ,
"recipientId": "2",
"roleName": "High School Faculty"
},
{
"email": ,
"name": ,
"recipientId": "3",
"roleName": "High School Administration"
},
{
"email": ,
"name": ,
"recipientId": "4",
"roleName": "Department Dean"
},
{
"documentVisibility": [
{
"documentId": "2",
"recipientId": "5",
"visible": "false"
}
],
"email": ,
"name": ,
"recipientId": "5",
"roleName": "Department Faculty"
}
]
},
"sequence": "1"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "900cc73b-f35c-45b1-92d1-e8453094aa60"
}
]
},
{
"inlineTemplates": [
{
"documents": [
{
"documentBase64": <data>,
"documentId": "1",
"fileExtension": "docx",
"name": "Packet"
},
{
"documentBase64": <data>,
"documentId": "2",
"fileExtension": "docx",
"name": "Packet"
}
],
"recipients": {
"signers": [
{
"email": ,
"name": ,
"recipientId": "2",
"roleName": "High School Faculty"
},
{
"email": ,
"name": ,
"recipientId": "3",
"roleName": "High School Administration"
},
{
"email": ,
"name": ,
"recipientId": "4",
"roleName": "Department Dean"
},
{
"documentVisibility": [
{
"documentId": "2",
"recipientId": "5",
"visible": "false"
}
],
"email": ,
"name": ,
"recipientId": "5",
"roleName": "Department Faculty"
}
]
},
"sequence": "2"
}
]
}
],
"emailSubject": "College Now Master Form",
"enforceSignerVisibility": "true"
}
When I go through testing the workflow the Department Faculty is still able to view the 2nd Document in the second inline template. I am testing so I am using the same signin for each role, could this be the issue? Can anyone point to what I am doing wrong? We do have visibility turned on for our instance. Thanks!
As per the EnvelopeRecipients docs, you'll want to use the ExcludedDocuments parameter to define it as a part of the Recipient object:
"recipients": {
"signers": [
{
"email": "user#example.com",
"name": "Example Signer",
"recipientId": "2",
"routingOrder":1,
"excludedDocuments":[2],
"tabs": {
"signHereTabs": [
{
"documentId": "1",
"recipientId": "1",
"xPosition": "150",
"yPosition": "150",
"pageNumber":1
}
]
}
}]
}
You'll also want to confirm how your account has Document Visibility configured, as it can be set to exclude the sender alone, or members of the sender's account. If it's set to "unless member of signer's account", testing may be thrown off.
I am creating envelope using DocuSign API. While creating envelope I am also passing list of signers and also set my own unique "RecipientId" (GUID) for each signers. But when envelope gets created and checking the list of recipients(signers) and found that recipient id gets changed all time. It is not "RecipientId" which I am passing.
Can you help me how can we set own "RecipientId" while creating envelope?
-- Create envelope request
{ "documents": [{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"fileExtension": "pdf",
"name": "lite"
}],
"emailSubject": "test recipient 2",
"recipients": { "signers": [ { "email": "xxx.yyy#xxx.com",
"name": "xxx yyy",
"recipientId": "1"
} ]
},
"status": "sent"
}
-- Web hook Response see recipient Id --
<DocuSignEnvelopeInformation><EnvelopeStatus>
<RecipientStatuses>
<RecipientStatus>
<Type>Signer</Type>
<Email>xxx.yyy#abc.com</Email>
<UserName>xxx yyy</UserName>
<RoutingOrder>1</RoutingOrder>
<Sent>2017-08-29T02:13:33.853</Sent>
<DeclineReason xsi:nil="true"/>
<Status>Sent</Status>
<RecipientIPAddress/>
<CustomFields/>
<AccountStatus>Active</AccountStatus>
<RecipientId>011eac75-f2fa-4f57-94df-5aedaxxxxxxx</RecipientId>
</RecipientStatus>
</RecipientStatuses>
....
<DocuSignEnvelopeInformation><EnvelopeStatus>
Another way around this is to use recipient.customFields. It's an array of strings:
someEnvelopeSigner.customFields = [yourUUID, somethingElse]
In the webhook / event notification, it will come through in DocuSignEnvelopeInformation.EnvelopeStatus[0].RecipientStatuses[0].RecipientStatus[i].CustomFields and look something like (in JSONified form)
{
"CustomFields": [{
"CustomField": [
"6e45cb20-3953-11ea-b02d-dedef9da77b9",
"something else!"
]
}],
}
You can specify a unique recipientId for each recipient while creating an envelope.
Here is a sample CreateEnvelope request
POST /v2/accounts/{accountId}/envelopes
Json Payload.
{
"emailSubject": "Please sign the agreement",
"status": "sent",
"recipients": {
"signers": [
{
"email": "janedoe#acme.com",
"name": "jane doe",
"recipientId": 1,
"routingOrder": 1,
"tabs": {
"signHereTabs": [
{
"documentId": "1", "pageNumber": "1", "xPosition": "80", "yPosition": "80"
}
]
}
},
{
"email": "johnsmith#acme.com",
"name": "john smith",
"recipientId": 2,
"routingOrder": 2,
"tabs": {
"signHereTabs": [
{
"documentId": "1", "pageNumber": "1", "xPosition": "80", "yPosition": "180"
}
]
}
}
]
},
"documents": [
{
"documentId": "1",
"name": "Contract",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
]
}
Use the listEnvelopeRecipients api to retrieve the list of recipients in the envelope.
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "jane doe",
"email": "janedoe#acme.com",
"recipientId": "1",
"recipientIdGuid": "98d60cc3-5f67-46e4-9fc0-ca6bb519f1c9",
"requireIdLookup": "false",
"userId": "585b8733-b1a9-4329-87e7-4f20bcde00c2",
"routingOrder": "1",
"status": "sent"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "john smith",
"email": "johnsmith#acme.com",
"recipientId": "2",
"recipientIdGuid": "726bd54d-89ed-41ba-a751-fdb129894b8b",
"requireIdLookup": "false",
"userId": "45abe022-ae12-4816-8c42-fd66d207807a",
"routingOrder": "2",
"status": "created"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
}
I am trying to use the same server template for 3 different documents. I was assuming that by using 3 different composite templates, I could accomplish this. Instead, what I am seeing is that the first document is repeated 3 times in the envelope. Here is the request:
{
"customFields": {
"textCustomFields": [
{
"name": "Cartus file id",
"value": "1823456"
}
]
},
"eventNotification": {
"url": "http://requestb.in/p2qfvfp2",
"loggingEnabled": "true",
"requireAcknowledgment": "true",
"envelopeEvents": [
{
"envelopeEventStatusCode": "Delivered"
},
{
"envelopeEventStatusCode": "Completed"
},
{
"envelopeEventStatusCode": "Declined"
},
{
"envelopeEventStatusCode": "Voided"
},
{
"envelopeEventStatusCode": "Sent"
}
],
"useSoapInterface": "false",
"includeCertificateWithSoap": "false",
"signMessageWithX509Cert": "false",
"includeDocuments": "false",
"includeEnvelopeVoidReason": "false",
"includeTimeZone": "true",
"includeSenderAccountAsCustomField": "true",
"includeDocumentFields": "true",
"includeCertificateOfCompletion": "false"
},
"compositeTemplates": [
{
"compositeTemplateId": "1",
"serverTemplates": [
{
"sequence": "1",
"templateId": "4e2f0e2d-9888-xxxx-8da3-bbf70163233f"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Kathy Gilbert",
"email": "KathyGilbert11#xxx.com",
"recipientId": "1",
"customFields": [
"this is the buyer"
],
"routingOrder": "1",
"roleName": "##Buyer1"
},
{
"name": "Kathy Langdon",
"email": "KathyLangdon1#xxx.com",
"recipientId": "2",
"customFields": [
"this is the seller"
],
"routingOrder": "2",
"roleName": "##Seller1"
}
],
"certifiedDeliveries": [
{
"name": "Kathy Lori",
"email": "kathylori#xxx.com",
"recipientId": "3",
"accessCode": "12345",
"routingOrder": "3",
"roleName": "##OtherPerson"
}
]
}
}
],
"document": {
"documentId": "1",
"name": "Here is document one of the test.docx",
"fileExtension": "docx",
"documentFields": [
{
"name": "Doc1Info",
"value": "here is doc1 info"
}
]
}
},
{
"compositeTemplateId": "2",
"serverTemplates": [
{
"sequence": "1",
"templateId": "4e2f0e2d-9888-xxxx-8da3-bbf70163233f"
}
],
"inlineTemplates": [
{
"sequence": "3",
"recipients": {
"signers": [
{
"name": "Kathy Gilbert",
"email": "KathyGilbert11#xxx.com",
"recipientId": "1",
"customFields": [
"this is the buyer"
],
"routingOrder": "1",
"roleName": "##Buyer1"
}
],
"certifiedDeliveries": [
{
"name": "Kathy Lori",
"email": "kathylori#xxx.com",
"recipientId": "3",
"accessCode": "12345",
"routingOrder": "3",
"roleName": "##OtherPerson"
}
]
}
}
],
"document": {
"documentId": "2",
"name": "Here is document two of the test",
"fileExtension": "docx",
"documentFields": [
{
"name": "Doc2Info",
"value": "here is doc2 info"
}
]
}
},
{
"compositeTemplateId": "3",
"serverTemplates": [
{
"sequence": "1",
"templateId": "4e2f0e2d-9888-xxxx-8da3-bbf70163233f"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Kathy Gilbert",
"email": "KathyGilbert11#xxx.com",
"recipientId": "1",
"customFields": [
"this is the buyer"
],
"routingOrder": "1",
"roleName": "##Buyer1"
},
{
"name": "Kathy Langdon",
"email": "KathyLangdon1#xxx.com",
"recipientId": "2",
"customFields": [
"this is the seller"
],
"routingOrder": "2",
"roleName": "##Seller1"
}
],
"certifiedDeliveries": [
{
"name": "Kathy Lori",
"email": "kathylori#xxx.com",
"recipientId": "3",
"accessCode": "12345",
"routingOrder": "3",
"roleName": "##OtherPerson"
}
]
}
}
],
"document": {
"documentId": "3",
"name": "Here is document three of the test",
"fileExtension": "docx",
"documentFields": [
{
"name": "Doc3Info",
"value": "here is doc3 info"
}
]
}
}
],
"status": "sent",
"emailSubject": "Please sign the following document at 9:26 AM"
}
Like I said, document1.docx was repeated 3 times in the envelope ( these documents are only 1 page each ).
You are not specifying the Document bytes in your Composite Template.
Since the Document bytes are not included in your Composite template, the Server templates documents will be used to create the envelope. That's the reason you are seeing the same doc from the server template being repeated three times.
Change your document property in each composite template as below. I have added the documentBase64 property.
"document": {
"documentId": "1",
"name": "Here is document one of the test.docx",
"fileExtension": "docx",
"documentFields": [
{
"name": "Doc1Info",
"value": "here is doc1 info"
}
],
"documentBase64" : "[Include the base64 of the .docx file here]"
}