Docusign NodeJS EnvelopeViews: createRecipient UNKNOWN_ENVELOPE_RECIPIENT - node.js

I call the GET envelope recipients API
https://demo.docusign.net/restapi/v2.1/accounts/cf70dfa7-a861-4029-b149-5360c090ebfa/envelopes/4de0ca11-e07b-4ff0-936f-cdd37ff18ed2/recipients
and it returns clientUserId, userId, email, etc. Odd thing is even though I'm sending it to myself, it returns a different user id than the one I sent with.
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "michael",
"firstName": "",
"lastName": "",
"email": "email#email.email",
"recipientId": "2", //idk why this is 2
"recipientIdGuid": "smth",
"requireIdLookup": "false",
"userId": "fdbb65f9-ea71-4e59-8374-0e1952c70e0a",
"clientUserId": "random",
"routingOrder": "1",
"roleName": "signer",
"status": "sent",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
}
],etcetc
}
Using those I call the POST /view/recipient API and insert all those same things
{
"authenticationMethod": "HTTPBasicAuth",//I've tried this and password
"clientUserId": "random",
"email": "userid", //Tried both user ID's, and email + name, didnt work
"recipientId": "2", //same as above
"returnUrl": "http://localhost:3001/marketplace",
"userName": "userid"//tried same thing, and leaving this blank, gave another error
}
but it gives the error code
{
"errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient of the specified envelope."
}

Here is what your second call should be based on your first call:
{
"authenticationMethod": "none",
"clientUserId": "123456",
"email": "email#email.email",
"returnUrl": "http://localhost:3001/marketplace",
"userName": "michael"
}

Related

DocuSign: Auto-Place doesn't work with sign tabs

I'm trying to add anchor tagging when I create a new envelope, but the tab to sign doesn't appear.
I've followed these steps:
Created a template
POST {{baseUrl}}/v2.1/accounts/{{accountId}}/templates
{"name": "Template 1",
"emailBlurb": "Blurb Test",
"emailSubject": "Subject Test",
"documents": [{
"documentId": "1",
"name": "Document1",
"fileExtension": "pdf",
"order": "1",
"documentBase64":"base64codehere" }]
}
Created an envelope
POST {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes
{"status": "created", "templateId": "{{templateId}}" }
Add recipient to the envelope
POST {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/recipients
{
"signers": [
{
"userName" : "Sender 1",
"email": "sender1email#gmail.com",
"name": "Sender 1",
"clientUserId": "SenderOne" ,
"recipientId": "1",
"roleName" : "SenderMember",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"anchorString": "\\sn1\\",
"anchorXOffset": "20",
"anchorYOffset": "10",
"anchorUnits": "pixels"
}
]
}
},
{
"userName" : "Sender2",
"email": "sender2email#gmail.com",
"name": "Sender2",
"clientUserId": "Sender2C" ,
"recipientId": "2",
"roleName" : "SenderMember2",
"routingOrder": "2",
"tabs": {
"signHereTabs": [
{
"anchorString": "\\sn1\\",
"anchorXOffset": "20",
"anchorYOffset": "10",
"anchorUnits": "pixels"
}
]}}
]
}
Got recipients from envelope
GET {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/recipients
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"requireUploadSignature": "false",
"name": "Sender 1",
"firstName": "",
"lastName": "",
"email": "sender1email#gmail.com",
"recipientId": "1",
"recipientIdGuid": "ed850c16-be9b-45d1-b0a2-b06f9d043a33",
"requireIdLookup": "false",
"userId": "66f3947d-eea4-450a-9f3a-6145607dba20",
"clientUserId": "SenderOne",
"routingOrder": "1",
"roleName": "SenderMember",
"status": "created",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"requireUploadSignature": "false",
"name": "Sender2",
"firstName": "",
"lastName": "",
"email": "sender2email#gmail.com",
"recipientId": "2",
"recipientIdGuid": "88f5e6e2-9e95-4d94-9501-0ebdfeece93b",
"requireIdLookup": "false",
"userId": "4843e0fa-a69c-43ce-9638-e9d1c023ad27",
"clientUserId": "Sender2C",
"routingOrder": "2",
"roleName": "SenderMember2",
"status": "created",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"seals": [],
"witnesses": [],
"notaries": [],
"recipientCount": "2"
}
5 - Sent envelope
GET {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}
{
"status": "sent"
}
When I check the document, I do not see any sign tab:
DocuSign Document with the tags
Am I doing something wrong?
I suggest you follow our two how-to articles about this:
How to create a template
How to request a signature using a
template
Note that by putting the recipients as "placeholders" on the template, you can still define them differently for each envelope using the templateRoles object as long as you match the roleName. You will then get all the tabs that you defined to show on the envelope created from that templates.
Auto-place works fine with sign tabs. So the issue is to figure out what's happening with your app.
First off, most important please do not create an envelope by using multiple API calls to build up the envelope unless there's a real good reason why your application requires that pattern.
In general, building up an envelope via multiple API calls is not an efficient use of the API and is not allowed per DocuSign's API Usage Guidelines.
Instead, you can use one API call to create all aspects of the envelope and send it.
Easiest example to see how to use anchor tags with signHere tabs is the API Request Builder live examples. It enables you to try out the API and it then creates the SDK calls for you in various languages.
My guess from looking at your code is that the anchor strings are not matching with the document's text.

