Not able to receive event notification in SFDC - docusignapi

I am sending REST request to docusign from Postman, but I am not able to get the eventNotification back to the url i am giving. Please help what I am doing wrong in the request.
{
"accountId": "8555983",
"emailSubject": "This request is sent from a Template",
"templateId": "4ce7f605-c2c8-40ab-b95b-7aaa0c765245",
"templateRoles": [{
"roleName": "Signer1",
"name": "Prakhar",
"email": "prakhar#example.com",
"eventNotification": {
"url": "[sfdc base url]/services/apexrest/Docusign",
"loggingEnabled": "true",
"requireAcknowledgment": "true",
"useSoapInterface": "false",
"includeCertificateWithSoap": "false",
"signMessageWithX509Cert": "false",
"includeDocuments": "true",
"includeEnvelopeVoidReason": "true",
"includeTimeZone": "true",
"includeSenderAccountAsCustomField": "true",
"includeDocumentFields": "true",
"includeCertificateOfCompletion": "true",
"envelopeEvents": [
{
"envelopeEventStatusCode": "sent"
},
{
"envelopeEventStatusCode": "delivered"
},
{
"envelopeEventStatusCode": "completed"
},
{
"envelopeEventStatusCode": "declined"
},
{
"envelopeEventStatusCode": "voided"
}
]
},
"tabs": {
"signHereTabs": [{
"xPosition": "138",
"yPosition": "654",
"documentId": "1",
"pageNumber": "1"
}],
"textTabs": [{
"tabLabel": "NameOfInstitution",
"value":"Example",
"locked": "true",
"xPosition": "245",
"yPosition": "310",
"documentId": "1",
"pageNumber": "1"
}
]
}
}],
"status": "sent"
}

The eventNotification attribute must be at the base level of the request object.
You're placing it within a templateRoles object.
Try the following:
{
"accountId": "8555983",
"emailSubject": "This request is sent from a Template",
"templateId": "4ce7f605-c2c8-40ab-b95b-7aaa0c765245",
"templateRoles": [{
"roleName": "Signer1",
"name": "Prakhar",
"email": "prakhar#example.com",
"tabs": {
"signHereTabs": [{
"xPosition": "138",
"yPosition": "654",
"documentId": "1",
"pageNumber": "1"
}],
"textTabs": [{
"tabLabel": "NameOfInstitution",
"value":"Example",
"locked": "true",
"xPosition": "245",
"yPosition": "310",
"documentId": "1",
"pageNumber": "1"
}]
}
}],
"status": "sent",
"eventNotification": {
"url": "[sfdc base url]/services/apexrest/Docusign",
"loggingEnabled": "true",
"requireAcknowledgment": "true",
"useSoapInterface": "false",
"includeCertificateWithSoap": "false",
"signMessageWithX509Cert": "false",
"includeDocuments": "true",
"includeEnvelopeVoidReason": "true",
"includeTimeZone": "true",
"includeSenderAccountAsCustomField": "true",
"includeDocumentFields": "true",
"includeCertificateOfCompletion": "true",
"envelopeEvents": [
{
"envelopeEventStatusCode": "sent"
},
{
"envelopeEventStatusCode": "delivered"
},
{
"envelopeEventStatusCode": "completed"
},
{
"envelopeEventStatusCode": "declined"
},
{
"envelopeEventStatusCode": "voided"
}
]
}
}

Related

How to pre-fill custom fields when creating an envelope?

