Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Honestjoewillie/9685809f57d8956e32a06215ca071fb1 to your computer and use it in GitHub Desktop.
Save Honestjoewillie/9685809f57d8956e32a06215ca071fb1 to your computer and use it in GitHub Desktop.
Part 2 - Troubleshooting, Part 2.1 HelloSign
var http = require('http');
var hellosign = require('hellosign-sdk')({key : 'YOURAPIKEYHERE'}); // your HelloSign API Key here
var port = (process.env.PORT || process.env.VCAP_APP_PORT || 6500);
// follow the Embedded Signing Walkthrough to tell us why this isn't working
// go ahead and fix the issue(s)
// then print out the sign_url once you get it working
http
.createServer(
function(req, res) {
res.writeHead(200, {
'Content-Type' : 'text/html'
});
res.write('<body><h1>Isn\'t this cool??</h1></body></html>');
var options = {
test_mode : 1,
clientId : 'YOURCLIENTIDHERE', // your HelloSign Client ID here
subject : 'My First embedded signature request' ,
message : 'Awesome, right? I know.',
signers : [{
email_address : 'signer0@example.com',
name : 'Susan'
}],
file_url : ['http://www.pdf995.com/samples/pdf.pdf'],
};
hellosign.signatureRequest.createEmbedded(options)
.then(function(response){
var signatureId = response.signature_request.signatures[0].signature_id;
hellosign.embedded.getSignUrl(signatureId).then((res) => {
console.log('The sign url is: ' + res.embedded.sign_url);
})
})
.catch(function(err){
if (err !== null) {
console.log('Bummer - we got an error here');
console.log(err);
}
});
// put all test code above this line
res.end('\n');
}).listen(port);
console.log('Server running at http://127.0.0.1:' + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment