DocuSign Node.js SDK: Error: RECIPIENTS_NOT_PROVIDED - docusignapi

We are using the Node.js DoucSign SDK to send out docs for signatures. Currently, we are getting the RECIPIENTS_NOT_PROVIDED error when we try to send it via our CRM. Our CRM calls our API when a a status is changed which should send the docs. In our Graphql API Playground we are able to successfully create and send the envelope with no issue. I am sure I am missing something but I just can't see it. Any help would be greatly appreciated!
let signer1 = docusign.TemplateRole.constructFromObject({
email: args.signorEmail,
name: `${args.signorLegalName}`,
tabs: signerTabs,
roleName: 'signer',
recipientId: '1'
});
let cc1 = docusign.TemplateRole.constructFromObject({
email: !!args.ccEmail,
name: !!args.ccName,
tabs: ccTabs,
roleName: 'signer',
recipientId: '2'
});
// Add the TemplateRole objects to the envelope object
env.templateRoles = [signer1, cc1];
env.status = 'sent';
Here is our successful template roles via our playground:
"[{"email":"signorEmail",
"name":"Jane Doe",
"roleName":"signer",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_1}}"}],
"textTabs":[Removed Tabs]}},
{"email": "ccEmail",
"name":"John Smith",
"roleName":"cc",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_2}}"}],"textTabs":[removed Tabs]
}}]"
Unsuccessful:
"[{"email": "signorEmail",
"name":"Test 1",
"roleName":"signer",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_1}}"}],
"textTabs":[Removed Tabs]}},
{"email": "ccEmail",
"name":"John Smith",
"roleName":"cc",
"tabs":{"signHereTabs":[{"anchorString":"{{Signature_2}}"}],"textTabs":[removed Tabs]
}}]"

Well,
First, I see two recipients with the same roleName ('signer') which suggest to me one of them is wrong. RoleNames should be unique inside the same template.
In terms of why the first JSON is ok and the second is not, they seem to be the same except that the second is not valid JSON at all. Just use any JSON validator and check out some missing brackets etc.

Related

Docusign. Not able to sign a doc with createRecipientView method url

I'm trying to create an envelope. My flow is next:
Obtaining OAuth token
Creating envelope based on existing template
Using createRecipientView method to get redirect url for the first signer(Later I'm taking the existing envelope id and creating redirect url for the second signer)
The problem:
It works as I expect if only signer's email address belongs to my docusign developer account. In other words if it is in the list of my docusign dev account users. Otherwise, with any random email address, I'm being redirected to the document page but I'm only able to view it and close, there's no start->sign->finish button(I'm not able to sign a doc).
One thing I've noticed is the wrong recipientId which is equal to zeros and dashes(normally it has a set of numbers and letters). I find it at a signing page -> other actions -> Session Information. It's hapenning when I'm being redirected as a user with any email(one that does not belong to docusign account). BUT, every signer receives an email notification with the same link to the document and If I go from that link, I can sign a document no matter what email address it is.
Session information with the wrong recipientId
My code:
const client = new docusign.ApiClient()
client.setBasePath('https://demo.docusign.net/restapi')
client.setOAuthBasePath('account-d.docusign.com')
const tokenResponse = await client.requestJWTUserToken(userId, integrationKey, ['impersonation', 'signature'], privateKey, 600)
client.addDefaultHeader('Authorization', `Bearer ` + tokenResponse.body.access_token)
const envelopesApi = await new docusign.EnvelopesApi(client)
const envelope = await envelopesApi.createEnvelope(accountId, {
envelopeDefinition: {
templateId: templateId,
status: 'sent',
emailSubject: `Signing template ID: ${templateId}`,
templateRoles: [
{ roleName: args.firstRole, name: args.firstSignerName, email: args.firstSignerEmail },
{ roleName: args.secondRole, name: args.secondSignerName, email: args.secondSignerEmail },
],
}
})
const recipientView = await envelopesApi.createRecipientView(accountId, envelope.envelopeId, {
recipientViewRequest: {
returnUrl: my local host,
email: args.firstSignerEmail,
userName: args.firstSignerName,
authenticationMethod: 'none',
},
})
return recipientView
Please, let me know If you know what I'm doing wrong.
I read docusign docs and thought I'm missing some permission, but so far can't figure out what's the problem
I could be wrong but based on your description, you haven't set up a clientUserId parameter for your recipients. Recipient Views are created for embedded signers wherein you embed the signing session into your own application. As embedded recipients are a special class of recipients associated only with the sender's account, this could explain why your recipient view works for users already part of your account but does not work for anyone else.

How can I pause a docusign envelope created from template?

I am creating an envelope from a template (which I have created using Docusign website UI) with a second signer which the envelope will be emailed to after the first signer is finished, but I want to be able to pause and unpause this through the API. The process works as designed without the added workflow_step, but returns an error with the workflow_step added.
envelope_definition = DocuSign_eSign::EnvelopeDefinition.new({
status: 'sent',
templateId: template_id
})
signer1 = DocuSign_eSign::TemplateRole.new({
email: signer1_email,
name: signer1_name,
roleName: 'signer1',
clientUserId: signer_client_id,
recipientId: 1,
routingOrder: 1
})
signer2 = DocuSign_eSign::TemplateRole.new({
email: signer2_email,
name: signer2_name,
roleName: 'signer2',
recipientId: 2,
routingOrder: 2
})
envelope_definition.template_roles = [signer1, signer2]
workflow_step = DocuSign_eSign::WorkflowStep.new(
action: 'pause_before',
triggerOnItem: 'routing_order',
itemId: 2
)
workflow = DocuSign_eSign::Workflow.new(workflowSteps: [workflow_step])
envelope_definition.workflow = workflow
Any idea what I am doing wrong?
If you can't add workflow steps to an envelope created from a template, can I add it to the template somehow?
Unfortunately this is a bug. Please ask your DocuSign support contact to add your company's information to internal bug report ARR-586.
Workaround
This workaround was reported to work:
Create an envelope that uses the template and set the template roles. But set the status to created. This will create a draft envelope.
Use the EnvelopeWorkflows:update API method to add the workflow.
{
"workflowSteps": [
{
"action": "pause_before",
"triggerOnItem": "routing_order",
"itemId": 2
}
]
}
Use the Envelopes:update method to change the status to sent
Please add a comment to this answer if this technique worked for you.

DocuSign - Email Notification after Signing with attached document?

How do I change the following code to get email notifications and send signed copy via email?
let customer = {
email: app.application.email,
// clientUserId: app.application.email, // added when they request embedded signing
name: "name",
roleName: 'customer',
tabs: tabs,
// recipientId: '1',
// routingOrder: '1'
}
if (payload.customerSignMethod == 'Embed') {
customer.clientUserId = app.application.email;
}
signers.push(
docusign.TemplateRole.constructFromObject(customer)
);
envelope.templateRoles = signers;
envelope.status = "sent";
the commented line is the key:
// clientUserId: 'cvbcvb#cvbcvb.com', // added when they request embedded signing
The way you had it, it should send email out to recipients, for remote signing.
If you put this line back in - it won't as it will be used for embedded signing.
If you have it commented, and still don't see the email, there's another issue.
Did you change the envelope status to "sent"? that should be done to actually send it.

Stripe warning - Unrecognized token creation parameter

I'm just starting with stripe, and I noticed I get a warning in chrome saying:
Unrecognized token creation parameter parameter: company is not a
recognized parameter. This may cause issues with your integration in
the future.
This is the code.
stripe.createToken("account", {
company: {
name: "bbb",
address: {
line1: "77",
city: "abc",
state: "aa",
postal_code: "e2e"
}
},
tos_shown_and_accepted: true
}).then(function(result) {
debugger;
console.log(result);
});
I'm pretty much following the docs here (step 2)
https://stripe.com/docs/connect/account-tokens
It creates a token OK though.
The docs in the API reference suggest company is an object it should know:
https://stripe.com/docs/api/tokens/create_account
It basically tells you what is wrong.
It says that company is not a parameter that is recognized by that stripe endpoint. It creates the token, but ignores your passed parameter

I'm trying to make sense of session, but cannot get any data out of it

Currently using LUIS in a bot that connects to Slack. Right now I'm using interactive messages and trying to respond to user input correctly. When I click an item from the drop down LUIS receives it as a message. I can get the text with session.message.text, however I need to get the callback_id of the attachment as well as the channel it was sent from.
I've used console.log(session) to get an idea of what session looks like. From there I've seen that session.message.sourceEvent contains the data I need, however I can't use indexOf() or contains() to actual extrapolate the data. I've also tried session.message.sourceEvent.Payload but end up getting "[object [Object]]". I've tried searching for documentation on session formatting but to no avail.
Below is a snippet of what is returned when I run console.log(session.message.sourceEvent).
{ Payload:
action_ts: '1513199773.200354',
is_app_unfurl: false,
subtype: 'bot_message',
team: { id: 'T03QR2PHH', domain: 'americanairlines' },
user: { id: 'U6DT58F2T', name: 'john.cerreta' },
message_ts: '1513199760.000073',
attachment_id: '1',
ts: '1513199760.000073' },
actions: [ [Object] ],
callback_id: 'map_selection1',
original_message:
username: 'Rallybot',
response_url: 'https://hooks.slack.com/actions/T03QR2PHH/287444348935/Y6Yye3ijlC6xfmn8qjMK4ttB',
type: 'message',
{ type: 'interactive_message',
channel: { id: 'G6NN0DT88', name: 'privategroup' },
token: 'removed for security',
{ text: 'Please choose the Rally and Slack team you would like to map below.',
bot_id: 'B7WDX03UM',
attachments: [Array],
trigger_id: '285857445393.3841091595.085028141d2b8190b38f1bf0ca47dd88' },
ApiToken: 'removed for security' }
session.message.sourceEvent is a javascript Object, however indexOf or contains are functions of String or Array types.
Any info you required in the object, you should direct use the code <object>.<key> to invoke that value. You can try session.message.sourceEvent.Payload.action_ts for example.
Also, you can use Object.keys(session.message.sourceEvent) to get all the keys in this object.

Resources