簡體   English   中英

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

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

我正在通過使用下面的代碼更新收件人來更改特定信封的簽名者

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

以上代碼返回有效電子郵件或錯誤電子郵件的相同狀態。 如果我提供的郵件無效,則已發送郵件中信封的狀態將變為“失敗”,如下圖所示 在此輸入圖像描述 如果我們登錄Docusign,我們可以選擇更正收件人詳細信息。

是否可以使用其余API獲取故障狀態信封並更新收件人電子郵件。

我想我們可以獲得失敗信封,並使用有效的收件人電子郵件更新收件人

如果收件人的電子郵件地址導致autoresponded電子郵件,Connect會向您發送webhook通知。 我認為這是導致Failure通知的錯誤。

我懷疑一個糟糕的電子郵件地址會立即導致Failure狀態。 相反,DocuSign會嘗試發送到提供的電子郵件地址,如果發送失敗並且電子郵件錯誤返回DocuSign,那么您會看到失敗狀態。

您也可以使用Envelopes :: getEnvelopes :: listStatusEnvelopes :: listStatusChanges查看錯誤

更新 :檢查recipient狀態以查看是否有任何收件人具有autoresponded狀態。

由於異步檢測到電子郵件尋址錯誤,因此Connect(或特定信封的eventNotification)是最佳方法。 否則,您需要輪詢狀態更改。

我們有一個自動化的工作,可以檢查退回的電子郵件。 以下是使用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