My business process is like this:
I have one template with one document.
The document must have several fields that must be filled in differently for each signatory.
For example:
fields "company_name", "signer_name", etc.
I assume that when creating an envelope, the fields must be pre-filled for each signer:
Signer 1 should receive values for the fields: "Alice's company", "Alice",
Signer 2 should receive values for the fields: "Bob's company", "Bob".
To do that, I make POST request to endpoint:
/restapi/v2.1/accounts/{accountId}/envelopes
Body:
{
"emailSubject": "Email Subject",
"templateId": "my-template-id",
"status": "sent",
"customFields": {
"textCustomFields": [
{
"fieldId": "10851848897",
"name": "company_name",
"required": "true",
"show": "true",
"value": "Alice's company"
},
{
"fieldId": "10851848898",
"name": "signer_name",
"required": "true",
"show": "true",
"value": "Alice"
}
]
},
"templateRoles": [
{
"email": "alice#maildomain.com",
"emailNotification": {
"emailBody": "email body",
"emailSubject": "email subject",
"supportedLanguage": "en"
},
"roleName": "signer",
"routingOrder": "1"
}
]
}
Alice recieve link to sign the document without pre-filled fields.
Also, GET request to list document's fields
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields
gives no fields:
{
"documentFields": []
}
Envelope Custom fields can be obtained by a different endpoint:
/restapi/v2.1/accounts/${account_id}/envelopes/${envelope_id}/custom_fields
Now, I assume you actually want something else, which is to show values to the recipients on the envelope.
That is done by actually adding tabs and settings their values like this:
(giving you here a complete example with various different tabs)
ENVELOPE
{
"customFields": {
"textCustomFields": [{
"name": "salary",
"required": "false",
"show": "true",
"value": "123000"
}]
},
"documents": [
{
"documentBase64": "' > $request_data
cat $doc1_base64 >> $request_data
printf '",
"documentId": "1",
"fileExtension": "docx",
"name": "Lorem Ipsum"
}
],
"emailBlurb": "Sample text for email body",
"emailSubject": "Please Sign",
"envelopeIdStamping": "true",
"recipients": {
"signers": [{
"clientUserId": "1000",
"email": "{USER_EMAIL}",
"name": "{USER_NAME}",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [{
"anchorString": "/sn1/",
"anchorUnits": "pixels",
"anchorXOffset": "20",
"anchorYOffset": "10"
}],
"textTabs": [{
"anchorString": "/legal/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "false",
"tabId": "legal_name",
"tabLabel": "Legal name",
"value": "{USER_NAME}"
}, {
"anchorString": "/familiar/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "false",
"tabId": "familiar_name",
"tabLabel": "Familiar name",
"value": "{USER_NAME}"
}, {
"anchorString": "/salary/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "true",
"tabId": "salary",
"tabLabel": "Salary",
"value": "$123,000.00"
}]
}
}]
},
"status": "Sent"
}
TEMPLATE
{
"customFields": {
"textCustomFields": [{
"name": "app metadata item",
"required": "false",
"show": "true",
"value": "1234567"
}]
},
"status": "Sent",
"templateId": "'"${template_id}"'",
"templateRoles": [{
"clientUserId": "1000",
"email": "'"${SIGNER_EMAIL}"'",
"name": "'"${SIGNER_NAME}"'",
"roleName": "signer",
"tabs": {
"checkboxTabs": [{
"selected": "true",
"tabLabel": "ckAuthorization"
}, {
"selected": "true",
"tabLabel": "ckAgreement"
}],
"listTabs": [{
"documentId": "1",
"pageNumber": "1",
"tabLabel": "list",
"value": "green"
}],
"radioGroupTabs": [{
"groupName": "radio1",
"radios": [{
"selected": "true",
"value": "white"
}]
}],
"textTabs": [{
"tabLabel": "text",
"value": "Jabberwocky!"
}, {
"bold": "true",
"documentId": "1",
"font": "helvetica",
"fontSize": "size14",
"height": "23",
"locked": "false",
"pageNumber": "1",
"required": "false",
"tabId": "name",
"tabLabel": "added text field",
"value": "'"${SIGNER_NAME}"'",
"width": "84",
"xPosition": "280",
"yPosition": "172"
}]
}
}, {
"email": "'"${CC_EMAIL}"'",
"name": "'"${CC_NAME}"'",
"roleName": "cc"
}]
}

How to create an envelope with signingGroup recipient?

