Given that I have multiple template, let's say:
Template 1: A and Manager need to sign Template 2: Only A need to sign
Is it possible to combine this into 1 envelope and show it within the app?
The way I did it as of now in sequence:
* create an envelope for the template 2
* retrieve the uri
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url (back to my site)
* get the embedded signing url
* create another envelope for template 1
* retrieve the uri
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url
(embedded signing url for the above template)
* call `POST /accounts/{accountId}/envelopes/{envelopeId}/views/recipient`
with body specifying the return url
(embedded signing url for the above because it needs different signer)
* retrieve the embedded signing url
* open the embedded signing url on the UI
The problem with this way is, if the user takes too long on the first document (more than 5 minutes), the url will expired, and they don't get to sign the rest of the documents.
So, after some googling, sounds like I'm supposed to use composite templates, but I can't find any example on how to retrieve the embedded signing url.
NOTE: I'm using embedded signing, so I need to be able to retrieve the url that show the signing page, and also specified the return url once the signing is done.
UPDATE I use the API Explorer to produce the right JSON, and seems to work for 1 template, will try for multiple template and multiple user.
UPDATE:
I have created a JSON, and it run (both template are now in one envelope, and I can see it and sign it), but only with one user. How can I make it work, so the other person can also sign it?
i.e: template 1: 2 people need to sign on different place, template 2: only 1 people need to sign
Below is the JSON, with some random variable such as template id
{
"compositeTemplates": [
{
"inlineTemplates": [
{
"customFields": {
"listCustomFields": [
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "2096"
},
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "2"
}
]
},
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "[email protected]",
"name": "Some One",
"recipientId": "1",
"roleName": "Occupant",
"tabs": {
"dateTabs": [
{
"tabLabel": "*ExpDate",
"value": "2/20/2018"
}
],
"listTabs": [
{
"listItems": [
{
"selected": "False",
"text": "True",
"value": "True"
},
{
"selected": "True",
"text": "False",
"value": "False"
}
],
"tabLabel": "ShowCOI"
},
{
"listItems": [
{
"selected": "False",
"text": "Y",
"value": "Y"
},
{
"selected": "True",
"text": "N",
"value": "N"
}
],
"tabLabel": "BillingOption"
}
],
"numberTabs": [
{
"tabLabel": "*ValueOfGoods",
"value": "$5,000.00"
}
],
"radioGroupTabs": [
{
"groupName": "Some Radio",
"radios": [
{
"selected": "false",
"value": "on property"
},
{
"selected": "true",
"value": "off property"
}
]
},
{
"groupName": "ServiceSchedule",
"radios": [
{
"selected": "false",
"value": "Yes"
},
{
"selected": "true",
"value": "No"
}
]
}
],
"textTabs": [
{
"tabLabel": "*SomeLabel",
"value": "SomeValue"
},
{
"tabLabel": "*SomeAddress",
"value": "SomeAddress "
},
]
}
},
{
"clientUserId": "2",
"email": "[email protected]",
"name": "Manager One",
"recipientId": "2",
"roleName": "Owner"
}
]
},
"sequence": "1"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "<templateId1>"
}
]
},
{
"inlineTemplates": [
{
"customFields": {
"listCustomFields": [
{
"name": "OpportunityId",
"required": "True",
"show": "False",
"value": "2096"
},
{
"name": "DocuInfoId",
"required": "True",
"show": "False",
"value": "1"
}
]
},
"recipients": {
"signers": [
{
"clientUserId": "1",
"email": "[email protected]",
"name": "Some One",
"recipientId": "1",
"roleName": "Occupant"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "2",
"templateId": "<templateId2>"
}
]
}
],
"emailSubject": "DocuSign API - Composite Templates",
"eventNotification": {
"envelopeEvents": [
{
"envelopeEventStatusCode": "Sent"
},
{
"envelopeEventStatusCode": "Completed",
"includeDocuments": "true"
}
],
"includeCertificateOfCompletion": "true",
"includeCertificateWithSoap": "false",
"includeDocumentFields": "false",
"includeDocuments": "false",
"includeEnvelopeVoidReason": "false",
"includeSenderAccountAsCustomField": "false",
"includeTimeZone": "true",
"loggingEnabled": "false",
"recipientEvents": [
{
"includeDocuments": "true",
"recipientEventStatusCode": "Completed"
}
],
"requireAcknowledgment": "true",
"signMessageWithX509Cert": "false",
"url": "http://localhost:8080/api/documents/docusign/available",
"useSoapInterface": "false"
},
"status": "sent"
}
I'm using the function to retrieve the embedded signing url, with uri is from the envelope, clientUserId is the first person in this case 1 for [email protected]. Am I supposed to call it twice or something for manageroneemail?
private string GetSignerUrl(string uri, string name, string email, string returnUrl, string clientUserId)
{
string recipientUrl = _baseUrl + uri + "/views/recipient";
RecipientViewRequestModel recipient1 = new RecipientViewRequestModel
{
clientUserId = clientUserId,
authenticationMethod = "email",
email = email,
returnUrl = returnUrl,
userName = name
};
// make call
string recipient1JsonSerialized = Newtonsoft.Json.JsonConvert.SerializeObject(recipient1);
HttpWebRequest request = InitializeRequest(recipientUrl, "POST", recipient1JsonSerialized);
string response = GetResponseBody(request);
string signerUrl = ParseDataFromResponse(response, "url"); // parse signing url
return signerUrl;
}
Please find the below JSON Request to add two templates using composite templates,
{
"compositeTemplates": [
{
"compositeTemplateId": 1,
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "A Name",
"recipientId": "1",
"roleName": "A",
"routingOrder": "1",
"clientUserId": "AEmail"
},
{
"email": "[email protected]",
"name": "Manager Name",
"recipientId": "2",
"roleName": "Manager",
"routingOrder": "2",
"clientUserId": "ManagerEmail"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "f9fd4d6f-834c-4632-a054-cedb3e79d123"
}
]
},
{
"compositeTemplateId": 2,
"inlineTemplates": [
{
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "A Name",
"recipientId": "1",
"roleName": "A",
"routingOrder": "1"
}
]
},
"sequence": "2"
}
],
"serverTemplates": [
{
"sequence": "1",
"templateId": "56645b6f-21d2-4838-b92c-4d44df591e41"
}
]
}
],
"status": "sent"
}