我如何为多个收件人使用相同的模板?
How do i use the same template for multiple recipients?
我按照 docusign 开发中心的 "recipe" 从我上传的 pdf 模板发送文档。它有效,但它是一个工作流程,每个收件人都可以在同一文档上添加(and/or 签名)。
我需要能够从同一模板生成收件人列表的文档,并让他们全部签名。我认为最好的方法是以编程方式为每个收件人生成模板,使用我通过代码提取的数据集填写他们的姓名和地址信息,然后将其发送给每个收件人进行签名。这是我使用的示例代码:
string username = conf.ConfigurationManager.AppSettings["username"];
string password = conf.ConfigurationManager.AppSettings["password"];
string integratorKey = conf.ConfigurationManager.AppSettings["integratorKey"];
// initialize client for desired environment (for production change to www)
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
Configuration.Default.ApiClient = apiClient;
string username = conf.ConfigurationManager.AppSettings["username"];
string password = conf.ConfigurationManager.AppSettings["password"];
string integratorKey = conf.ConfigurationManager.AppSettings["integratorKey"];
// initialize client for desired environment (for production change to www)
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
Configuration.Default.ApiClient = apiClient;
// configure 'X-DocuSign-Authentication' header
string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}";
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
// we will retrieve this from the login API call
string accountId = null;
/////////////////////////////////////////////////////////////////
// STEP 1: LOGIN API
/////////////////////////////////////////////////////////////////
// login call is available in the authentication api
AuthenticationApi authApi = new AuthenticationApi();
LoginInformation loginInfo = authApi.Login();
// parse the first account ID that is returned (user might belong to multiple accounts)
accountId = loginInfo.LoginAccounts[0].AccountId;
var baseUrl = loginInfo.LoginAccounts[0].BaseUrl;
// Update ApiClient with the new base url from login call
apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl);
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[TEMPLATE NAME]";
// provide a valid template ID from a template in your account
envDef.TemplateId = "[TEMPLATE ID]";
var rolesList = new List<TemplateRole>();
// assign recipient to template role by setting name, email, and role name. Note that the
// template role name must match the placeholder role name saved in your account template.
TemplateRole tRole = new TemplateRole();
tRole.Email = "XXX";
tRole.Name = "XXX";
tRole.RoleName = "Test Role";
rolesList.Add(tRole);
envDef.TemplateRoles = rolesList;
envDef.Status = "sent";
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
最初我只是尝试恢复 TemplateRole("trole" 此处),为每个人分配新的电子邮件地址,然后使用信封定义发送每个人,但仍然向每个收件人发送相同的共享文档.
那么,如果我希望每个收件人拥有自己的可签名文档,我是否必须为每个收件人创建一个模板,或者是否有我没有看到的更实用的方法?
我在这里有点困惑,但这是我的 2 美分:
模板基本上是一个 pre-set 带有特定文档、收件人角色、选项卡和其他业务逻辑的信封。这个想法是重复使用相同的 "template" 来生成尽可能多的信封。
一个非常简单的 use-case 可能是我的 open-source 项目贡献者的 NDA 表格:我从 NDA PDF 文档设置模板,将文档上传到 DocuSign,添加占位符标签几个贡献者信息(姓名、电子邮件、日期和签名),以及收件人角色的占位符(我可以称之为贡献者)。一旦我保存了我的模板,我就可以从我的 DocuSign 帐户复制模板 ID,并像你提到的那样在 SDK 中使用它,在一个循环中:
myRecipients.forEach(function(myRecipient) {
var rolesList = new List<TemplateRole>();
TemplateRole tRole = new TemplateRole();
tRole.Email = myRecipient.email;
tRole.Name = myRecipient.name;
tRole.RoleName = "Test Role";
rolesList.Add(tRole);
envDef.TemplateRoles = rolesList;
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
...
});
我按照 docusign 开发中心的 "recipe" 从我上传的 pdf 模板发送文档。它有效,但它是一个工作流程,每个收件人都可以在同一文档上添加(and/or 签名)。
我需要能够从同一模板生成收件人列表的文档,并让他们全部签名。我认为最好的方法是以编程方式为每个收件人生成模板,使用我通过代码提取的数据集填写他们的姓名和地址信息,然后将其发送给每个收件人进行签名。这是我使用的示例代码:
string username = conf.ConfigurationManager.AppSettings["username"];
string password = conf.ConfigurationManager.AppSettings["password"];
string integratorKey = conf.ConfigurationManager.AppSettings["integratorKey"];
// initialize client for desired environment (for production change to www)
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
Configuration.Default.ApiClient = apiClient;
string username = conf.ConfigurationManager.AppSettings["username"];
string password = conf.ConfigurationManager.AppSettings["password"];
string integratorKey = conf.ConfigurationManager.AppSettings["integratorKey"];
// initialize client for desired environment (for production change to www)
ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi");
Configuration.Default.ApiClient = apiClient;
// configure 'X-DocuSign-Authentication' header
string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}";
Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
// we will retrieve this from the login API call
string accountId = null;
/////////////////////////////////////////////////////////////////
// STEP 1: LOGIN API
/////////////////////////////////////////////////////////////////
// login call is available in the authentication api
AuthenticationApi authApi = new AuthenticationApi();
LoginInformation loginInfo = authApi.Login();
// parse the first account ID that is returned (user might belong to multiple accounts)
accountId = loginInfo.LoginAccounts[0].AccountId;
var baseUrl = loginInfo.LoginAccounts[0].BaseUrl;
// Update ApiClient with the new base url from login call
apiClient = new ApiClient(loginInfo.LoginAccounts[0].BaseUrl);
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[TEMPLATE NAME]";
// provide a valid template ID from a template in your account
envDef.TemplateId = "[TEMPLATE ID]";
var rolesList = new List<TemplateRole>();
// assign recipient to template role by setting name, email, and role name. Note that the
// template role name must match the placeholder role name saved in your account template.
TemplateRole tRole = new TemplateRole();
tRole.Email = "XXX";
tRole.Name = "XXX";
tRole.RoleName = "Test Role";
rolesList.Add(tRole);
envDef.TemplateRoles = rolesList;
envDef.Status = "sent";
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
最初我只是尝试恢复 TemplateRole("trole" 此处),为每个人分配新的电子邮件地址,然后使用信封定义发送每个人,但仍然向每个收件人发送相同的共享文档.
那么,如果我希望每个收件人拥有自己的可签名文档,我是否必须为每个收件人创建一个模板,或者是否有我没有看到的更实用的方法?
我在这里有点困惑,但这是我的 2 美分:
模板基本上是一个 pre-set 带有特定文档、收件人角色、选项卡和其他业务逻辑的信封。这个想法是重复使用相同的 "template" 来生成尽可能多的信封。
一个非常简单的 use-case 可能是我的 open-source 项目贡献者的 NDA 表格:我从 NDA PDF 文档设置模板,将文档上传到 DocuSign,添加占位符标签几个贡献者信息(姓名、电子邮件、日期和签名),以及收件人角色的占位符(我可以称之为贡献者)。一旦我保存了我的模板,我就可以从我的 DocuSign 帐户复制模板 ID,并像你提到的那样在 SDK 中使用它,在一个循环中:
myRecipients.forEach(function(myRecipient) {
var rolesList = new List<TemplateRole>();
TemplateRole tRole = new TemplateRole();
tRole.Email = myRecipient.email;
tRole.Name = myRecipient.name;
tRole.RoleName = "Test Role";
rolesList.Add(tRole);
envDef.TemplateRoles = rolesList;
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(accountId, envDef);
...
});