Custom message body for each recipient in docusign - docusignapi

I am using a demo account of Docusign integrating with force.com sites using Apex.
I created a template and want to send two different mail body to two different recipient. I have two roles Agent and Broker.
In Broker mail body I want to use Agent Recipient Name. I can get the name in subject by using [[Agent_UserName]] but not in body. Is there any way to use Merge fields in Mail body.

Merge fields are not supported in the email Body.
Here is a sample CreateEnvelope request to send unique Email Subject/Body per recipient. You will have to add the emailNotification property for each recipient
{
"status": "created",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"name": "recipient one",
"email": "recipientone#acme.com",
"routingOrder": "1",
"recipientId" : "1",
"roleName" : "texter",
"tabs": {
"textTabs" : [
{
"xPosition" : "100", "yPosition" : "100", "documentId" : "1","pageNumber" : "1"
}
]
},
"emailNotification": {
"emailSubject": "subject for one",
"emailBody": "Body for One",
"supportedLanguage": "en"
}
},
{
"name": "Jane Doe",
"email": "janedoe#acme.com",
"routingOrder": "2",
"recipientId" : "2",
"roleName" : "signer",
"tabs": {
"signHereTabs" : [
{
"xPosition" : "100", "yPosition" : "200", "documentId" : "1", "pageNumber" : "1"
}
]
},
"emailNotification": {
"emailSubject": "subject for two",
"emailBody": "Body for two",
"supportedLanguage": "en"
}
}
]
},
"documents": [
{
"documentId": "1",
"name": "Contract",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
]
}
]
}
]
}

Related

Docusign: How does one send SMS and email signature requests for the same recipient?

How do I create a recipient with both email and SMS?
I've been unable to find example JSON that addresses this issue. The documentation on Docusign's website shows either email or SMS, not both together (that I can find, anyway). I found a note somewhere that suggested it's possible, but I can't find it again.
If your account has SMS Delivery enabled, you can make an API Request in the following format to send an envelope with Email + SMS Delivery
{
"documents": [
{
"documentBase64": "Base 64 here",
"documentId": 1,
"fileExtension": "txt",
"name": "Filename"
}
],
"emailSubject": "Blurb",
"recipients": {
"signers": [
{
"email": "Recipient Email Here",
"name": "DocuSigner",
"recipientId": "1",
"tabs": {
"signHereTabs": [
{
"xPosition": "10",
"yPosition": "10"
}
]
},
"additionalNotifications": [
{
"secondaryDeliveryMethod": "SMS",
"phoneNumber": {
"countryCode": "Code",
"number": "Phone number"
}
}
]
}
]
},
"status": "sent"
}

Docusign - Transform PDF text field to initialHereTab

Is it possible to transform PDF text field (not signature field) to initialHereTab ?
Note : it works well with signature field but not with text filed
Here is my JSON request:
{
"compositeTemplates": [
{
"compositeTemplateId": "1",
"document": {
"documentBase64": "PDFDocumentInBase64",
"documentId": "1",
"fileExtension": "pdf",
"name": "Merge_2020310203633868.pdf",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "myEmail#email.ca",
"name": "Paul J Smith",
"recipientId": "1",
"tabs": {
"initialHereTabs": [
{
"tabLabel": "\\applicant1\\*"
}
]
}
}
]
},
"sequence": "1"
}
]
}
],
"emailSubject": "Please sign this legal form at your convenience",
"status": "created"
}
Yes, per the documentation:
If: Adobe name contains DocuSignInitialHere or eSignInitialHere
Then: a DocuSign Initials tab will be created

Docusign API - Create envelope, apply template, prefill values

