我试图将docusign签名页面嵌入到网站中。但是我得到了这个错误
Message=Error calling CreateRecipientView: {
"errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient of
the specified envelope."
}
我使用的是.Net nuget客户端,这里是我使用过的代码(注意我已经更改过guids和电子邮件)
string userId = "0570b3da-652e-4040-842e-65a0e6fc8133"; // use your userId (guid), not email address
string integratorKey = "cf73e7bb-e05d-4ce9-9cea-ac065dc894ac";
string host = "https://demo.docusign.net/restapi";
ApiClient apiClient = new ApiClient(host);
string username = "my@email.com";
string password = "[password]";
// initialize client for desired environment (for production change to www)
Configuration.Default.ApiClient = apiClient;
// configure 'X-DocuSign-Authentication' header
string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}";
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
// we will retrieve this from the login API call
string accountId = null;
AuthenticationApi authApi = new AuthenticationApi(apiClient.Configuration);
LoginInformation loginInfo = authApi.Login();
//find the default account for this user
foreach (LoginAccount loginAcct in loginInfo.LoginAccounts)
{
if (loginAcct.IsDefault == "true")
{
accountId = loginAcct.AccountId;
string[] separatingStrings = { "/v2" };
// Update ApiClient with the new base url from login call
apiClient = new ApiClient(loginAcct.BaseUrl.Split(separatingStrings, StringSplitOptions.RemoveEmptyEntries)[0]);
break;
}
}
EnvelopeDefinition envDef = new EnvelopeDefinition();
TemplateRole tRole = new TemplateRole();
tRole.Email = "recipient@email.com";
tRole.RoleName = "Leaseholder";
tRole.ClientUserId = tRole.Email;
List<TemplateRole> rolesList = new List<TemplateRole> { tRole };
envDef.TemplateRoles = rolesList;
envDef.TemplateId = "2504e3f0-f4d9-4eca-9fd3-3b26cfd6c086";
RecipientViewRequest viewOptions = new RecipientViewRequest()
{
ReturnUrl = "http://localhost:64202/home/winning",
ClientUserId = tRole.Email, // must match clientUserId of the embedded recipient
AuthenticationMethod = "email",
UserName = tRole.Email,
Email = tRole.Email
};
EnvelopesApi envelopesApi = new EnvelopesApi();
var summary = envelopesApi.CreateEnvelope(accountId, envDef);
var receipients = envelopesApi.ListRecipients(accountId, summary.EnvelopeId);
ViewUrl viewUrl = envelopesApi.CreateRecipientView(accountId, summary.EnvelopeId, viewOptions);
return Content($"<h2>hmm</h2><iframe width=\"100%\" height=\"100%\" src=\"{viewUrl.Url}\"/>");
{
"agents": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"editors": [],
"inPersonSigners": [],
"intermediaries": [],
"recipientCount": "1",
"seals": [],
"signers": [
{
"clientUserId": "recipient@email.com",
"creationReason": "sender",
"deliveryMethod": "email",
"email": "recipient@email.com",
"isBulkRecipient": "false",
"name": "",
"note": "",
"recipientId": "1",
"recipientIdGuid": "52abdeea-2bd6-4108-97b9-170ca27d573a",
"requireIdLookup": "false",
"roleName": "Leaseholder",
"routingOrder": "1",
"status": "created",
"userId": "0570b3da-652e-4040-842e-65a0e6fc8133"
}
]
}
答案 0 :(得分:3)
UNKNOWN_ENVELOPE_RECIPIENT
错误通常意味着为信封中的收件人指定的以下三个属性值之一与获取中指定的相应值不完全匹配收件人查看请求:
Name
Email
ClientUserId
在您的情况下(根据您发布的代码),我怀疑UNKNOWN_ENVELOPE_RECIPIENT
错误是由您为收件人 指定的信息造成的不 包含Name
属性的值 - 在创建RecipientViewRequest
对象 时,您指定的信息 包含UserName
属性的值(必须如此)。
要解决此错误,我建议您在为TemplateRole
对象指定信息时(#34; RECIPIENT_NAME&#),尝试将此行添加到代码部分34;是收件人的名字和姓氏。
tRole.Name = "RECIPIENT_NAME;
然后为UserName
对象的RecipientViewRequest
属性指定相同的值:
UserName = "RECIPIENT_NAME",
(您指定为RECIPIENT_NAME的值将是收件人在文档中签名的名称,因此您应指定此人的名字/姓氏,而不是电子邮件地址。)
<强>更新强>
重新考虑您在评论中提及的后续RECIPIENT_NOT_IN_SEQUENCE
错误,当您在发送信封之前为收件人致电获取收件人视图时会发生此错误,或在他们轮到他们之前&#34;在路由顺序中接收信封。在您的情况下,我怀疑这种情况正在发生,因为您未将信封的status
设置为sent
- 收件人无法接收/访问信封,直到它为&#39已被发送。要解决此错误,请在撰写EnvelopeDefinition
对象时设置信封的状态:
envDef.Status = "sent";