I am creating an envelope using this uri:
POST https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes
headers:
Content-Type : application/json
X-DocuSign-Authentication: {"Username" : *****, "Password" : ******, "IntegratorKey" : *********}
body:
{
"status": "sent",
"emailSubject": "Signing Request for Doc2.docx",
"signerCanSignOnMobile": "true",
"documents": [
{
"documentId": "384098342",
"name": "Doc2.docx",
"fileExtension": "docx",
"documentBase64": *****,
"tabs": {
"textTabs": [
{
"xPosition": "2",
"yPosition": "3",
"documentId": "384098342",
"pageNumber": "1",
"value": "Fill in name.",
"locked": "false",
"anchorString": "sign5",
"anchorXOffset": "1.75",
"anchorYOffset": "0",
"anchorUnits": "inches",
"anchorIgnoreIfNotPresent": "true"
}
]
}
}
],
"recipients": {
"signers": [
{
"name": "Tom Ford",
"email": "tom.ford#email.com",
"recipientId": "64000",
"clientUserId": "c7052b97-f9a7-4af4-85de-8c64371467b1"
},
{
"name": "Demand Approvers",
"email": "approvers#email.com",
"signingGroupId": "true",
"signingGroupName": "Demand Approvers",
"recipientId": "626000",
"clientUserId": "123c6d15-1d25-4595-9878-5cbda4ba2823",
"signingGroupUsers": [
{
"userName": "John Smith",
"userId": "9c328221-1e86-41db-a3e7-bde9b4b4a50d",
"email": "josmith#example.com"
}
]
}
]
}
}
and the request succeeds. However, when I try to query the returned envelope, the "Demand Approvers" is listed as a single recipient instead of as a signingGroup.
Here is an example output:
{
"status": "sent",
"documentsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/documents",
"recipientsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/recipients",
"attachmentsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/attachments",
"envelopeUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e",
"emailSubject": "Signing Request for Doc2.docx",
"envelopeId": "063454a6-dee6-4e86-8d38-56d85e66c61e",
"signingLocation": "online",
"customFieldsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/custom_fields",
"notificationUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/notification",
"enableWetSign": "true",
"allowMarkup": "false",
"allowReassign": "true",
"createdDateTime": "2021-02-17T00:43:28.7070000Z",
"lastModifiedDateTime": "2021-02-17T00:43:28.7230000Z",
"initialSentDateTime": "2021-02-17T00:43:29.2570000Z",
"sentDateTime": "2021-02-17T00:43:29.2570000Z",
"statusChangedDateTime": "2021-02-17T00:43:29.2570000Z",
"documentsCombinedUri": "/envelopes/********************/documents/combined",
"certificateUri": "/envelopes/********************/documents/certificate",
"templatesUri": "/envelopes/********************/templates",
"expireEnabled": "true",
"expireDateTime": "2021-06-17T00:43:29.2570000Z",
"expireAfter": "120",
"sender": {
"userName": "********",
"userId": "********",
"accountId": "********",
"email": "sender#email.com"
},
"recipients": {
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "Demand Approvers",
"firstName": "",
"lastName": "",
"email": "approvers#email.com",
"recipientId": "626000",
"recipientIdGuid": "365b2f4d-0968-42d1-805e-55eece700246",
"requireIdLookup": "false",
"userId": "891a3891-f49d-4f14-8bc8-959524e2445a",
"clientUserId": "123c6d15-1d25-4595-9878-5cbda4ba2823",
"routingOrder": "1",
"status": "sent",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "Tom Ford",
"firstName": "",
"lastName": "",
"email": "tom.ford#email.com",
"recipientId": "64000",
"recipientIdGuid": "c60c5ccd-e49f-4b63-9745-5f283b8520eb",
"requireIdLookup": "false",
"userId": "4a78d305-43bf-4d78-a844-2bdc15e63770",
"clientUserId": "c7052b97-f9a7-4af4-85de-8c64371467b1",
"routingOrder": "1",
"status": "sent",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"seals": [],
"witnesses": [],
"notaries": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
},
"purgeState": "unpurged",
"envelopeIdStamping": "true",
"is21CFRPart11": "false",
"signerCanSignOnMobile": "true",
"autoNavigation": "true",
"isSignatureProviderEnvelope": "false",
"hasFormDataChanged": "false",
"allowComments": "true",
"hasComments": "false",
"allowViewHistory": "true",
"envelopeMetadata": {
"allowAdvancedCorrect": "true",
"enableSignWithNotary": "true",
"allowCorrect": "true"
},
"anySigner": null,
"envelopeLocation": "current_site",
"isDynamicEnvelope": "false"
}
The signingGroup related information for Demand Approvers is missing.
How do I structure my request so that the Demand Approvers will be listed as a signingGroup?
I found the cause. So it seems that when dealing with Signing Groups,
These 2 points must be true:
The Signing Group must be registered in DocuSign. The generated
signingGroupId can then be used as recipient. Setting signingGroupId
to "true" or any random value will not work.
clientUserId must not be provided

