nweese | Posts: 10

Creating and Sending Packages using JavaScript

0 votes
Is it possible? Has anyone done this?

Duo_Liang | Posts: 3776

Reply to: Creating and Sending Packages using JavaScript

0 votes
Hi there, Yes! You can use OneSpan Sign REST API with NodeJs, here's a blog on this and you can find the source code using in this blog here. Hope this could help! Duo

nweese | Posts: 10

Reply to: Creating and Sending Packages using JavaScript

0 votes
This gives me a good direction to head in but unfortunately downloading and running the code does not work. I 'npm i' to install all the node modules, inserted my api_key, node server.js to run the server, and live-server for the front end. Server is saying "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string"

Duo_Liang | Posts: 3776

Reply to: Creating and Sending Packages using JavaScript

0 votes
Hi there, In file ESLPackageCreation.js, line 34, if I directly use this json as formData, it works:
formData: 
{ "file": document, 
 "payload": jsonPayload } 
Hope this could help! Duo

nweese | Posts: 10

Reply to: Creating and Sending Packages using JavaScript

0 votes
Thank you Duo! That got me farther but still not working. My response body is now body {"messageKey":"error.validation.sendPackage.noApprovals","message":"Cannot send package without approvals.","code":400,"name":"Validation Error"} I am using the api_key I retreived from sandbox. Is this wrong?

Duo_Liang | Posts: 3776

Reply to: Creating and Sending Packages using JavaScript

0 votes
Hi there, "error.validation.sendPackage.noApprovals" is an error sent from OneSpan Sign, so if you are receiving this error, it means your API key and instance endpoint are correct. For the error, did you changed the pdf included in the folder? Because in this example, it's using Document Extraction Feature to locate all approvals, it seems that OneSpan Sign can't find the automated injected fields in your pdf. Duo

nweese | Posts: 10

Reply to: Creating and Sending Packages using JavaScript

0 votes
Ok, so how do I use a custom form? Is it possible to create the template via UI and use that document, and if so, how do I retreive the packageId?

Duo_Liang | Posts: 3776

Reply to: Creating and Sending Packages using JavaScript

0 votes
Hi nweese, For first question. Sure, the example only gives you an idea of how the whole process works with OneSpan Sign. To customize your pdf, and to locate your fields/approvals, you can use following extraction ways: 1.Document Extraction Use PDF forms to tell OneSpan Sign where and what the size you want your field(signature field/date field/text field, etc) to be on the document. The property name of the PDF form should follow esl grammar so that OneSpan Sign can know which type of fileds you want and which signer/approval you want this field to be bound to. The "extract":true is added to the document level. 2.Text Tags Extraction Text Tags Extraction achieves the same goal with Document Extraction, only difference is you don’t use a pdf form. You direct embed esl grammar(including size) into your document and OneSpan Sign can recognize that snippet. The "extract":true is also added to the document level. 3.Position Extraction Position Extraction is a simplified document extraction, you just tell OneSpan Sign where and the size of the field, the type and other info still includes in the request payload. Since position extraction is refined to the field, "extract":true is added to a field level.(which field you need position extraction, you need to add a extract=true) 4. Text Anchor Text Anchor follows the same idea with Position Extraction. By given the specific snippet of your document word, OneSpan Sign can locate to the position and you need extra info in the request payload to specify the type and other info. The extract should be set to false:"extract":false on field level just like position extraction. 5.Field Injection Field Injection is different to those four. You would use PDF form with property name to locate the field, and inject values(text) to these fields. What you injected would become a part to the document before signers start to sign. Pretty like what you can done with these open source PDF libraries. The "extract":true is added to the document level. For second question. If you want to use UI to create a template, normally it's suggested to partially integrate this into your own application, and here's the workflow you may follow: 1.create a template programmatically, so that you can receive the package/template id 2.call API to get a Designer session (guide here), and embed Designer view into an iFrame (in a modal most cases) 3.make packages from template(guide here) Hope this could help you! Duo

nweese | Posts: 10

Reply to: Creating and Sending Packages using JavaScript

0 votes
https://github.com/nicoleweese/Abacus-Form-Upload Please let me know why the package will not clone. Error: source.on('error', function() {}); TypeError: source.on is not a function at Function.DelayedStream.create (/home/niko/Downloads/nodejs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js:33:10) at FormData.CombinedStream.append (/home/niko/Downloads/nodejs/node_modules/request/node_modules/combined-stream/lib/combined_stream.js:43:37) at FormData.append (/home/niko/Downloads/nodejs/node_modules/request/node_modules/form-data/lib/form_data.js:68:3)

Duo_Liang | Posts: 3776

Reply to: Creating and Sending Packages using JavaScript

0 votes
Hi nweese, The package with id of "-xarvqdcc5R4IqsfnqkOVFEA05o=" is a "package" instead of a "template", that's why you can't create packages from this one. BTW, for test purpose, you can retrieve your template ID from url. Duo

nweese | Posts: 10

Reply to: Creating and Sending Packages using JavaScript

0 votes
Is there any sort of live technical support I can contact?

Duo_Liang | Posts: 3776

Reply to: Creating and Sending Packages using JavaScript

0 votes
Sure, you can find contact information of our technical support in this webpage. Duo

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off