How to implement a DocuSign template natively into a Webflow site? - docusignapi

I have a webflow site with an order form. Once the prospect completes the order form and presses submit, the goal is to redirect the prospect to another page on the webflow site (not redirect to a DocuSign page).
On the next page, the prospect would see our customer agreement with their data from the order form already prefilled. We have a DocuSign template already with tabs already placed visually, we can map those labels to the form labels on the order form. All that should be left for prospects to do is to add their signature and submit the agreement.
If I understood the explanation above correctly, then the following steps would work our use case as well. Is this correct?
Step 1 When a prospect fills in and submits the order form on the website, the website button click will trigger a GET API request. ie. GET demo.docusign.net/restapi/login_information
Step 2 Next, a POST API request will be sent to DocuSign to create an envelope based on our template agreement. i.e. POST demo.docusign.net/restapi/:version/:accountId/envelopes In this POST request, we will also send in the request body the data labels in the template and map those to the data entered in the form submission. i.e.
"tabs": {
"textTabs": [
{
"tabLabel": "address",
"value": "Code for pulling the value from the relevant form field"
},
{
"tabLabel": "email",
"value": "Code for pulling the value from the relevant form field"
}
]
}
Step 3 Call the following GET request to display the DocuSign agreement directly on our site. --> Should this be in an iframe or another implementation? i.e. Get DocuSign Recipient View
Thank you in advance for your support!

Related

docuSign - envelopeViews : createRecipient

ERROR: Content Type specified is not supported.
Hi there, I am new to DocuSign and I am trying to learn the implementation from last couple of days. What I did so far is, created a developer account and created a QuickStart project.
Goal
I want to integrate the DocuSign API's in my application, but I don't really want the user to leave my application. I just want to make use of DocuSign within my app. - Embedded Signing
What I did?
I successfully created an envelope with a sample document and after that I have to get that URL to view (for Recipient).
So I called the below API:
** EnvelopeViews: createRecipient**
** POST - {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/views/recipient**
All the details, like accountId, envelopeId are correct, along with that the request body that I pass with this is:
Request Body
{
"authenticationMethod": "none",
"clientUserId": "bcc49234-f30b-XXXX-XXXX-XXXXXXXXXXXX",
"email": "abc#gmail.com",
"recipientId": "007",
"returnUrl":"http://localhost",
"userName": "user name"
}
Note: * clientUserId is my Integration Key (please let me know if this is what I need to pass here or something else).*
Response
{
"errorCode": "INVALID_CONTENT_TYPE",
"message": "Content Type specified is not supported."
}
Note: Apart from the solution, please provide any link(s) to resources where I can easily see the implementation(as in my use case).
Umair,
First clientUserId is a bit of a confusing term, it's not the IK (Integration Key) but any string you want. It is unique to the signer and the envelope. You choose it.
You can find a detailed example of this with code in 8 languages on the DocuSign Developer Center How To Request Signature Through your app page.
I'm not clear how you make the API calls, if you are using postman, there are headers that needs to be set. One of them is called Content-Type and it has to be set to text/plain.

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": ""
}
}]
}

Using customer object information in private app

