2017-04-07 29 views
1

我正嘗試使用createEnvelope類使用docusign-node-client發送信封。該類向/ envelopes端點發送REST API請求。我試圖發送的信封包含一個複合模板。將複合模板發送到Docusign API時出錯

這裏是我嘗試發送到的DocuSign

{ 
    "emailSubject": "Sent from Node SDK", 
    "emailBlurb": "Email body here", 
    "customFields": { 
    "textCustomFields": [ 
     { 
     "name": "DSFSSourceObjectId", 
     "required": false, 
     "show": false, 
     "value": "dealIdHere" 
     } 
    ] 
    }, 
    "compositeTemplates": [ 
    { 
     "inlineTemplates": [ 
     { 
      "sequence": "1", 
      "documents": [ 
      { 
       "documentBase64": "base64StringHere", 
       "documentId": "1", 
       "fileExtension": ".pdf", 
       "name": "filename.pdf" 
      } 
      ], 
      "envelope": { 
      "emailBlurb": "Email body here", 
      "emailSubject": "Sent from Node SDK", 
      "customFields": { 
       "textCustomFields": [ 
       { 
        "name": "DSFSSourceObjectId", 
        "required": false, 
        "show": false, 
        "value": "dealIdHere" 
       } 
       ] 
      }, 
      "recipients": { 
       "signers": [ 
       { 
        "email": "[email protected]", 
        "name": "My Name", 
        "recipientId": "1" 
       } 
       ] 
      } 
      } 
     } 
     ], 
     "serverTemplates": [ 
     { 
      "sequence": "1" 
     } 
     ] 
    } 
    ], 
    "status": "sent" 
} 

當我把這個身體,我得到以下錯誤的身體:「包含指定\至少一個無效的參數值無效」請求templateId \」複合模板序列:1"

如果我刪除serverTemplates陣列,我得到這個錯誤:「信封是不完整的完整的包膜需要的文檔,收件人,標籤和主題行。 「

如果我在serverTemplate對象中包含有效的templateId,它會成功創建一個信封。

我正在轉換爲Node的應用程序使用了Docusign SOAP API,並且能夠使用1到多個文檔發送複合模板。每個文檔都可以關聯到他們自己的文檔模板或沒有docusign模板。

沒有對模板ID的某種引用,docusign是否接受複合模板?

回答

3

您正在錯誤地指定inlineTemplate.envelope屬性。您可以直接在inlineTemplate中定義收件人和自定義字段。您不必在inlineTemplate中指定emailSubject/emailBlurb。

另請注意,在使用複合模板時,在根級別指定的自定義字段將被忽略。看到這個answer

下面的json應該爲你工作。

{ 
    "emailSubject": "Sent from Node SDK", 
    "emailBlurb": "Email body here", 
    "status": "sent" 
    "compositeTemplates": [ 
     { 
      "inlineTemplates": [ 
       { 
        "sequence": "1", 
        "documents": [ 
         { 
          "documentBase64": "base64StringHere", 
          "documentId": "1", 
          "fileExtension": ".pdf", 
          "name": "filename.pdf" 
         } 
        ], 

        "customFields": { 
         "textCustomFields": [ 
          { 
           "name": "DSFSSourceObjectId", 
           "required": false, 
           "show": false, 
           "value": "dealIdHere" 
          } 
         ] 
        }, 
        "recipients": { 
         "signers": [ 
          { 
           "email": "[email protected]", 
           "name": "My Name", 
           "recipientId": "1" 
          } 
         ] 
        } 

       } 
      ] 
     } 
    ] 
} 
+1

它的工作原理!感謝不僅解決了我的問題,而且還爲我提供了額外的有用信息,有助於避免將來更多的麻煩。我會給你一個+1,但我還沒有名聲。但是,我確實將您的答案標記爲正確。 –

相關問題