Many questions address portions of my request, but I cannot seem to make a complete solution work. I have created a template on my site (it has various text fields, initial fields, and signature block). Single recipient, using anchor tags for the fields. When I take a .docx file, create an envelope via the api, I want to apply the template previously mentioned, and then prefill 4 text fields on the document/template.
Anchor tags are not placing the fields appropriately.
Any advise/suggestions?
Working request call is:
{
"documents":
[
{
"documentBase64":"<BASE64STREAM>",
"documentId":"3",
"fileExtension":"docx",
"name":"10001000_20170803_FILE"
}
],
"emailSubject": "TEST - Group Audit - 10001000",
"templateId": "TEMPLATE_ID",
"templateRoles" :
[
{
"email": "JDOE#email.com",
"name": "JOHN DOE",
"roleName": "signer1",
"tabs":
{
"textTabs":
[
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "groupname",
"value": "TEST GROUP ONE"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "groupnumber",
"value": "10001000"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "txt",
"value": "my#email.com"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "fein",
"value": "870142380"
},
{
"documentId": "3",
"recipientId": "1",
"tabLabel": "physicaladdress",
"value": "1 STREET WAY, , MY CITY, CA, 98001"
}
]
}
}
],
"status":"sent"
}
Based on the information you've provided, I understand your scenario to be as follows:
You've created a template via the DocuSign UI; that template contains a 'placeholder' document (which you will replace at run-time via your Create/Send Envlope API call) and defines the recipient(s) and tabs for that document.
When you create/send the envelope via API, you want to specify the document as part of the API request (i.e., to be used instead of the 'placeholder' document that the DocuSign template contains) and also auto-populate some of the tabs that the template defines.
If that's an accurate description of what you're trying to achieve, then you need to use Composite Templates in the API request structure. Here's an example of a Create/Send Envelope JSON request that uses composite templates (and contains data based upon the information you provided in your question):
{
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "TEMPLATE_ID"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "JOHN DOE",
"email": "JDOE#email.com",
"roleName": "signer1",
"tabs":
{
"textTabs":[
{
"tabLabel" : "groupname",
"value" : "TEST GROUP ONE"
},
{
"tabLabel" : "groupnumber",
"value" : "10001000"
},
{
"tabLabel" : "txt",
"value" : "my#email.com"
},
{
"tabLabel" : "fein",
"value" : "870142380"
},
{
"tabLabel" : "physicaladdress",
"value" : "1 STREET WAY, , MY CITY, CA, 98001"
}
]
}
}
]
}
}
],
"document": {
"documentId": "3",
"name": "10001000_20170803_FILE.docx",
"fileExtension": "docx",
"documentBase64": "BASE64STREAM"
}
}
],
"status": "sent",
"emailSubject": "TEST - Group Audit - 10001000"
}

How to Set Email Subject Line and Email Message from JSON in Docusign

