I'm using PdfTransformFields for create envelope:
{
"emailBlurb": "Test Transform PDF Fields",
"emailSubject": "Test Transform PDF Fields",
"status": "sent",
"compositeTemplates": [{
"inlineTemplates": [{
"recipients": {
"signers": [{
"recipientId": "777",
"name": "LastName FirstName",
"email": "some email",
"tabs":{
"signHereTabs":[
{
"tabLabel":"employee_esignature\\*"
}
]
}
}]
}
}],
"document": {
"documentId": "1234567",
"name": "Test.pdf",
"transformPdfFields": "true"
}
}]
}
Although RecipientId="777" and DocumentId="1234567" were defined, but when I get the envelopeStatus by the call:
envelopesApi.listRecipients(accountId,env.getEnvelopeId(),
listRecipientsOptions);
I see, that
recipients->signers->tabs->signHereTabs contains
documentId="1", recipientId="1"
Why the documentId and recipientId are different from what I conveyed?
I think the documentId and recipientId are somewhat ephemeral -- you can reference them in other parts of your composite template using the values you set, but they may then be overwritten by the DocuSign platform when it finishes processing your request.
If you want to associate your own metadata with a recipient, use the customFields attribute in a signer object.
You can add your own metadata to document objects by using the documentFields attribute.
Related
Using the following POST request and body to send an envelope (source https://developers.docusign.com/docs/esign-rest-api/how-to/request-signature-template-remote)
https://demo.docusign.net/restapi/v2.1/accounts/4f4xxxx-xxxxxx-xxxxxx/envelopes
{
"templateId": "dbexxxx-xxxxx-xxxxx",
"templateRoles": [
{
"email": "test#gmail.com",
"name": "John Doe",
"roleName": "signer1",
"tabs": {
"textTabs": [
{
"tabLabel": "cname",
"value": "name"
}
]
}
}
],
"status": "sent"
}
Is there a way to specify the email message, email subject and/or email language? I tried adding "emailSubject": "Please sign ..." next to "email" but cannot seem to make it work. It is a requirement that I need to manually make this post request so I cannot use the SDK.
Where you placing the "emailSubject" field exactly in your JSON?
You can specify the the email message and subject by specifying the following fields at the root level (where you "status" is defined):
{
"emailBlurb": "げりト画首ロ百照ょリっ毎現イタヱア掲全らいに",
"emailSubject": "Subject of agreement",
"templateId": "867a37*****",
"templateRoles": [
{
"email": "email#domain.com",
"name": "name_of_person",
"roleName": "Seller"
}
],
"status": "sent"
}
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 a template and then getting the URL for the recipient view.
During my request DocuSign sends an email to the recipient and that is merged and ready to sign but the signing url goes to an unmerged version of the document that cannot be signed.
I dont really want the email sent, I just want to redirect the customer straight into the signing session.
What am I missing here?
ENVELOPE CREATION REQUEST:
{
"emailSubject": "Agreement",
"templateId": "xxx",
"templateRoles": [
{
"email": "johndoe#inter.net",
"name": "john doe",
"roleName": "Customer",
"tabs": {
"textTabs": [
{
"tabLabel": "Name",
"value": "john doe"
},
{
"tabLabel": "Date",
"value": "1/18/2019"
}
]
}
}
],
"status": "sent"
}
RESPONSE:
{
"envelopeId": "yyy",
"uri": "/envelopes/yyy",
"statusDateTime": "2019-01-18T19:45:04.2870000Z",
"status": "sent"
}
RECIPIENT VIEW REQUEST:
{
"userName": "john doe",
"email": "johndoe#inter.net",
"recipientId": "1",
"authenticationMethod": "email",
"returnUrl": "http://www.inter.net/docusign.asp?Status=complete"
}
RESPONSE:
{
"url": "https://demo.docusign.net/Signing/StartInSession.aspx?t=zzzz"
}
To indicate that you want to use an embedded signing ceremony for the template role, add the clientUserId attribute to the templateRole object.
Example of doing this: line 203 of the Number 17 example workflow (for PHP). This example workflow is also available for Node.js.
For a general example of using embedded signing, see example workflow 1 of the eg-03 series of example launchers--see the list of repositories at the bottom of the page.
I have created a template via the DocuSign UI; that template contains some tabs for various roles.
I want to send a document via DocuSign REST API, in which the template (only the tabs e.g. signHere, initiateHere, Title etc) will apply.
I haven't added any recipient on the template. What I want to use from that template are only the tabs.
My JSON
{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "c9e5adfa-d708-4467-a0ea-c615fa429a0f"
}],
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
"signers" : [{
"email": "nalam#relisource.com",
"name": "Noor",
"recipientId": "1",
"roleName": "Applicant"
}]
}
}],
"document": {
"documentId": 1,
"name": "test1.pdf",
"documentBase64":"Base64streamhere"
}
}]
}
It gives me the following error.
{
"errorCode": "INVALID_CONTENT_TYPE",
"message": "Content Type specified is not supported."
}
I am using POSTMAN. What is the problem here ?
Your documentBase64 attribute doesn't look right. Perhaps an error in copying it? Also, setting the fileExtension is highly recommended:
It should be
"document": {
...
"documentBase64": "Base64EncodedString",
"fileExtension": "pdf"
}
I suggest you use API request logging to see exactly what Postman is sending.
Template document substitution
If you're trying to substitute a document at runtime for the document in a server template, see the answers to this SO question for additional tips.
What you want here is the serverTemplate to be in sequence with the inlineTemplate so they need to have the same sequence number. Also you need another inline template to hold your document object. Something like this:
{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "c9e5adfa-d708-4467-a0ea-c615fa429a0f"
}],
"inlineTemplates": [
{
"sequence" : 1,
"recipients": {
"signers" : [{
"email": "nalam#relisource.com",
"name": "Noor",
"recipientId": "1",
"roleName": "Applicant"
}]
}
}],
"inlineTemplates": [
{
"sequence" : 2
"document": {
"documentId": 1,
"name": "test1.pdf",
"documentBase64":"Base64streamhere"
}
}
}]
}
I'm using the DocuSign REST API to create an envelope from a template. My code works with single document templates or templates with multiple documents where only one document has tabs. If there are tabs on both documents I receive a 400 response with error code TAB_REFERS_TO_MISSING_DOCUMENT.
The response I receive is:
{
"error": "invalid HTTP response",
"message": {
"errorCode": "TAB_REFERS_TO_MISSING_DOCUMENT",
"message": "The DocumentId specified in the tab element does not refer to a document in this envelope. Tab refers to DocumentId 45159457 which is not present."
},
"status": 400,
"url": "https://demo.docusign.net/restapi/v2/accounts/2826983/envelopes/"
}
My request is as follows:
{
"status": "sent",
"templateId": "bb283bfb-4049-431d-942a-9a485e4ebb41",
"emailSubject": "[[Signer UserName]], please sign this document",
"documents": [
{
"documentId": "27069418",
"documentBase64": "...",
"name": "name.pdf"
},
{
"documentId": "45159457",
"documentBase64": "...",
"name": "secondName.pdf"
}
]
}
From what I've seen people receive this request when they submit invalid documentId's like 1 but the document that's "missing" is clearly attached. Am I missing something?
The final and working JSON request looks like so:
{
"status": "sent",
"emailSubject": "...",
"compositeTemplates": [{
"serverTemplates": [{
"sequence": 2,
"templateId": "..."
}],
"inlineTemplates": [{
"sequence": 1,
"documents": [{
"documentId": "...",
"name": "...",
"documentBase64": "..."
}, {
"documentId": "...",
"name": "...",
"documentBase64": "..."
}]
}]
}]
}
You can overcome the error using composite Templates. Specifying the new documents in an inlineTemplate with lower sequence number("sequence": "1") will ensure the inlineTemplate documents will replace the server template documents.
Here is a sample CreateEnvelope request.
{
"emailSubject": "[[Signer UserName]], please sign this document",
"status": "sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"documents": [
{
"documentId": "27069418",
"name": "name.pdf",
"documentBase64": ""
},
{
"documentId": "45159457",
"name": "secondName.pdf",
"documentBase64": ""
}
]
}
],
"serverTemplates": [
{
"sequence": "2",
"templateId": "bb283bfb-4049-431d-942a-9a485e4ebb41"
}
]
}
]
}
To replace the document(s) in a template you must use composite templates instructions in your Envelopes: create call.
In your use case, you want to composite together the template and then a new document "in front" of the existing document in the template.
"Compositing templates" is like compositing together multiple pieces of film to produce a final print.