GET Custom_fields in List of Templates DocuSign

I tried to use a GET call in POSTMAN to get the List of Templates and include the Custom Field, but the response does not return the custom_fields value, any thoughts?
GET:
https://demo.docusign.net/restapi/v2/accounts/{account_id}/templates?include=recipients,documents,custom_fields
RESPONSE
{
"templateId": "XXXXXXXXXXXXXXXXXXXXX",
"name": "DEMO",
"shared": "true",
"password": "",
"description": "",
"lastModified": "2017-06-20T14:13:57.9270000Z",
"pageCount": 2,
"uri": "xxxxxxxxxxx",
"folderName": "DEMO",
"folderId": "617c1361-8576-4b62-930e-735442256a25",
"folderUri": "xxxxxxxxx",
"owner": {
"userName": "XXXXXXXXXXXXXXX",
"userId": "XXXXXXXXXXXXXXXXXX",
"email": "XXXXXXXXX#XXXX.COM"
},
"documents": [
{
"documentId": "1",
"uri": "xxxxxxxxxxxx",
"name": "DS_DEMO.pdf",
"order": "1",
"pages": "1",
"display": "inline",
"includeInDownload": "true",
"signerMustAcknowledge": "no_interaction",
"templateLocked": "false",
"templateRequired": "false",
"documentGroup": "content"
},
{
"documentId": "54582351",
"uri": "xxxxxxxxxxxx",
"name": "XXXXXXXXXXXXXX.png",
"order": "2",
"pages": "1",
"display": "inline",
"includeInDownload": "true",
"signerMustAcknowledge": "no_interaction",
"templateLocked": "false",
"templateRequired": "false",
"documentGroup": "content"
}
],
"emailSubject": "Please sign this DS Document",
"emailBlurb": "Thank you for reaching and showing us your interest in how DocuSign works. Please, practice here.\n\n",
"signingLocation": "Online",
"authoritativeCopy": "false",
"enforceSignerVisibility": "false",
"enableWetSign": "false",
"allowMarkup": "true",
"allowReassign": "true",
"recipients": {
"signers": [
{
"defaultRecipient": "false",
"signInEachLocation": "false",
"email": "",
"recipientId": "4",
"accessCode": "",
"requireIdLookup": "false",
"routingOrder": "2",
"note": "",
"roleName": "System Analyst",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"inheritEmailNotificationConfiguration": "false",
"documentVisibility": [
{
"documentId": "1",
"visible": "true"
},
{
"documentId": "54582351",
"visible": "true"
}
]
},
{
"defaultRecipient": "false",
"signInEachLocation": "false",
"name": "DS Training",
"email": "",
"signingGroupId": "10749",
"signingGroupName": "DS Training",
"recipientId": "2",
"accessCode": "",
"requireIdLookup": "false",
"routingOrder": "1",
"note": "Please complete it as soon you can",
"roleName": "Sales Analyst",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"inheritEmailNotificationConfiguration": "false",
"documentVisibility": [
{
"documentId": "1",
"visible": "true"
},
{
"documentId": "54582351",
"visible": "true"
}
]
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [
{
"email": "",
"recipientId": "3",
"accessCode": "",
"requireIdLookup": "false",
"routingOrder": "3",
"note": "",
"roleName": "Manager",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"inheritEmailNotificationConfiguration": "false",
"documentVisibility": [
{
"documentId": "1",
"visible": "true"
},
{
"documentId": "54582351",
"visible": "true"
}
]
}
],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "3"
}
},
Reference:
Templates: list documentation
You're right. It is a bug. Thank you for the report. I've verified it and filed DocuSign internal bug report API-7048.
In the meantime, the work-around is to use Templates: get for each of the templates returned by the Templates: list operation.

Docusign webhooks listener not receiving event notification

We have a soap URL which receives webhooks from docusign as per configured status. It was sending webhooks but all of sudden it stopped receiving it. I have enablelogging turned is set to true and checked in admin connect tab and nothing in logs or failure as well. We used to get logs there before. We have a demo account.
Nothing has been changed in our code. Can anyone please suggest what could have cause this issue and how to resolve it
Regards,
Dishant
following request data sent to docusign restapi
{
"documents": [
{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"fileExtension": "pdf",
"name": "00098O01.pdf"
}
],
"emailSubject": "Test",
"eventNotification": {
"envelopeEvents": [
{
"envelopeEventStatusCode": "Sent",
"includeDocuments": "false"
},
{
"envelopeEventStatusCode": "completed",
"includeDocuments": "true"
}
],
"includeTimeZone": "true",
"loggingEnabled": "true",
"recipientEvents": [
{
"includeDocuments": "false",
"recipientEventStatusCode": "Sent"
},
{
"includeDocuments": "false",
"recipientEventStatusCode": "Delivered"
}
],
"soapNameSpace": "xxxxx",
"url": "xxxx",
"useSoapInterface": "true"
},
"recipients": {
"signers": [
{
"email": "dishant.arora#caseflowacumen.com",
"name": "Dishant Arora",
"recipientId": "1",
"tabs": {
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"tabLabel": "Sign Here",
"xPosition": "100",
"yPosition": "500"
}
]
}
}
]
},
"status": "sent"
}

