Manipulate the document name through Connect - docusignapi

Is it possible to manipulate the document name when it is sent back to us using DocuSign Connect?
We have multiple envelopes with a single document in each envelope however the name of the PDF document getting sent back to us from DocuSign has the same name so it's overwriting the previously saved document. We use the Connect method so we receive an XML file with the document pdf's and other information. I'm trying to use the name of the document that is in the envelope.

You cannot rename the document through DocuSign Connect, however you have complete control over the document name when you are adding it to the envelope. If you're adding through the DocuSign Console then you can just rename the file on disk before uploading. If you're adding through the API, then you control the document name through the name property of the documents section of your request body:
"documents": [
{
"name": "DocumentNameHere.pdf",
"documentId": "1",
"order": "1"
}
]
When adding through the API you can programmatically set the name to whatever you want - for instance you can prompt the user of your code to enter a name, or you can append a date+time string to your filename if you're worried about file overwriting.

Related

Create dynamic PDF for users and send with email in nodes

I have list of users. When I click submit detail then
I want to create PDF file dynamically according to users detail and send with email to all users in nodejs.
This isn't really something that MailGun is designed to handle. You're responsible for creating the content and they're responsible for sending the content.
If you need to create a PDF dynamically, I'd recommend using Node or PHP to create your content as HTML/CSS and then using a library like html2pdf or a service like PDFShift to render your output in PDF form.
If you want to create a PDF dynamically i would suggest you to use pdf-creator-node
and for sending mails i would suggest you to use nodemailer
you can use this repo.
Check out Docamatic. It allows you to to create and send a PDF in a single API request.
{
"source": "https://my-site.com/invoice.html",
"email": {
"to": "accounts#my-customer.com",
"subject": "July Invoice"
}
}

DocuSign API - Reset/Unlock RecipientAuthenticationStatus

I'm using the DocuSign API to electronically sign documents within my app. I'm using the access code authentication feature, for some additional security; however, I am trying to 'Unlock' a signer (via the API) that has input the wrong access code too many times, without voided and creating a new envelope, or using the DocuSign Admin interface.
I don't care if I have to resend the initial email, I just want to be able to conserve my client's total envelope count. It's also important (if there are multiple signers) that I don't force one signer to have to sign multiple times, if they completed their signatures prior to signer2's authentication error.
I have attempted a POST to:
/v2/accounts/{accountId}/envelopes/{envelopeId}?resend_envelope=true
I have also sought a solution using the docusign-java-client:
Recipients recipients = envelopesApi.listRecipients(accountId, envelopeId);
List<Signer> signers = recipients.getSigners();
for (Signer signer : signers) {
signer.setRecipientAuthenticationStatus(null);
}
I still get the below response
"recipientAuthenticationStatus": {
"accessCodeResult": {
"status": "Failed",
"eventTimestamp": "2018-01-15T23:49:15.8600000Z"
}
I'm able to "Resend" via the DocuSign admin GUI, and everything works as expected...
Is there any way that I'm able "reset/unlock" this authentication feature programatically, through the API?
You can use below PUT endpoint
PUT /restapi/v2/accounts/<accountId>/envelopes/<envelopeId>?resend_envelope=true
Body as:
{
}
This should send another email to the signer who failed the authentication, and that user will again get option to enter the access code.
I think you will need to delete and then re-add the recipient (signer). That makes the signer become a new recipient.
However, doing so means you'll need to re-create everything about the signer: their document tabs/fields, etc.
I can't imagine that it is less expensive to simply void/resend the envelope than to spend a developer's time to work on this issue.
If this scenario is occurring a lot, then perhaps think about providing better training to your signers with respect to using the access code feature.
Per the documentation found here
I must include the json or xml with the request (if the authentication method failed). I assumed incorrectly that if there was only one recipient, then I would NOT have to specify. If you just want to resend the envelope, you don't need to include and signer data.
Such as:
{"signers" :
[{"email":"testEmail#gmail.com",
"name":"FirstName LastName",
"recipientId":"1"
}]
}
You should then get something like the below response:
{"recipientUpdateResults":
[{
"recipientId": "1",
"errorDetails":
{
"errorCode": "SUCCESS",
"message": ""
}
}]
}

Getting the email id from the Outlook REST API when sending email

I am trying to use the Microsoft Rest API to send emails on behalf of our users. When I create a message as a draft, I get back an ID that I can use in future requests for editing, deleting, viewing the full conversation (after it is sent), etc.
I do not want to save it as a draft since I have no reason to, I just want to send it directly. After it is sent, I would still like to view the full conversation. However, if I just send the email (using the /sendmail endpoint), I do not get that ID. Is there anyway to get it? Here is my request:
POST https://outlook.office.com/api/v2.0/Users/email/sendmail
{
"Message": {
"Subject": "Test",
"Importance": "Normal",
"ToRecipients": [{
"EmailAddress": {
"Address": "<email>",
"Name": "<name>"
}
}],
"Sender": {
"EmailAddress": {
"Address": "<email",
"Name": "<name>"
}
},
"Body": {
"ContentType": "HTML",
"Content": "<html>\\n<head>\\n <style>\\n p { color: red; }\\n </style> \\n</head>\\n<body>\\n <p>Test</p>\\n</body>\\n</html>\\n"
}
},
"SaveToSentItems": "true"
}
The HTTP response code is 202, the email sends, but the body is empty (no content, whatsoever).
I don't think this matters, since I can recreate this in Postman, but I am running this in Nodejs using the node-outlook package.
Emails in Exchange via REST and EWS are submitted for transport, but the actual send and subsequent save to the sent items folder are done async. This is why you don't get the id. Transport is who actually writes the email to the sent items folder, not REST.
If you really need to find the item after it has been saved to the sentItems folder, set something like the PR_SEARCH_KEY and then do a view of the sent items folder and seek to that search key value.
Also note when you save a draft, the id that you get back will be different than the id of the item in the sent items folder because the folder Id is part of the id of the item, so that id wouldn't help you anyways.
I don't know which rest api version are you using (i'm using v2.0) but i will try to explain this issue. Sorry for my english i advance.
You have 2 ways to reply a message: on the fly way or the complete way.
On the fly way
Its the easy way, just send a post request to
https://outlook.office.com/api/v2.0/me/messages/{message_id}/reply
or
https://outlook.office.com/api/v2.0/me/messages/{message_id}/replyall
and with the body
{
"Comment": "This is your message in plain text or html code"
}
and thats all.
The problem with this methos that you can only send plain text or HTML, no attachments or anything else. If that's all you need this is your best option.
The complete way
If you need to send an attachment or perform any other action you need to perform these 3 steps:
1. Create a draft from the message you want to reply
Send a post request to
https://outlook.office.com/api/v2.0/me/messages/{message_id}/createreply
This will give you an json object save the "Id" property {draft_id} of this draft for later use.
2. Update the draft
Send a patch request to
https://outlook.office.com/api/v2.0/me/messages/{draft_id}
and with the body
{
"Body": {
"ContentType": "HTML or Text",
"Content": "Your response in plain text or html"
}
}
or any other parameter you want to change.
3. Send the draft
Send a post request to
https://outlook.office.com/api/v2.0/me/messages/{draft_id}/send
And thats it.
If you need more info abut this check https://msdn.microsoft.com/en-us/office/office365/api/mail-rest-operations

Not able to rename document of Draft envelope

Our application creates a draft envelope from template using docusign rest API. Based on the user input application renaming the document and send envelope for signing.
We are using API PUT "docusignUrl/envelopes/{envelopeId}/documents" to rename the documents of a draft envelope from past 10 months. It was working till yesterday. All of sudden today it is not renaming the document. It is keeping document name as template name itself.
Can somebody please help me to rename the document. I am using demo.docusign.net
Following are the request and response contents.
Url: https://demo.docusign.net/restapi/v2/accounts/1234/envelopes/a499c33a-94c6-46e1-a0f2-bf5cd368529b/documents
Request body:
{"documents":[
{"name":"150821183100_Order-Sign_companyc_P",
"documentId":"1",
"order":"1",
"pages":"1",
"type":"content",
"uri":"/envelopes/a499c33a-94c6-46e1-a0f2-bf5cd368529b/documents/1"
}]
}
Response Body:
{
"envelopeId": "a499c33a-94c6-46e1-a0f2-bf5cd368529b",
"envelopeDocuments": [
{
"documentId": "1",
"name": "SOMA_Sign_OrderManagement.pdf",
"uri": "/envelopes/a499c33a-94c6-46e1-a0f2-bf5cd368529b/documents/1",
"order": "1"
}
]
}
Your previous behavior is the desired behavior.
This is a bug that is being looked into by DocuSign, I'll update this answer if I get any additional information.
UPDATE: The issue has been resolved and is working as intended in Demo once again.

Delete Envelope in created state

How can I delete a draft envelope using REST API? (status=created). I want to be able to destroy the envelope as it needs changes to subject and email blurb which I have been told is not possible via REST API after the creation of the envelope.
To Delete through the DocuSign Console:
You can delete an envelope from your Drafts folder by navigating to that folder, selecting the envelope(s) in question, and deleting through the UI.
To Delete through the DocuSign REST API:
This is not well documented at the moment but this can be accomplished by using the MoveEnvelope() call and moving it into your Recycle Bin folder. The following page from the REST API guide describes the call you need make:
DocuSign REST API Guide - Move Envelopes
The details of the call are as follows:
URL:
/accounts/{accountId}/folders/{folderId}
Method:
PUT
Body:
{
"envelopeIds": [
"sample string 1",
"sample string 2"
],
"fromFolderId": "sample string 1"
}
As with all other calls, this can be formatted in JSON or XML. If using XML request bodies, use the following:
<envelopeMoveRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.com/restapi">
<envelopeIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>sample string 1</d2p1:string>
<d2p1:string>sample string 2</d2p1:string>
</envelopeIds>
<fromFolderId>sample string 1</fromFolderId>
</envelopeMoveRequest>

Resources