我创建了1个带有嵌入式签名的2个复合模板的信封,我可以将其与webhook事件通知挂钩,以便在用户完成签名后收到消息,这样我就可以尝试更新我的数据库并下载文件。但是,webhook响应没有我需要的自定义字段来识别哪个文件属于我更新db行的文件。
这是我的json序列化信封示例。请注意每个内联模板上的自定义字段,它具有DocuInfoId的属性。我需要更新我的数据库行的值
{
"status": "sent",
"emailSubject": "DocuSign API - Template Example",
"eventNotification": {
"url": "https:\/\/mytestsite.net\/api\/documentstuff\/docusign\/available",
"loggingEnabled": "false",
"requireAcknowledgment": "true",
"useSoapInterface": "false",
"soapNameSpace": "",
"includeCertificateWithSoap": "false",
"signMessageWithX509Cert": "false",
"includeDocuments": "false",
"includeEnvelopeVoidReason": "false",
"includeTimeZone": "true",
"includeSenderAccountAsCustomField": "false",
"includeDocumentFields": "false",
"includeCertificateOfCompletion": "true",
"envelopeEvents": [
{
"envelopeEventStatusCode": "Sent",
"includeDocuments": null
},
{
"envelopeEventStatusCode": "Completed",
"includeDocuments": "true"
}
],
"recipientEvents": [
{
"recipientEventStatusCode": "Completed",
"includeDocuments": "true"
}
]
},
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"clientUserId": "1",
"recipientId": "1",
"email": "testemail@test.com",
"name": "Client Name",
"roleName": "Client",
"tabs": {
"TextTabs": "Just a bunch of text tabs, radio group, etc"
}
},
{
"clientUserId": "2",
"recipientId": "2",
"email": "testemail@test.com",
"name": "Owner Name",
"roleName": "Owner",
"tabs": null
}
]
},
"customFields": {
"ListCustomFields": [
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "77",
"listItems": null
},
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "1",
"listItems": null
}
]
}
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "TemplateIDNumber1"
}
]
},
{
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"clientUserId": "1",
"recipientId": "1",
"email": "testemail@test.com",
"name": "Client Name",
"roleName": "Client",
"tabs": {
"TextTabs": "Just another bunch of text tabs, radio group tab, etc"
}
}
]
},
"customFields": {
"ListCustomFields": [
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "88",
"listItems": null
},
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "1",
"listItems": null
}
]
}
}
],
"serverTemplates": [
{
"sequence": "2",
"templateId": "TemplateIDNumber2"
}
]
}
]
}
一旦我完成签名,就会触发webhook事件通知并通过此响应消息调用我的api
{
"EnvelopeStatus": {
"EnvelopeID": "EnvelopeIDGivenByDocusign",
"Status": "Completed",
"CustomFields": [
{
"Name": "ContactID",
"Show": "True",
"Required": "False",
"Value": ""
},
{
"Name": "OpportunityID",
"Show": "True",
"Required": "False",
"Value": ""
},
{
"Name": "AccountID",
"Show": "True",
"Required": "False",
"Value": ""
},
{
"Name": "DocuInfoId",
"Show": "False",
"Required": "True",
"Value": "88"
},
{
"Name": "OpportunityId",
"Show": "False",
"Required": "True",
"Value": "1"
},
{
"Name": "LQAID",
"Show": "True",
"Required": "False",
"Value": ""
}
],
"DocumentStatuses": [
{
"ID": 1,
"Name": "Document - TX - 1001.pdf",
"TemplateName": "Document - TX",
"Sequence": 1
},
{
"ID": 2,
"Name": "Rejection.pdf",
"TemplateName": "Rejection Form",
"Sequence": 2
}
]
},
"DocumentPDFs": [
{
"Name": "Document - TX - 1001.pdf",
"DocumentID": "1",
"DocumentType": "CONTENT"
},
{
"Name": "Rejection.pdf",
"DocumentID": "2",
"DocumentType": "CONTENT"
},
{
"Name": "CertificateOfCompletion_78sd89fuas89sadf.pdf",
"DocumentID": null,
"DocumentType": "SUMMARY"
}
]
}
查看回复时,只有1个文档的值为88,我也不确定其他自定义字段来自何处:" LQAID"。现在,我不确定它属于哪个版本,第一个pdf文件(Document - TX - 1001.pdf)或第二个pdf文件(Rejection.pdf)。
无论如何知道哪个pdf文档属于哪个documentinfoid,以便我可以正确地将它附加到我的数据库中?
答案 0 :(得分:1)
您可以为每个CompositeTemplate设置compositeTemplateId,然后在每个信封Custom Field中使用此Id。我已修改您的JSON请求以包含CompositeTemplateId,
{
"status": "sent",
"emailSubject": "DocuSign API - Template Example",
"eventNotification": {
"url": "https:\/\/mytestsite.net\/api\/documentstuff\/docusign\/available",
"loggingEnabled": "false",
"requireAcknowledgment": "true",
"useSoapInterface": "false",
"soapNameSpace": "",
"includeCertificateWithSoap": "false",
"signMessageWithX509Cert": "false",
"includeDocuments": "false",
"includeEnvelopeVoidReason": "false",
"includeTimeZone": "true",
"includeSenderAccountAsCustomField": "false",
"includeDocumentFields": "false",
"includeCertificateOfCompletion": "true",
"envelopeEvents": [
{
"envelopeEventStatusCode": "Sent",
"includeDocuments": null
},
{
"envelopeEventStatusCode": "Completed",
"includeDocuments": "true"
}
],
"recipientEvents": [
{
"recipientEventStatusCode": "Completed",
"includeDocuments": "true"
}
]
},
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"clientUserId": "1",
"recipientId": "1",
"email": "testemail@test.com",
"name": "Client Name",
"roleName": "Client",
"tabs": {
"TextTabs": "Just a bunch of text tabs, radio group, etc"
}
},
{
"clientUserId": "2",
"recipientId": "2",
"email": "testemail@test.com",
"name": "Owner Name",
"roleName": "Owner",
"tabs": null
}
]
},
"customFields": {
"ListCustomFields": [
{
"name": "DocuInfoId_1",
"required": "True",
"show": "False",
"value": "77",
"listItems": null
},
{
"name": "OpportunityId_1",
"required": "True",
"show": "False",
"value": "1",
"listItems": null
}
]
}
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "TemplateIDNumber1"
}
]
},
{
"compositeTemplateId": "2",
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"clientUserId": "1",
"recipientId": "1",
"email": "testemail@test.com",
"name": "Client Name",
"roleName": "Client",
"tabs": {
"TextTabs": "Just another bunch of text tabs, radio group tab, etc"
}
}
]
},
"customFields": {
"ListCustomFields": [
{
"name": "DocuInfoId_2",
"required": "True",
"show": "False",
"value": "88",
"listItems": null
},
{
"name": "OpportunityId_2",
"required": "True",
"show": "False",
"value": "1",
"listItems": null
}
]
}
}
],
"serverTemplates": [
{
"sequence": "2",
"templateId": "TemplateIDNumber2"
}
]
}
]
}
现在,当您收到WebHook响应时,您将能够知道下面哪个复合模板的自定义字段。我还有一个建议,因为您没有使用任何下拉菜单,所以最好使用TextCustomFields
代替ListCustomFields
。
答案 1 :(得分:0)
在DocuSign中有不同类型的自定义字段。
要确定创建信封请求的设置类型,您可以对信封/文档执行以下请求并评估结果:
获取信封自定义字段
GET /v2/accounts/{accountId}/envelopes/{envelopeId}/custom_fields
获取文档自定义字段
GET /v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields
我怀疑您的创建信封请求可能正在设置 信封 自定义字段 - 这会将元数据与信封关联为整体,而不是信封中的任何特定文件。
根据您所描述的内容,您似乎想要为信封中的特定文档指定元数据。如果是这种情况,您需要修改创建信封请求的结构/内容,以设置 文档 自定义字段(而不是设置 信封 自定义字段)。
答案 2 :(得分:0)
不使用XML的.firstOrder {
order: <First-Item>
}
部分中的值,而是使用CustomFields
元素中包含的值。
您需要进行更多解析,但它会为您提供所有上下文信息。