SMS Code Not received - Envelope Embeded Signing

I'm creating an envelope using the following params
Endpoint {{baseUrl}}/envelopes
{
"recipients": {
"signers": [
{
"email": "{{signer1Email}}",
"name": "{{signer1Name}}",
"clientUserId": 22,
"recipientId": 22,
"smsAuthentication": {
"senderprovidednumbers": ["{{signerPhoneNumber}}"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": true,
"recipMayProvideNumber": true,
"tabs": {
"signHereTabs": [
{
"xPosition": "100",
"yPosition": "100",
"documentId": "1",
"pageNumber": "1"
}
]
}
}
]
},
"emailSubject": "DocuSign API - Signature Request on Document Call",
"documents": [
{
"documentId": "1",
"name": "blank1.pdf",
"documentBase64": "{{BASE64_DOCUMENT}}"
}
],
"status": "sent"
}
Then i'm creating a recepient view for this envelope to fetch the url using the following code.
{
"assertionId": null,
"authenticationInstant": null,
"pingFrequency": null,
"pingUrl": null,
"securityDomain": null,
"userId": null,
"returnUrl": "http://localhost:3000/webhooks/souscription-bis?project_id=111",
"authenticationMethod": "none",
"email": "{{signer1Email}}",
"userName": "{{signer1Name}}",
"clientUserId": 22,
"recipientId": 22,
"xFrameOptions": "allow_from",
"xFrameOptionsAllowFromUrl": "http://localhost:3000"
}
And i'm getting the url as expected.
And when the user is redirected to this url and i'm requesting the sms code to be sent i'm not receiving anything.
So i just wanted to make sure that i'm not doing something wrong here.
so you have the actual phone number instead of
{{signerPhoneNumber}}
in our API call?
and that number is not receiving a text message?
After i contacted directly docusign support through the phone, it seems that it was an issue related with their SMS service provider. Now it's working fine

For In Person Signer type, the Recipient Signer Name cannot be blank

I'm suddenly getting this error message when I try to instantiate an envelope from a template:
text: '{\r\n "errorCode": "IN_PERSON_SIGNER_NAME_CANNOT_BE_BLANK",\r\n "message": "For In Person Signer type, the Recipient Signer Name cannot be blank."\r\n}',
This is the code I'm using to create TemplateRoles:
const tRole = new docusign.TemplateRole();
tRole.setRoleName(templateRoleName);
tRole.setName(signerName);
tRole.setEmail(signerEmail);
tRole.setInPersonSignerName(signerName);
tRole.setDefaultRecipient('true');
tRole.setClientUserId('agent');
templateRolesList.push(tRole);
// Create a tempalte role for each client
// TODO: Set correct user data where appropriate instead of test data
let count = 1;
forEach(opts.contacts, () => {
const clientRole = new docusign.TemplateRole();
clientRole.setRoleName(`client${count}`);
clientRole.setName(signerName);
clientRole.setEmail(signerEmail);
clientRole.setInPersonSignerName(signerName);
clientRole.setDefaultRecipient('true');
clientRole.setClientUserId(`client${count}`);
templateRolesList.push(clientRole);
count++;
});
console.log('templateRolesList', JSON.stringify(templateRolesList));
From that console log, I get:
[
{
"email": "eng#residenetwork.com",
"roleName": "agent",
"name": "Reside Network",
"signingGroupId": null,
"inPersonSignerName": "Reside Network",
"clientUserId": "agent",
"embeddedRecipientStartURL": null,
"defaultRecipient": "true",
"accessCode": null,
"routingOrder": null,
"emailNotification": null,
"tabs": null
},
{
"email": "eng#residenetwork.com",
"roleName": "client1",
"name": "Reside Network",
"signingGroupId": null,
"inPersonSignerName": "Reside Network",
"clientUserId": "client1",
"embeddedRecipientStartURL": null,
"defaultRecipient": "true",
"accessCode": null,
"routingOrder": null,
"emailNotification": null,
"tabs": null
}
]
In these objects, inPersonSignerName is set to "Reside Network". I don't understand why this error is appearing or what it is complaining about.
Our code has not changed (though its possible some setting in our account has).
For inPersonSigners the name and email of the user hosting the signing are required, and the name of the signer is required whereas their email is optional.
For example:
"inPersonSigners": [{
"hostEmail": "john.doe#company.com",
"hostName": "John Doe",
"autoNavigation": true,
"defaultRecipient": false,
"signInEachLocation": false,
"signerEmail": "optional_signer_email",
"signerName": "Sally Doe"
}],
API Docs for inPersonSigner:
https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeRecipients/#inPerson

Error Adding Recipient with Custom Email Notfication

I'm attempting to add a recipient to a draft envelope and althought the recipient does get added I receive an error message related to the notification. Could someone explain the USER_LACKS_RECIPIENTEMAILNOTIFICATION_PERMISSION error is exactly?
POST /restapi/v2/accounts/123456/envelopes/3a20bef6-0d88-431a-aaf1-e27baa9b59a6/recipients HTTP/1.1
{
"carbonCopies": [
{
"email": "my#emailaddress.com",
"name": "Mike",
"accessCode": "xyz",
"addAccessCodeToEmail": true,
"emailNotification": {
"emailBody": "Custom email message different than the envelope body",
"emailSubject": "Custom email subject",
"supportedLanguage": "en"
},
"inheritEmailNotificationChange": false,
"note": "Sample note",
"recipientId": "1",
"routingOrder": "1"
}
]
}
And here is the response that I receive back:
{
"signers": [],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [
{
"name": "Mike",
"email": "my#emailaddress.com",
"recipientId": "1",
"accessCode": "xyz",
"requireIdLookup": "false",
"routingOrder": "1",
"note": "Sample note",
"status": "error",
"emailNotification": {
"emailSubject": "Custom email subject",
"emailBody": "Custom email message different than the envelope body",
"supportedLanguage": "en"
},
"errorDetails": {
"errorCode": "USER_LACKS_RECIPIENTEMAILNOTIFICATION_PERMISSION",
"message": "Account or user does not have permission to set recipient email notifications."
}
}
],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "1"
}
The only permission setting that I can see might pertain to this is the following, but I can not change it's value.
The answer to get around this issue is to not supply the ""supportedLanguage" property for the recipient. This is a feature that will need to be turned on for your sending user in order to use it.
Check the "Reminders & Expirations" section to make sure you don't have the "Do NOT allow users to override these settings" setting checked?

Get template roles (REST API)

I'm interested in getting roles from templates to populate them correctly and keep that up to date automatically.
Is it somehow possible to get that using REST API?
There's the "Get Account Template by ID - v2/accounts/:accountId/templates/:templateId" request but it seems to return little useful info regarding roles or recipients.
Using the REST API, you can get recipient Role Names for a Template by simply executing a "GET Envelope Recipients" request, where you specify the Template Id in place of the Envelope Id. For example:
GET https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes/{templateId}/recipients?include_tabs=false&include_extended=true
The response to this request will contain an array of recipient objects for each recipient type (i.e.: signers, agents, editors, intermediaries, carbonCopies, certifiedDeliveries, inPersonSigners); each recipient object will contain the property roleName. Here's an example response for a template that contains 3 recipients -- 2 signers and one CC recipient:
{
"signers": [
{
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "5741ec70-b056-44eb-b462-eceee88ddf77",
"requireSignerCertificate": "false",
"requireIdLookup": "false",
"routingOrder": "1",
"roleName": "Signer 1",
"status": "created",
"templateLocked": "false",
"templateRequired": "false"
},
{
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "c64d4567-2efd-422d-9b0a-a5427aa2512d",
"requireSignerCertificate": "false",
"requireIdLookup": "false",
"routingOrder": "2",
"roleName": "Signer 2",
"status": "created",
"templateLocked": "false",
"templateRequired": "false"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [
{
"name": "Legal Team",
"email": "email3#outlook.com",
"recipientId": "a63e3714-adc2-4e05-b2c5-b3c3bbf50aa2",
"requireIdLookup": "false",
"routingOrder": "3",
"roleName": "Legal Team",
"status": "created",
"templateLocked": "true",
"templateRequired": "true"
}
],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "3"
}

Resources