BoldSignDocumentation
BoldSign Mobile Icon

Create embedded request link from template

Mon, 24 January, 2022

Create a new document using existing template with properties for generating the embedded requesting link.
The below given table shows the different properties available in EmbeddedTemplateRequest and their description:

Property Description
RedirectUrl This property is used to redirect to the URL after the document is sent.
ShowToolbar Boolean to toggle the visibility of the tool bar with options in both filling and prepare pages.
SendViewOption Setting enum to FillingPage will make the user start with document uploading and signers filling page.Setting enum to PreparePage will make the user start with preparing or configuring fields page of the document.
ShowSaveButton Boolean to show the save option in both filling and prepare page, to save the progress of the document.
ShowSendButton Boolean to show the send button in prepare page to send the document out for signature.
ShowPreviewButton Boolean to show the preview of the document to review.
ShowNavigationButtons Boolean to show the navigation buttons in both filling and prepare page.
SendLinkValidTill This property used to set the validity of the generated URL and its maximum validity is 180 days.

Create a new instance of EmbeddedTemplateRequest object with required parameters to send the sign request with the help of templateClient as shown below:

C#CURL

// This is an example template id, add your own template id upon usage.
var templateId = "949ebf20-45a8-4a3e-91a9-68e9540e0020";
var templateDetails = new EmbeddedTemplateRequest()
    {
        TemplateId = templateId,
        Title = "Document from Template",
        Message = "This document description",
        ShowToolbar = true,
        RedirectUrl = new Uri("https://boldsign.dev/sign/redirect"),
        SendLinkValidTill = DateTime.UtcNow.AddDays(20),
    };
var createdEmbeddedTemplateResult = this.templateClient.CreateEmbeddedRequestUrl(templateDetails);
curl -X POST 'https://api.boldsign.com/v1/template/createEmbeddedRequestUrl?templateId=949ebf20-45a8-4a3e-91a9-68e9540e0020' -H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <authtoken>' \
-d '{"title":"Document from Template","message":"This document description","showToolbar":true, "redirectUrl":"https://boldsign.dev/sign/redirect"}'

After generating embedded URL you can load that URL in client side using iframe as shown below:


<iframe id="prepare_page"
        src=" https://app.boldsign.com/document/embed/?documentId=a14b5a72-16f6-41c8-beaf-625ce6c85yu2abe_KYEq55w7;44825143-5cfc-40a4-95c6-b9aee413uua322"
        height="600"
        width="1100"
        class="frame">
</iframe>

Also, we have client-side events in embedded request API, and it will be used to customize the toolbar when we set the ShowToolBar as false.

Event Description
onNextClick It will be used to navigate to filling page to prepare page
onPreviewClick It will be used to navigate the preview page
onSaveAndCloseClick It will be used to save and close the document.
onSendClick It will be used to send the document

Usage

<div style="float:left;">
    <button onclick="onNextClick()">Next</button>
    <button onclick="onPreviewClick()">Preview</button>
    <button onclick="onSaveAndCloseClick()">Save and close</button>
    <button onclick="onSendClick()">Send</button>
</div>
<script>    
var iframeEl = document.getElementById('prepare_page');
    function onNextClick() {
        iframeEl.contentWindow.postMessage("onNextClick", '*');
    }
    function onPreviewClick() {
        iframeEl.contentWindow.postMessage("onPreviewClick", '*');
    }
    function onSaveAndCloseClick() {
        iframeEl.contentWindow.postMessage("onSaveAndCloseClick", '*');
    }
    function onSendClick() {
        iframeEl.contentWindow.postMessage("onSendClick", '*');
    }
</script>
Copied to clipboard