Could anyone explain to me that how to set email subject line and email message using JSON in Docusign.
Note:(JSON string has to be passed as HTTP request).
Thank you,
Vignesh.B
Use the emailNotification property to set separate email subject and email body per each individual recipient. The emailNotification property should be set per recipient.
Here is a sample Json for the createEnvelope request.
POST /v2/accounts/{accountId}/envelopes
{
"recipients": {
"signers": [
{
"email": "recipientone#acme.com",
"name": "recipient one",
"recipientId": "1",
"routingOrder": "1",
"emailNotification": {
"emailSubject": "Please sign the document Recipient One ",
"emailBody": "Hello Recipient One,\r\n\r\nYour consultant has sent you a new document to view and sign. Please click on the View Documents link below, review the content, and sign the document. If you have any questions, please contact your consultant.\r\n\r\nThank you!",
"supportedLanguage": "en"
},
"tabs": {"signHereTabs": [{"documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "100"}]}
},
{
"email": "recipienttwo#acme.com",
"name": "recipient two",
"recipientId": "2",
"routingOrder": "2",
"emailNotification": {
"emailSubject": "Please sign the document Recipient Two ",
"emailBody": "Hello Recipient Two,\r\n\r\nYour consultant has sent you a new document to view and sign. Please click on the View Documents link below, review the content, and sign the document. If you have any questions, please contact your consultant.\r\n\r\nThank you!",
"supportedLanguage": "en"
},
"tabs": {"signHereTabs": [{"documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "200"}]}
}
]
},
"documents": [
{
"documentBase64": "RG9jIFRXTyBUV08gVFdP",
"documentId": "1",
"fileExtension": "txt",
"name": "Simple Contract",
"order": "1"
}
],
"status": "Sent"
}
Use the emailSubject and emailBlurb properties to set the subject and message for all the recipients in the envelope. These properties have to be set at the root level of your json request.
Note: You can override the properties at the envelope level by specifying the emailNotification property for each recipient as suggested in this answer
Here is a sample Json for the createEnvelope request.
POST /v2/accounts/{accountId}/envelopes
{
"emailSubject": "Email subject for all recipients",
"emailBlurb": "Email body for all recipients",
"status": "Sent",
"recipients": {
"signers": [
{
"email": "recipientone#acme.com",
"name": "recipientone",
"recipientId": "1",
"routingOrder": "1",
"tabs": { "signHereTabs": [ { "documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "100" } ] }
},
{
"email": "recipienttwo#acme.com",
"name": "recipient two",
"recipientId": "2",
"routingOrder": "1",
"tabs": { "signHereTabs": [ { "documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "200" } ] }
}
]
},
"documents": [
{
"documentBase64": "RG9jIFRXTyBUV08gVFdP",
"documentId": "1",
"fileExtension": "txt",
"name": "Simple Contract",
"order": "1"
}
]
}

Get recipient view not working for composite envelope

I want to create a composite envelope and then do an embedded signing. The issue is that the envelope is created but the call to get the url fails.
First I create the composite envelope:
https://demo.docusign.net/restapi/v2/accounts/ACCOUNT/envelopes
{
"emailSubject": "DocuSign API - Composite Templates",
"emailBlurb": "Composite Templates Sample 1",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "1AA7BA0B-9079-4F8C-915B-739576297D62"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "email#email.com",
"name": "Signer Name",
"recipientId": "1",
"roleName": "Account Holder"
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": "2",
"templateId": "77343ECC-391F-46A1-BFC3-92A3CD8C93E3"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "email#email.com",
"name": "Signer Name",
"recipientId": "1",
"roleName": "Account Holder",
"tabs": {
"textTabs": [
{
"tabLabel": "AccountFirstName",
"value": "Client"
},
{
"tabLabel": "AccountLastName",
"value": "Name"
},
{
"tabLabel": "Email1",
"value": "someEmail#email.com"
}
]
}
}
]
}
}
]
},
{
"serverTemplates": [
{
"sequence": "3",
"templateId": "ADADDD87-E831-4EF3-A160-BBE73F449C8E"
}
],
"inlineTemplates": [
{
"sequence": "3",
"recipients": {
"signers": [
{
"email": "email#email.com",
"name": "Signer Name",
"recipientId": "1",
"roleName": "Account Holder"
}
]
}
}
]
}
]
}
The response is:
{
"envelopeId": "99f4c73d-6420-4e3b-88eb-2447139a2616",
"uri": "/envelopes/99f4c73d-6420-4e3b-88eb-2447139a2616",
"statusDateTime": "2014-08-14T21:09:09.0430000Z",
"status": "sent" }
Next I try to get the recipient view
https://demo.docusign.net/restapi/v2/accounts/ACCOUNT/envelopes/99f4c73d-6420-4e3b-88eb-2447139a2616/views/recipient
{
"authenticationMethod": "email",
"email": "email#email.com",
"returnUrl": "www.someUrl.com",
"userName": "Signer Name"
}
And I get this error:
{
"errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient of the specified envelope. Envelope recipient could not be determined. 'clientUserId', 'email', or 'userName' in request and envelope may not match."
}
The email and the names match up so I do not understand why I am unable to get the url. I should point out that this all works if I use the same name and email that is on the DocuSign account, but this needs to work for an external recipient.
To designate a recipient as an embedded/captive recipient when creating an Envelope, such that you'll subsequently be able to submit a "Get Recipient View" request to retrieve a URL that can be used to initiate the recipient's signing session, your "Create Envelope" request must specify the clientUserId property for the recipient. This property should appear as a peer to the other recipient properties (i.e.: email, name, etc.) -- like this:
"signers": [
{
"email": "email#email.com",
"name": "Signer Name",
"recipientId": "1",
"roleName": "Account Holder",
"clientUserId": "12345"
}
]
Then, when you submit the "Get Recipient View" request, you'll need to specify the same value for clientUserId there:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/ENVELOPE_ID/views/recipient
{
"authenticationMethod": "Email",
"email": "email#email.com",
"returnUrl": "www.someUrl.com",
"userName": "Signer Name",
"clientUserId": "12345"
}
The value of clientUserId can be anything you wish, but max length is 100 characters. See the DocuSign REST API Guide for more details about embedded signing.

Resources