DocuSign API 复合模板服务器模板理解

DocuSign API Composite Template Server Templates Understanding

阅读 (here and here) 并试用复合模板后,我不太确定我是否理解如何在 API 请求中正确使用服务器模板。该文档提到 If supplied they are overlaid into the envelope in the order of their Sequence value 所以我将其解释为它们将合并为一个文档。看起来它们合并在一起,但它产生了我不期望的结果。序列中的第一个是显示的内容,您看不到其他内容。

我想做的是有几个共同点 headers,其中包含我们不同的徽标,并将其与我发送的任何模板相结合。我们不能使用品牌化方法,因为他们希望它作为模板中文档的一部分,据我所知,品牌化无法实现这一点。

以下是我的(已清理)请求。看我的评论。

{
    "brandId": "{{brandId}}",
    "emailSubject": "Testing Subject",
    "status": "SENT",
    "compositeTemplates": [{
            "serverTemplates": [{ // First document
                    "sequence": "1",
                    "templateId": "{{headerTemplateId}}" //Header logo template
                }, {
                    "sequence": "2",
                    "templateId": "{{document1TemplateId}}" // Template with content
                }
            ],
            "inlineTemplates": [{
                    "sequence": "1",
                    "recipients": {
                        "signers": [{
                                "email": "test@test.com",
                                "name": "Leeroy Jenkins",
                                "roleName": "Customer",
                                "recipientId": "1"
                            }
                        ]
                    }
                }
            ]
        }, {
            "serverTemplates": [{ // Second document
                    "sequence": "2",
                    "templateId": "{{document2TemplateId}}"
                }
            ],
            "inlineTemplates": [{
                    "sequence": "2",
                    "recipients": {
                        "signers": [{
                                "email": "test@test.com",
                                "name": "Leeroy Jenkins",
                                "roleName": "Customer",
                                "recipientId": "1",
                                "tabs": {
                                    "textTabs": [{
                                            "tabLabel": "Address",
                                            "value": "123 Test Rd "
                                        }, {
                                            "tabLabel": "CityStateZip",
                                            "value": "Test/XY/12345"
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

正如@Drew 所说,您的直接问题是每个单独的复合模板只能包含零个或一个服务器模板。

回复:如何在复合模板中正确使用服务器模板

每个复合模板 composites 将信封的不同方面组合在一起:

  • 零个或一个模板定义存储在 docusign.com
  • 新定义的收件人、标签、文档等

例如,复合模板可用于创建包含文档“B”的信封,而不是使用 docusign.com 上的模板中包含的文档。

更改文档中的徽标

遗憾的是,DocuSign 合成功能不包括将一个文档中的图像与另一个文档组合以创建新(组合)文档的功能。

一些想法:

  1. 如果只有合同的第一页包含徽标,那么您可以有多个版本的第一页(将每个版本视为一个单独的文档),并将带有徽标的第一页与其他页面结合起来形成一个完整的信封。

    请注意,文档可以短到一页。收件人将一起查看信封中的所有文件。

  2. 使用 PDF 库来操作 PDF 文档本身以更改徽标。现在有许多可用的 PDF 库,具有适用于多种语言和操作系统的 API。

  3. 使用 SAAS PDF 渲染服务将图像与内容结合以获得最终的 PDF。例如,webmerge

  4. 以非 PDF 格式向 DocuSign 发送文档。例如,您可以发送 .docx 文档。如果您使用 Windows 堆栈,您的应用程序创建 Word 文档的自定义徽标版本可能比 PDF 更容易。