I'm following the recipe that can be found here:
But I found that despite the envelope is shown as sent on the docusign inbox, the recipients won't receive it, here's the code...
const tabs = getTabsMethodWorkingForStandaloneTemplates({
name: "name",
email: "name@email.com"
});
// Create a signer recipient for the signer role of the server template
let signer1 = docusign.Signer.constructFromObject({
email: args.signerEmail,
name: args.signerName,
roleName: "signer",
recipientId: "1",
// Adding clientUserId transforms the template recipient
// into an embedded recipient:
clientUserId: args.signerClientId,
tabs
});
// Recipients object:
let recipientsServerTemplate = docusign.Recipients.constructFromObject({
signers: [signer1],
});
// create a composite template for the Server Template
let compTemplate1 = docusign.CompositeTemplate.constructFromObject({
compositeTemplateId: "1",
serverTemplates: [
docusign.ServerTemplate.constructFromObject({
sequence: 1,
templateId: args.templateId
})
],
// Add the roles via an inlineTemplate
inlineTemplates: [
docusign.InlineTemplate.constructFromObject({
sequence: 1,
recipients: recipientsServerTemplate
})
]
});
//const compTemplate2 = getCompositeTemplateFromHTML(args);
const eventNotification = new docusign.EventNotification();
eventNotification.url = 'http://pj.pagekite.me';
eventNotification.includeDocuments = true;
eventNotification.loggingEnabled = true;
eventNotification.envelopeEvents = getEnvelopeEvents();
// create the envelope definition
let env = docusign.EnvelopeDefinition.constructFromObject({
status: "sent",
compositeTemplates: [
compTemplate1,
// compTemplate2
],
eventNotification
});
try {
// Step 2. call Envelopes::create API method
// Exceptions will be caught by the calling function
let results = await envelopesApi.createEnvelope(
args.accountId,
{envelopeDefinition: env}
);
let envelopeId = results.envelopeId;
console.log(`Envelope was created. EnvelopeId ${envelopeId}`);
} catch (e) {
debugger
}
You have clientUserId
in there. That means embedded signing. Remove that and an email will be sent for remote signing. These two are mutual exclusive. Can't have them both.