I'm currently trying to build a private app which will allow me to create a form which customers can use to update info like name, email address, etc.
I know that I can access this information in my template through the customer object:
https://help.shopify.com/themes/liquid/objects/customer
I also believe that I can send http requests through the admin api which would allow me to update a given customer object:
https://help.shopify.com/api/reference/customer#update
This is an example PUT request from that page
PUT /admin/customers/#{id}.json
{
"customer": {
"id": 207119551,
"email": "changed#email.address.com",
"note": "Customer is a great guy"
}
}
I think that in order to use this api (or at least use it securely) I need to use a private app. I found the following npm package which I would use to create the private app:
https://www.npmjs.com/package/shopify-node-api
This is an example of a PUT request from that page (I think this can be modified for customers):
var put_data = {
"product": {
"body_html": "<strong>Updated!</strong>"
}
}
Shopify.put('/admin/products/1234567.json', put_data, function(err, data, headers){
console.log(data);
});
Does anyone have any experience doing this as I'm unsure about a few things.
Will this PUT request be called when the url is loaded? So if I have an
<a> tag with href="/admin/products/1234567.json the request would load?
If so, this seems quite useless with the customer ID hardcoded in. Can I pass in the customer ID of whoever is logged in and clicking the link and use that as the last part of the request url somehow? In addition to this would it be possible to grab the form data that the user enters to use as the value for "email" or "note?
You should check out this answer shopify app proxy: send customer data or only customer ID for some pointers, discussion and links.
tl/dr; Don't rely on only the logged in customer id or you'll be opening yourself up to easy hackery.
So bascially you update the customer with the PUT you outlined in your question.
To get the id securely you:
Create a form with the customer id and make sure you have a server generated hash of that customer id to thwart bots (that's the reference post)
You post the customer data to a an app via a proxy url
You update the customer via a PUT to a constructed url.

REST API - Recipient View - How to configure multiple returnUrl's per Event

I'm attempting to build embedded signing with my integration via REST API. I can successfully create the token with the bare minimum requirements.
{
"userName": "Derrick Test",
"email": "email#email.com",
"recipientId": "1",
"clientUserId": "1",
"returnUrl": "http://www.google.com",
"authenticationMethod": "email"
}
What I would like to enhance is redirect my signers to a specific URL on more than just completion. More specifically I would like to configure a different URL for the events:
cancel
decline
signing_complete
viewing_complete
The REST documentation does not provide a JSON example when utilizing multiple events. Has anyone else been successful with this?
With the REST API, you can only supply a single returnUrl, and it will apply for any/all events (i.e., cancel / decline / exception / fax_pending / id_check_failed / session_timeout / signing_complete / ttl_expired / viewing_complete). However, you can achieve the effect of having the user's destination be event-dependent simply by coding your return page to evaluate the event parameter in the querystring, and doing another redirect immediately to the event-specific page, depending on the value of the event querystring parameter.
For example, let's say you specify http://www.myfakesite.com/processReturn.aspx as the returnUrl value in the POST Recipient View request. When the recipient signs the document(s) and submits the Envelope, DocuSign will redirect the user to the URL: http://www.myfakesite.com/processReturn.aspx?event=signing_complete. Assuming you've built "processReturn.aspx" such that it evaluates the value of the event querystring parameter, it will see value "signing_complete" and then immediately redirect to the appropriate page (that you specify in the code) for the Signing Complete event.
Page 167 (returnUrl property description) of the REST API guide (http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf) lists all possible values for the event parameter.

Docusign Modify Existing Tabs Request - Unable to Modify Existing Radio Tab

We are trying to set a Radio button to be selected initially when an envelope is created based on certain conditions outside of Docusign.
Testing using the following URL and request body.
https://demo.docusign.net/restapi/v2/accounts/163051/envelopes/49c4ebeb-331d-4cf9-bce7-843be646fbd5/recipients/1/tabs
Body:
{
"accountId":"163051",
"envelopeId":"49c4ebeb-331d-4cf9-bce7-843be646fbd5",
"radioGroupTabs":[
{"documentId":"1","groupName":"RadioGroup","radios":[
{"pageNumber":"2","selected":"True","tabId":"04ad92ed-377b-4389-8ec0-93999385c3f6"}
],
"recipientId":"1"}
],
"recipientId":"1"}
Even though we only have 1 radio tab, we receive this response:
{"errorCode": "INVALID_TAB_OPERATION",
"message": "The Tab specified is not valid for the requested operation. Attempt to create 'text' tab from invalid tab type."}
Why are we getting this response? We have checked and the RadioGroup, tabId, envelopeId, accountId are all valid.
Thanks for your post, looks like you've identified an api bug with the platform. In testing I've found that I can modify other tabs just fine (such as dateSigned for instance) but there seems to be a problem modifying existing radio button tabs.
I've logged a bug with DocuSign, not sure when it will be fixed though. The August release just came out so hopefully by the September release. Will post here once resolved.

Resources