营销团队想要通过 UI 发送信封。
该信封的收件人将访问我们的营销网站,然后签署并查看合同。
因为下面的请求不包含 clientUserId,所以我无法调用 Recipient View API 来获取 URL,然后显示信封/合同。
// call to get recipients
export const getRecipient = async (envelopeId: string) => {
try {
const response = await fetch(
`${process.env.DOCUSIGN_BASE_URI}accounts/${process.env.DOCUSIGN_API_ACCOUNT_ID}/envelopes/${envelopeId}/recipients`,
{
method: "GET",
headers: config().headers,
}
);
const { signers } = await response.json();
return signers;
} catch (error) {
console.error("Error checking envelope status:", error);
throw error;
}
};
// call to create recipient view
export const createRecipientView = async ({
envelopeId,
accountId,
returnUrl,
userName,
userEmail,
clientUserId,
}: RecipientViewRequest): Promise<{ url: string }> => {
const requestData = {
returnUrl,
authenticationMethod: "None",
email: userEmail,
userName,
clientUserId,
};
try {
const response = await fetch(
`${process.env.DOCUSIGN_BASE_URI}accounts/${accountId}/envelopes/${envelopeId}/views/recipient`,
{
method: "POST",
headers: config().headers,
body: JSON.stringify(requestData),
next: { revalidate: 3600 },
}
);
const { url } = await response.json();
return url;
} catch (error) {
console.error("Error creating recipient view:", error);
throw error;
}
};
我是否遗漏了什么?是否可以通过 DocUSign UI 发送信封,然后通过我的应用程序打开并签署该信封/合同?
您需要首先使用另一个 API 调用修改信封(首先锁定它,这会启动“正确”,然后 PUT 来更新收件人)以添加 clientUserId,然后您可以进行嵌入式签名。
但是,您必须拥有此信封,如果营销团队使用的帐户/用户与您的集成将用于进行身份验证的帐户/用户不同,那么除非他们也与您共享这些信封,否则它将无法工作。