简体   繁体   English

来自docusign API的无效收件人

[英]Invalid recipient from docusign API

I'm trying to embed a docusign signature page into a website. 我正在尝试将docusign签名页面嵌入网站。 but I get this error 但是我得到这个错误

Message=Error calling CreateRecipientView: {
  "errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
  "message": "The recipient you have identified is not a valid recipient of 
  the specified envelope."
}

I'm using the .Net nuget client and here's the code I'm using (note I've changed guids and emails) 我正在使用.Net nuget客户端,这是我正在使用的代码(请注意,我已经更改了向导和电子邮件)

Authenticate 认证

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);

Find account id 查找帐号ID

this was part of the example code 这是示例代码的一部分

// 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;
    }
}

Create Envelope from a template 从模板创建信封

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}\"/>");

Recipients on the template 模板上的收件人

在此处输入图片说明

Recipients 收件人

{
"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"
  }
]
}

The UNKNOWN_ENVELOPE_RECIPIENT error usually means that one of the following three property values specified for the Recipient within the Envelope doesn't exactly match the corresponding value that's been specified in the Get Recipient View request: UNKNOWN_ENVELOPE_RECIPIENT错误通常意味着为信封内的收件人指定的以下三个属性值之一与“ 获取收件人视图”请求中指定的对应值不完全匹配:

  • Name
  • Email
  • ClientUserId

In your case (based upon the code you posted), I suspect that the UNKNOWN_ENVELOPE_RECIPIENT error is being caused by the fact that the info you've specified for the recipient does not include a value for the Name property -- where as the info you've specified when creating the RecipientViewRequest object does include a value for the UserName property (as it must). 在您的情况下(基于您发布的代码),我怀疑UNKNOWN_ENVELOPE_RECIPIENT错误是由以下事实引起的:您为收件人指定的信息包括Name属性的值-在此情况下,创建RecipientViewRequest对象时指定的确实包含UserName属性的值(必须如此)。

To fix this error, I'd suggest that you try adding this line to the portion of your code when you're specifying information for the TemplateRole object (where "RECIPIENT_NAME" is the first and last name of the recipient). 要解决此错误,建议您在为TemplateRole对象(其中“ RECIPIENT_NAME”是收件人的名字和姓氏)指定信息时尝试将这一行添加到代码的一部分中。

tRole.Name = "RECIPIENT_NAME;

And then specify the same value for the UserName property of the RecipientViewRequest object: 然后为RecipientViewRequest对象的UserName属性指定相同的值:

UserName = "RECIPIENT_NAME",

(The value you specify as RECIPIENT_NAME will be the name that the recipient signs in the doc(s), so you should specify first name / last name of the person, not an email address.) (您指定为RECIPIENT_NAME的值将是收件人在文档中签名的名称,因此您应指定此人的名字/姓氏,而不是电子邮件地址。)


UPDATE UPDATE

Re the subsequent RECIPIENT_NOT_IN_SEQUENCE error that you've mentioned in your comment, this error occurs when you call Get Recipient View for a recipient either before the Envelope has been sent or before it's "their turn" in the routing order to receive the Envelope. 重新执行您在注释中提到的后续RECIPIENT_NOT_IN_SEQUENCE错误,当您在发送信封之前或在路由顺序中的“轮到他们”之前调用收件人的“获取收件人视图”时,会发生此错误,以接收信封。 In your case, I suspect this is occurring because you're not setting the status of the Envelope to sent -- the recipient can't receive/access the Envelope until it's been sent. 在您的情况下,我怀疑是因为您没有将信封的status设置为已sent -收件人在sent信封后才能接收/访问该信封。 To resolve this error, set the status of of the Envelope when you're composing the EnvelopeDefinition object: 要解决此错误,请在组成EnvelopeDefinition对象时设置Envelope的状态:

envDef.Status = "sent";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM