I am trying to send a Document for signature using Docusign (Using RestAPI), It has one recipient as a Signer and one as Carbon Copy. I have pasted the JSON below and also I get a success message when calling the Rest API in the demo environment.
However the Recipient designated as CarbonCopy never gets the email, The Signer do recieves the email from Docusign
"emailSubject" : "This is the Subject of the Message",
"emailBlurb" : "This is the Body of the message",
"recipients" : {
"signers" : [ {
"routingOrder" : "1",
"name" : "Signer 1",
"email" : "signer1#gmail.com",
"recipientId" : "1",
"tabs" : {
"signHereTabs" : [ {
"anchorString" : "By:",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"anchorIgnoreIfNotPresent" : "true",
"anchorUnits" : "inches"
} ]
}
} ],
"carbonCopies" : [ {
"routingOrder" : "2",
"recipientId" : "2",
"name" : "Carbon Copy1",
"email" : "carboncopy1#gmail.com"
} ]
},
"documents" : [ {
"name" : "document.pdf",
"documentId" : "1",
"bytes" : "document Bytes go here - Omitted to make it readable"
} ],
"status" : "sent"
}
Success Message Recieved
{ "envelopeId": "95c0cd64-7b4e-4d98-ad9c-ae74c08cf7f9", "uri": "/envelopes/95c0cd64-7b4e-4d98-ad9c-ae74c08cf7f9", "statusDateTime": "2015-10-19T21:00:30.7100000Z", "status": "sent"}
Yes and I did solve the problem having the carbon copy routing order always higher than the signers, so in the above JSON just reversed the routing order and it worked for me
Related
In my tests so far when creating and sending an envelope using the DocuSign API v2.1 it is not respecting the setting for the supportedLanguage for the first signer, but does for the 2nd signer.
Here's the JSON for Signers array that I'm using:
"signers" :
[
{
"email" : "test#acme.com",
"emailNotification" :
{
"emailBody" : "",
"emailSubject" : "Please Sign the Agreement",
"supportedLanguage" : "de"
},
"name" : "Elisabeth Kiefer",
"recipientId" : "1",
"routingOrder" : "1",
"tabs" :
{
"dateSignedTabs" :
[
{
"anchorIgnoreIfNotPresent" : false,
"anchorString" : "/DateSigned1/",
"anchorUnits" : "pixels",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"documentId" : "1",
"locked" : "false",
"name" : "Date Signed",
"pageNumber" : "1",
"tabLabel" : "Data Signed",
"value" : ""
}
],
"fullNameTabs" :
[
{
"anchorIgnoreIfNotPresent" : false,
"anchorString" : "/SigName1/",
"anchorUnits" : "pixels",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"documentId" : "1",
"locked" : "false",
"name" : "Name",
"pageNumber" : "1",
"tabLabel" : "Name",
"value" : ""
}
],
"signHereTabs" :
[
{
"anchorIgnoreIfNotPresent" : false,
"anchorString" : "/Signature1/",
"anchorUnits" : "pixels",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"documentId" : "1",
"locked" : "false",
"name" : "Sign Here",
"pageNumber" : "1",
"tabLabel" : "Signature",
"value" : ""
}
]
}
},
{
"email" : "test2#random.com",
"emailNotification" :
{
"emailBody" : "",
"emailSubject" : "Please Sign the Agreement",
"supportedLanguage" : "es"
},
"name" : "Fabio Gallego",
"recipientId" : "2",
"routingOrder" : "1",
"tabs" :
{
"dateSignedTabs" :
[
{
"anchorIgnoreIfNotPresent" : false,
"anchorString" : "/DateSigned2/",
"anchorUnits" : "pixels",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"documentId" : "1",
"locked" : "false",
"name" : "Date Signed",
"pageNumber" : "1",
"tabLabel" : "Data Signed",
"value" : ""
}
],
"fullNameTabs" :
[
{
"anchorIgnoreIfNotPresent" : false,
"anchorString" : "/SigName2/",
"anchorUnits" : "pixels",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"documentId" : "1",
"locked" : "false",
"name" : "Name",
"pageNumber" : "1",
"tabLabel" : "Name",
"value" : ""
}
],
"signHereTabs" :
[
{
"anchorIgnoreIfNotPresent" : false,
"anchorString" : "/Signature2/",
"anchorUnits" : "pixels",
"anchorXOffset" : "0",
"anchorYOffset" : "0",
"documentId" : "1",
"locked" : "false",
"name" : "Sign Here",
"pageNumber" : "1",
"tabLabel" : "Signature",
"value" : ""
}
]
}
}
]
You can see that the first signer's supportedLanguage is set to "de" and the second signer is set to "es". When I receive the emails for these and view the document only the second signer has the language set for the website and email. The first signer has everything in English and not German as expected.
The language setting is superseded by the user's selected lang that comes from the account.
So, you may want to change the email address to both to some random/unused emails that you know for sure are not part of any account user and check again.
There's no way for you to force the languages of the enduser, they can always overwrite your selection.
I am building a chat program
And in the backend, I have
chatcol.insert({ "chatid": "133235", "messages": [ {"from": "user3", "content": "Hello", "time": "20101213T172215"}, {"from": "user2", "content": "Hi", "time": "20101214T172215"} ] })
chatcol.insert({ "chatid": "134735", "messages": [ {"from": "user2", "content": "Hello", "time": "20101217T172215"}, {"from": "user12", "content": "Hi", "time": "20101213T172215"} ] })
Since there can be a lot of messages, I want the server only give the new message the client didnt see.
The client will give me a lastuptime, the time where they last logon.
I want to find chats with only the new message only.
How do I write such query?
I have considered time as ISODate()
Also, lastuptime given by the client wil be ISODate()
collection:
{
"_id" : ObjectId("5da31a63c35040d7fbf1db3c"),
"chatid" : "133235",
"messages" : [
{
"from" : "user3",
"content" : "Hello",
"time" : ISODate("2016-05-01T00:00:00Z")
},
{
"from" : "user2",
"content" : "Hi",
"time" : ISODate("2018-05-01T00:00:00Z")
}
]
}
{
"_id" : ObjectId("5da31ab2c35040d7fbf1db3d"),
"chatid" : "133235",
"messages" : [
{
"from" : "user2",
"content" : "Hello",
"time" : ISODate("2010-05-01T00:00:00Z")
},
{
"from" : "user12",
"content" : "Hi",
"time" : ISODate("2019-05-01T00:00:00Z")
}
]
}
There are two scenarios. Depending on your use-case, select the appropriate:
1. Fetch chats where any one of the messages has time >= lastuptime
db.chatcol.find({'messages.time': {"$gte": ISODate("2017-10-01T00:00:00.000Z")}})
Output:
{
"_id" : ObjectId("5da31a63c35040d7fbf1db3c"),
"chatid" : "133235",
"messages" : [
{
"from" : "user3",
"content" : "Hello",
"time" : ISODate("2016-05-01T00:00:00Z")
},
{
"from" : "user2",
"content" : "Hi",
"time" : ISODate("2018-05-01T00:00:00Z")
}
]
}
{
"_id" : ObjectId("5da31ab2c35040d7fbf1db3d"),
"chatid" : "133235",
"messages" : [
{
"from" : "user2",
"content" : "Hello",
"time" : ISODate("2010-05-01T00:00:00Z")
},
{
"from" : "user12",
"content" : "Hi",
"time" : ISODate("2019-05-01T00:00:00Z")
}
]
}
2. Fetch messages where time >= lastuptime
This one flattens the message array
db.chatcol.aggregate([
{ $unwind :'$messages'},
{ $match : {"messages.time": { "$gte": ISODate("2017-10-01T00:00:00.000Z") }}}
])
Output:
{
"_id" : ObjectId("5da31a63c35040d7fbf1db3c"),
"chatid" : "133235",
"messages" : {
"from" : "user2",
"content" : "Hi",
"time" : ISODate("2018-05-01T00:00:00Z")
}
}
{
"_id" : ObjectId("5da31ab2c35040d7fbf1db3d"),
"chatid" : "133235",
"messages" : {
"from" : "user12",
"content" : "Hi",
"time" : ISODate("2019-05-01T00:00:00Z")
}
}
Note: Map the $gte query according to your lastuptime
I have created a template via the DocuSign UI; that template contains some tabs for various roles.
I want to send a document via DocuSign REST API, in which the template (only the tabs e.g. signHere, initiateHere, Title etc) will apply.
I haven't added any recipient on the template. What I want to use from that template are only the tabs.
My JSON
{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "c9e5adfa-d708-4467-a0ea-c615fa429a0f"
}],
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
"signers" : [{
"email": "nalam#relisource.com",
"name": "Noor",
"recipientId": "1",
"roleName": "Applicant"
}]
}
}],
"document": {
"documentId": 1,
"name": "test1.pdf",
"documentBase64":"Base64streamhere"
}
}]
}
It gives me the following error.
{
"errorCode": "INVALID_CONTENT_TYPE",
"message": "Content Type specified is not supported."
}
I am using POSTMAN. What is the problem here ?
Your documentBase64 attribute doesn't look right. Perhaps an error in copying it? Also, setting the fileExtension is highly recommended:
It should be
"document": {
...
"documentBase64": "Base64EncodedString",
"fileExtension": "pdf"
}
I suggest you use API request logging to see exactly what Postman is sending.
Template document substitution
If you're trying to substitute a document at runtime for the document in a server template, see the answers to this SO question for additional tips.
What you want here is the serverTemplate to be in sequence with the inlineTemplate so they need to have the same sequence number. Also you need another inline template to hold your document object. Something like this:
{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence" : 1,
"templateId": "c9e5adfa-d708-4467-a0ea-c615fa429a0f"
}],
"inlineTemplates": [
{
"sequence" : 1,
"recipients": {
"signers" : [{
"email": "nalam#relisource.com",
"name": "Noor",
"recipientId": "1",
"roleName": "Applicant"
}]
}
}],
"inlineTemplates": [
{
"sequence" : 2
"document": {
"documentId": 1,
"name": "test1.pdf",
"documentBase64":"Base64streamhere"
}
}
}]
}
I'm creating an Envelope signing request using the DocuSign API which includes 2 checkbox tabs. When I view the document after receiving the email when I click on either of the 2 checkboxes it puts a tick in both of them.
The 2 checkboxes appear but clicking either of them marks them both as ticked.
Here's the JSON for the tabs:
"tabs" :
{
"checkboxTabs" :
[
{
"documentId" : "1",
"pageNumber" : "6",
"required" : "true",
"tabId" : "0",
"tabLabel" : "",
"xPosition" : "323",
"yPosition" : "170"
},
{
"documentId" : "1",
"pageNumber" : "6",
"required" : "true",
"tabId" : "1",
"tabLabel" : "",
"xPosition" : "323",
"yPosition" : "184"
}
],
"dateSignedTabs" :
[
{
"documentId" : "1",
"pageNumber" : "6",
"xPosition" : "447",
"yPosition" : "272"
}
],
"signHereTabs" :
[
{
"documentId" : "1",
"pageNumber" : "6",
"xPosition" : "266",
"yPosition" : "231"
}
],
"textTabs" :
[
{
"documentId" : "1",
"pageNumber" : "6",
"tabLabel" : "Name",
"xPosition" : "86",
"yPosition" : "273"
}
]
}
They have unique "tabId" values - not sure what I need to do to make them separate checkboxes that can be ticked/unticked independently.
You'll need to give each checkbox a unique TabLabel. By giving them the same 'empty' TabLabel, you're telling DocuSign that data should populate between them.
I am using a demo account of Docusign integrating with force.com sites using Apex.
I created a template and want to send two different mail body to two different recipient. I have two roles Agent and Broker.
In Broker mail body I want to use Agent Recipient Name. I can get the name in subject by using [[Agent_UserName]] but not in body. Is there any way to use Merge fields in Mail body.
Merge fields are not supported in the email Body.
Here is a sample CreateEnvelope request to send unique Email Subject/Body per recipient. You will have to add the emailNotification property for each recipient
{
"status": "created",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"name": "recipient one",
"email": "recipientone#acme.com",
"routingOrder": "1",
"recipientId" : "1",
"roleName" : "texter",
"tabs": {
"textTabs" : [
{
"xPosition" : "100", "yPosition" : "100", "documentId" : "1","pageNumber" : "1"
}
]
},
"emailNotification": {
"emailSubject": "subject for one",
"emailBody": "Body for One",
"supportedLanguage": "en"
}
},
{
"name": "Jane Doe",
"email": "janedoe#acme.com",
"routingOrder": "2",
"recipientId" : "2",
"roleName" : "signer",
"tabs": {
"signHereTabs" : [
{
"xPosition" : "100", "yPosition" : "200", "documentId" : "1", "pageNumber" : "1"
}
]
},
"emailNotification": {
"emailSubject": "subject for two",
"emailBody": "Body for two",
"supportedLanguage": "en"
}
}
]
},
"documents": [
{
"documentId": "1",
"name": "Contract",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
]
}
]
}
]
}