简体   繁体   English

如何通过收件人DocuSignAPI使用模板将accessCode发送给收件人并覆盖电子邮件?

[英]How do I send an accessCode to a recipient and override the email using a template via the DocuSignAPI?

I have tried just about everything that I can think of and cannot get this to work. 我已经尝试了所有我能想到的所有事情,并且无法使它起作用。

I am trying to set an access code in my code and send it to a templateRole using the RequestSignatureFromTemplate call. 我试图在我的代码中设置访问代码,并使用RequestSignatureFromTemplate调用将其发送到templateRole。 Right now, all of my configuration info is in XML. 现在,我所有的配置信息都是XML。 I am NOT adverse to using JSON but not all of my developers know JSON. 我并不反对使用JSON,但并非所有开发人员都知道JSON。

Here is a snippet of my XML. 这是我的XML的片段。

<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">
    accountId>12345</accountId>
    <status>sent</status>                        
    <emailSubject>Test Form</emailSubject>
    <emailBlurb>This is a template test.</emailBlurb>
    <templateId>####-########</templateId>
    <templateRoles>
        <templateRole>
            <accessCode>AccessCode124</accessCode>" +
            <addAccessCodeToEmail>true</addAccessCodeToEmail>" +
            <email>jevans@eclarifire.com</email>
            <name>Test User</name>
            <roleName>RoleOne</roleName>
            <emailNotification>
                <emailSubject>This is RoleOne's subject</emailSubject>
                <emailBody>This is RoleOne's email.</emailBody>
                <addAccessCodeToEmail>true</addAccessCodeToEmail>
            </emailNotification>
        </templateRole>
        <templateRole>
            <accessCode>AccessCode246</accessCode>
            <email>jevans@eclarifire.com</email>
            <name>Test User2</name>
            <roleName>RoleTwo</roleName>
            <emailNotification>
                <emailBody>Your access code is 24680</emailBody>
            </emailNotification>
        </templateRole>
    </templateRoles>
</envelopeDefinition>

You'll notice that I have two different implementations in the templateRole nodes. 您会注意到,我在templateRole节点中有两种不同的实现。 This is intentional since I'm trying everything that I can think of. 这是故意的,因为我正在尝试所有我能想到的东西。 In templateRole(1), I have added the addAccessCodeToEmail node in two different places and it doesn't work in either. 在templateRole(1)中,我在两个不同的位置添加了addAccessCodeToEmail节点,但在两个位置均不起作用。 I have also attempted to override the emailBlurb node in templateRole(1) and it doesn't work either. 我还尝试覆盖templateRole(1)emailBlurb节点,它也不起作用。

I've been through the documentation and it says that you should be able to add anything that the Recipients format follows but I can't get it to work. 我已经看完了文档,它说您应该能够添加“收件人”格式遵循的所有内容,但我无法使其正常工作。

Any one got any ideas? 任何人有任何想法吗?

I've never used the addAccessCodeToEmail property in a "Create/Send Envelope" API request, because including the Access Code in the email that the recipient receives entirely nullifies the effect of using Access Code for authentication in the first place. 我从未在“创建/发送信封” API请求中使用过addAccessCodeToEmail属性,因为收件人在接收到的电子邮件中包含访问代码,这完全抵消了使用访问代码进行身份验证的影响。 ie, the entire point of requiring the Recipient to enter an Access Code is to add another layer of assurance -- beyond the fact that someone merely has access to an email inbox -- before granting access to the envelope. 即,要求收件人输入访问代码的整个要点是增加保障的另一层 -超越的事实,有人仅仅能够访问电子邮件收件箱-授权访问信封之前。 If you're going to include the access code in the email that the Recipient receives, then using Access Code as the form of authentication isn't providing any additional security benefit whatsoever -- whoever has access to that email inbox will be able to easily access the envelope (same result as if you don't use Access Code at all). 如果您要在收件人收到的电子邮件中包含访问代码,则使用访问代码作为身份验证形式不会提供任何其他安全优势-有权访问该电子邮件收件箱的任何人都将能够轻松访问信封(与根本不使用访问代码相同的结果)。

That being said, there is a property that (for whatever reason) should allow you to have Access Code included in the email that the recipient receives -- I can't get this to work either. 话虽这么说, 一个(无论何种原因)应允许您有包含在收件人收到的电子邮件访问代码属性-我不能得到这个工作的。 Maybe a bug, but someone at DocuSign will need to confirm. 可能是一个错误,但DocuSign的某人需要确认。 According to the documentation, this should result in the email containing the access code: 根据文档,这将导致电子邮件中包含访问代码:

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
    "status"        : "sent",
    "emailBlurb"    : "please sign",
    "emailSubject"  : "Please sign your document",
    "templateId"    : "TEMPLATE_ID",
    "templateRoles" : [{
      "name"         : "John Doe",
      "email"        : "JohnsEmail@outlook.com",
      "roleName"     : "Signer1",
      "accessCode"   : "1234",
      "addAccessCodeToEmail": "true"
   }]
}

This request results in the recipient being required to enter an Access Code before he can access the Envelope, but the addAccessCodeToEmail property isn't having the expected effect, as the Access Code doesn't appear anywhere in the email that the recipient receives. 此请求导致收件人必须先输入访问代码,然后他才能访问信封,但是addAccessCodeToEmail属性没有达到预期的效果,因为访问代码不会出现在收件人接收的电子邮件中的任何位置。

Alternative Approach (Best Practice) : Instead of adding the plain-text access code to the email, best practice when using the API to create/send an Envelope and require Access Code as the form of recipient authentication would be to do the following: 替代方法(最佳实践) :与使用纯文本访问代码添加到电子邮件不同,使用API​​创建/发送信封并要求访问代码作为收件人身份验证形式的最佳实践是:

  • Programmatically set accessCode using a piece of data that your application knows about the recipient. 使用您的应用程序知道的有关接收者的数据,以编程方式设置accessCode
  • Set the "Email Blurb" (ie, body of the email) to provide a hint as to the Access Code. 设置“电子邮件模糊”(即电子邮件正文)以提供有关访问代码的提示。

For example, let's say your application knows the Recipient's social security number. 例如,假设您的应用程序知道收件人的社会保险号。 When you make the "Create Envelope" API request: 发出“创建信封” API请求时:

  • Set the value of accessCode to the last 4 digits of the Recipient's SSN. accessCode的值设置为收件人的SSN的最后4位数字。
  • Set the value of emailBlurb to include the messaging "Your access code is the last 4 digits of your SSN." 设置emailBlurb的值以包括消息“您的访问代码是SSN的后4位”。

Doing things this way is much more secure than simply including the Access Code (in plain text) in the Email itself. 与仅在电子邮件本身中包括访问码(以纯文本格式)相比,以这种方式进行操作要安全得多。

Finally, regarding your question about overriding the email subject & body for recipients -- see definition of emailNotification property on page 290-291 of the REST API guide ( http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf ): 最后,关于覆盖收件人的电子邮件主题和正文的问题-请参阅REST API指南第290-291页的emailNotification属性的定义( http://www.docusign.com/sites/default/files/REST_API_Guide_v2。 pdf ):

  • IMPORTANT: If this is enabled for one recipient, it overrides the Envelope Subject and EmailBlurb. 重要说明:如果为一个收件人启用了此功能,它将覆盖信封主题和EmailBlurb。 Also, you must enable emailNotification for all recipients . 另外,您必须为所有收件人启用emailNotification

Sounds like you need to set emailNotification for each and every recipient if you want it to have any effect. 听起来好像您需要为每个收件人设置emailNotification,以使其生效。

Here are a couple of examples that use "Composite Templates" in the Create Envelope API request to create an envelope with either ID Check or Phone Authentication as the method of recipient authentication. 这里有几个示例,这些示例在Create Envelope API请求中使用“复合模板”来创建具有ID检查或电话身份验证的信封作为收件人身份验证的方法。

Recipient Authentication = ID Check 收件人身份验证= ID检查

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
  "emailSubject": "Please sign",
  "emailBlurb": "Please sign...thanks!",
  "status": "sent",
  "compositeTemplates": [
  {
    "serverTemplates": [
    {
        "sequence" : 1,
        "templateId": "TEMPLATE_ID"
    }],
    "inlineTemplates": [
    {
        "sequence" : 2,
        "recipients": {
            "signers" : [{
                "email": "SallysEmail@outlook.com",
                "name": "Sally Adamson",
                "recipientId": "1",
                "roleName": "ROLE_NAME",
                "requireIdLookup": "true",
                "idCheckConfigurationName": "ID Check $"
            }]
        }
    }]
  }]  
}

Recipient Authentication = Phone Auth 收件人身份验证=电话身份验证

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
  "emailSubject": "Please sign",
  "emailBlurb": "Please sign...thanks!",
  "status": "sent",
  "compositeTemplates": [
  {
    "serverTemplates": [
    {
        "sequence" : 1,
        "templateId": "TEMPLATE_ID"
    }],
    "inlineTemplates": [
    {
        "sequence" : 2,
        "recipients": {
            "signers" : [{
                "email": "SallysEmail@outlook.com",
                "name": "Sally Adamson",
                "recipientId": "1",
                "roleName": "ROLE_NAME",
                "requireIdLookup": "true",
                "idCheckConfigurationName": "Phone Auth $",
              "phoneAuthentication": {
                "recipMayProvideNumber": "false",
                "senderProvidedNumbers": ["206-444-5555"]
              }
            }]
        }
    }]
  }]  
}

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

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