简体   繁体   English

使用Rest api在Docusign中更正信封的接收者

[英]Correct Recipient for envelope in Docusign using Rest api

I am changing the signer for a Specific Envelope by updating the recipient's using below code which was working fine 我正在通过使用下面的代码更新收件人来更改特定信封的签名者

 EnvelopesApi envelopeApi = new EnvelopesApi();
                                var options = new EnvelopesApi.UpdateRecipientsOptions()
                                {
                                    resendEnvelope = "true",
                                    //offlineSigning="true"
                                };
                                Signer signerobj = new Signer
                                {
                                    Email = handoverOwnerEmail,
                                    Name = handoverOwnerName,
                                    RecipientId = "1",
                                    RoutingOrder = "1",

                                };
                                CarbonCopy carbonCopyobj = new CarbonCopy
                                {
                                    RecipientId = removesigner.recipientId,
                                    Name = removesigner.name,
                                    Email = removesigner.email,
                                };
                                Recipients objrecipients = new Recipients
                                {
                                    Signers = new List<Signer>() { signerobj },
                                    CarbonCopies = new List<CarbonCopy> { carbonCopyobj }
                                };
                                RecipientsUpdateSummary result1 = envelopeApi.UpdateRecipients(accoutnId, folderitem.envelopeId, objrecipients, options);

The above code return the same status for both valid email or wrong email. 以上代码返回有效电子邮件或错误电子邮件的相同状态。 If i provide invalid email the status of the envelope in the sent items becomes Failure as show in the below image 如果我提供的邮件无效,则已发送邮件中信封的状态将变为“失败”,如下图所示 在此输入图像描述 . If we login to Docusign we had a option to correct the recipient details. 如果我们登录Docusign,我们可以选择更正收件人详细信息。

Is it possible to get the failure status envelopes and update the recipient email using the rest API. 是否可以使用其余API获取故障状态信封并更新收件人电子邮件。

I am thinking of that we can get the failure envelopes and will update the recipient's with valid recipient emails 我想我们可以获得失败信封,并使用有效的收件人电子邮件更新收件人

Connect can send you a webhook notification if a recipient's email address results in an autoresponded email. 如果收件人的电子邮件地址导致autoresponded电子邮件,Connect会向您发送webhook通知。 I think that is the error that results in the Failure notification. 我认为这是导致Failure通知的错误。

I doubt that a bad email address instantly results in the Failure status. 我怀疑一个糟糕的电子邮件地址会立即导致Failure状态。 Instead, DocuSign attempts to send to the provided email address and if the send fails with an email error back to DocuSign, then you see the Failure status. 相反,DocuSign会尝试发送到提供的电子邮件地址,如果发送失败并且电子邮件错误返回DocuSign,那么您会看到失败状态。

You may also be able to see the errors by using Envelopes::get , Envelopes::listStatus , or Envelopes::listStatusChanges 您也可以使用Envelopes :: getEnvelopes :: listStatusEnvelopes :: listStatusChanges查看错误

Update : check the recipient statuses to see if any of the recipients has the autoresponded status. 更新 :检查recipient状态以查看是否有任何收件人具有autoresponded状态。

Since email addressing errors are detected asynchronously, Connect (or eventNotification for a specific envelope) is the best way to go. 由于异步检测到电子邮件寻址错误,因此Connect(或特定信封的eventNotification)是最佳方法。 Otherwise you'll need to poll for status changes. 否则,您需要轮询状态更改。

