Reputation: 87
This questions is regarding Hellosign API. I am creating a template where i want to owner's sign(Suppose, I am owner then my sign will append there automatically). I create it using Hellosign website but now i want to create it using hellosign API. Here i am generating dynamic template. So please give me answer. Thank you in advance.
Example (What i want)
Check this image please. I have a html-css block like below picture. I want to get default owner's signature and current date using hellosign.
Here is my code, what i have done
<!-- PHP code -->
<?php
require_once '../vendor/autoload.php';
$api_key = ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$client_id = ('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$client = new HelloSign\Client($api_key);
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setTitle("Testing");
$request->setSubject('My First embedded signature request');
$request->setRequesterEmail('[email protected]');
$request->addFile('yourpage.html');
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
$response = $client->createEmbeddedSignatureRequest($embedded_request);
$response = $client->getEmbeddedSignUrl($signature_id);
$sign_url = $response->getSignUrl();
?>
<!-- Script code -->
<script type="text/javascript" src="//s3.amazonaws.com/cdn.hellofax.com/js/embedded.js"></script>
<script type="text/javascript">
HelloSign.init('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz');
var claim_url = "<?PHP echo $claim_url;?>";
// alert(claim_url);
HelloSign.open({
url: claim_url,
allowCancel: false,
skipDomainVerification: true,
height: 640,
width: 1368,
requester: "[email protected]",
container: document.getElementById('wmtest'),
messageListener: function(eventData) {
alert("HelloSign event received");
}
});
</script>
Upvotes: 1
Views: 915
Reputation: 16
You mention templates, though your code is for embedded signing using a file/url. Here's an example of an embedded signature request using a template for reference:
$client = new HelloSign\Client('f167bc93d1390z467k026h84c4f8b9a1aa8c043f5f58a54cd0db300766986254');
$request = new HelloSign\TemplateSignatureRequest;
$request->enableTestMode();
$request->setTemplateId('c26b8a16784a872da37ea946b9ddec7c1e11dff6');
$request->setSubject('Purchase Order');
$request->setMessage('Glad we could come to an agreement.');
$request->setSigner('Client', '[email protected]', 'George');
$request->setCC('Accounting', '[email protected]');
$request->setCustomFieldValue('Cost', '$20,000');
$client_id = 'YOUR_CLIENT_ID';
$embedded_request = new HelloSign\EmbeddedSignatureRequest($request, $client_id);
$response = $client->createEmbeddedSignatureRequest($embedded_request);
Also, you wouldn't be able to sign the document programmatically. Instead, your options are either signing the document during Template creation on HelloSign.com, then using a Me (when sending) text box and passing the sign date as a CustomFieldValue with the signature request. Or you could include yourself as a signer along with your other signers, and bring up the signature request in an iframe just like your other signers.
Please reach out to us at [email protected] for more information. Check out our documentation at https://www.hellosign.com/api/documentation. Or get live support for general questions https://www.hipchat.com/gq4BMFKt1
Upvotes: 0