Docusign emails seem to always have the same subject

This is thru the Docusign api. Here is the envelope definition:
{
"eventNotification": {
"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": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "c110d14a-3690-4ed1-921d-a7bef9524ed6"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Kathy Lori",
"email": "kathylori#xxx.com",
"recipientId": "1",
"accessCode": "12345",
"customFields": [],
"routingOrder": "1",
"note": "",
"roleName": "##Buyer1"
}
],
"certifiedDeliveries": []
},
"customFields": {
"textCustomFields": [
{
"name": "EnvelopeInfo",
"value": "my data"
}
]
}
}
],
"document": {
"documentId": "1",
"name": "c:\three of the test.docx",
"fileExtension": ".docx",
"documentFields": [],
"documentBase64": [bytearray]
}
}
],
"status": "sent",
"emailSubject": "This is the new subject"
}
The subject still shows as "Please DocuSign: sign this". I would have thought setting the subject would have addressed this, but I must be missing something.
You have most likely configured per recipient email subject in your server template. In such a case the emailSubject that is specified at the root level of the postEnvelope request is ignored.
You can confirm that by making a getTemplates call using your server template Id. It will look something like below. Look specifically for recipients.signers.emailNotification property. I have removed some of the properties for simplicity.
{
"envelopeTemplateDefinition": {
"templateId": "xxxxxxxx-xxxx-xxxx-xxxx-e672c4efd436",
},
"documents": [ ],
"emailSubject": "This is the subject on the server template.",
"emailBlurb": "",
"recipients": {
"signers": [
{
"tabs": {},
"roleName": "RoleOne",
"emailNotification": {
"emailSubject": "Please DocuSign: sign this",
"emailBody": "",
"supportedLanguage": "en"
},
}
]
}
}
To override the per recipient email subject specified in the server template, specify the emailNotification property in the inlineTemplate.
{
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "c110d14a-3690-4ed1-921d-a7bef9524ed6"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Kathy Lori",
"email": "kathylori#xxx.com",
"recipientId": "1",
"accessCode": "12345"
"routingOrder": "1",
"roleName": "##Buyer1",
"emailNotification": {
"emailSubject": "This is email subject to Buyer1",
"emailBody": "",
"supportedLanguage": "en"
},
}
],
}
}
],
"document": { }
}
],
"status": "sent",
}

Resources