We have an automated job that checks for bounced emails. 我们有一个自动化的工作,可以检查退回的电子邮件。 Here is the code using XML: 以下是使用XML的代码:

  strURL = DocuSign_Get_AcctInfo
  If strURL = "" Then
    GoTo Exit_StdExit
  End If

  strURLGetSent = strURL & "/envelopes?from_date=" & strFromDate & "&status=sent"

  Set XDoc = CreateObject("MSXML2.DOMDocument.6.0")
  XDoc.SetProperty "SelectionLanguage", "XPath"
  XDoc.SetProperty "SelectionNamespaces", "xmlns:r='http://www.docusign.com/restapi' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'"
  XDoc.async = False
  XDoc.validateOnParse = True

  With DocEnv
    .Open "GET", strURLGetSent, False
    .setRequestHeader "Content-Type", "application/xml"
    .setRequestHeader "Accept", "application/xml"
    .setRequestHeader "X-DocuSign-Authentication", "<DocuSignCredentials><Username>" + strUsrNm + "</Username><Password>" + strPssWrd + "</Password><IntegratorKey>" + strKey + "</IntegratorKey></DocuSignCredentials>"
    .Send
    XDoc.LoadXML (PrettyPrintXml(.responseText))
  End With
'  XDoc.Save ("U:\data\DocuSign\notsigned.xml")

  If XDoc.parseError <> 0 Then
    MsgBox "Invalid XML!" & vbCrLf & vbCrLf & XDoc.parseError.reason
    GoTo Exit_StdExit
  End If

  lngRcrdCnt = XDoc.SelectSingleNode("//r:resultSetSize").Text
  If lngRcrdCnt = 0 Then
    Email_Bounced = True  'query worked but returned no records
    GoTo Exit_StdExit
  End If
  ReDim AcctID(lngRcrdCnt - 1)
  lngIdx = 0
  'loop through the collection of nodes to capture the envelopeID
  Set XNodes = XDoc.SelectNodes("//r:*")
  For Each XNode In XNodes
    If XNode.nodeName = "envelopeID" Then
      AcctID(lngIdx) = XNode.Text
      lngIdx = lngIdx + 1
    End If
  Next XNode

  For lngIdx = 0 To lngRcrdCnt - 1
    strURLGetBounce = strURL & "/envelopes/" & AcctID(lngIdx) & "/recipients"
    Set responseDoc = CreateObject("MSXML2.DOMDocument.6.0")
    responseDoc.SetProperty "SelectionLanguage", "XPath"
    responseDoc.SetProperty "SelectionNamespaces", "xmlns:r='http://www.docusign.com/restapi' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'"
    responseDoc.async = False
    responseDoc.validateOnParse = True
    With DocRecip
      .Open "GET", strURLGetBounce, False
      .setRequestHeader "Content-Type", "application/xml"
      .setRequestHeader "Accept", "application/xml"
      .setRequestHeader "X-DocuSign-Authentication", "<DocuSignCredentials><Username>" + strUsrNm + "</Username><Password>" + strPssWrd + "</Password><IntegratorKey>" + strKey + "</IntegratorKey></DocuSignCredentials>"
      .Send
      responseDoc.LoadXML (PrettyPrintXml(.responseText))
    End With

    Set XNodes = responseDoc.SelectNodes("//r:errorCode")
    For Each XNode In XNodes
      MsgBox "The following error has occurred: " & XNode.Text & vbCrLf & vbCrLf & "See file U:\data\DocuSign_PutResponseError.xml" & " for more info"
      GoTo Exit_StdExit
    Next XNode

    If responseDoc.SelectSingleNode("//r:status").Text = "autoresponded" Then
    'this call sets the values for lngPrsnID, lngFctyApptAID
      Call DocuSign_Get_CustomFlds(strURL & "/envelopes/" & AcctID(lngIdx) & "/custom_Fields", lngPrsnID, lngFctyApptAID)
      strEmail = responseDoc.SelectSingleNode("//r:email").Text
      modConnection.OpenADODBConnection.Execute ("insert into _FctyLtrsEmlBounce(lngPrsnID, lngFctyApptAID, strEmlDocuSign) values(" & lngPrsnID & ", " & lngFctyApptAID & ", '" & strEmail & "')")
    End If
  Next lngIdx
''''

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

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