venkata prasad
venkata prasad

Reputation: 125

How to append custom form data to HelloSign Api template?

I need to append the custom form data to HelloSign api template. The form filled php form before the HelloSign page. I need to fetch all the details of the form data to display in the HelloSign template.

<form name="hellosign" method="post">
Name:<input type="text" name="name">
Phone: <input type="text" name="phone">
Email: <input type="text" name="email">
<input type="submit" value="submit">
</form>

<?php $client = new HelloSign\Client('62ae8b50d5293a72ae0aa31ef0f586d1fcf5c89707b9e68b906dd64864');
$request = new HelloSign\SignatureRequest;
$request->enableTestMode();
$request->setRequesterEmail('[email protected]');
$request->addFile('trxade.pdf');
$client_id = '0005fc6cf93ce7ce6116778555661';
$draft_request = new HelloSign\UnclaimedDraft($request, $client_id);
$draft_request->setIsForEmbeddedSigning(true);
$response = $client->createUnclaimedDraft($draft_request);
$claim_url = $draft_request->getClaimUrl();
foreach ($response as $key => $value) {
    if($key === 'signature_request_id')
    {
        echo $requestId =$value;echo "<br/>";   
    }

}
echo $requestId;
<script type="text/javascript" src="https://s3.amazonaws.com/cdn.hellosign.com/public/js/hellosign-embedded.LATEST.min.js"></script>
<script>
    HelloSign.init("0005fc6cf93ce7ce6116778555661");
    HelloSign.open({
    url: "<?= $claim_url;?>",
    allowCancel: true,
    skipDomainVerification:true 

});
</script>

Upvotes: 1

Views: 449

Answers (1)

alexmac05
alexmac05

Reputation: 56

You can append custom form data to a HelloSign API Template, using custom fields. You will want to go through this tutorial and pay close attention to the custom fields part of the walkthrough: https://app.hellosign.com/api/templatesAndApiWalkthrough

Remember to set the text-box's that will be used for custom fields as "Me When Sending" as this is a common mistake.

You'll want to use this endpoint: https://app.hellosign.com/api/reference#send_with_template

The above endpoint would give you a non-embedded signature request with template.

Are you looking to do embedded or non-embedded?

Lastly, you do not need this endpoint HelloSign\UnclaimedDraft for sending a signature request with template. You can remove that.

Upvotes: 0

Related Questions