Repository navigation
API Documentation (v2)
⚠️ This article is for an unreleased version of HelloSign Embedded. Please do not use it for reference.
new HelloSign([options])
Create a new HelloSign Embedded client instance in order to embed a signature request into your webapp. In most cases, only one instance of HelloSign should exist per application. Any options specified when instantiating a new HelloSign Embedded client instance will be used as the config base when calling client.open().
Note: It should not be necessary to create a new client instance every time you want to call client.open().
-
classNamesObject - An enum of class names used by HelloSign Embedded. -
eventsObject - An enum of events emitted by a HelloSign Embedded client instance. -
localesObject - An enum of locale codes supported by HelloSign. -
messagesObject - An enum of window event message types sent by the HelloSign app. -
versionstring - The current version of HelloSign Embedded.
-
elementHTMLElement - The base element for HelloSign Embedded (if it is in the DOM). -
isOpenboolean - Whether or not HelloSign Embedded is open.
-
optionsObject (optional) - See Options.
-
Instantiate a new HelloSign Embedded client.
const client = new HelloSign();
-
Instantiate a new HelloSign Embedded client with options.
const client = new HelloSign({ clientId: 'Your client ID', debug: true, locale: HelloSign.locales.ZH_CN });
A HelloSign Embedded client instance has the following public methods:
client.open(url[, options])
Opens the HelloSign Embedded signature request window with the given URL. The provided URL can either be a signature sign_url, a signature request template edit_url, or a claim_url. See the HelloSign API documentation for more information. Options specified here will be merged with options specified when the client was instantiated (if any).
Emits open.
-
urlstring - The url to open with HelloSign Embedded. -
optionsObject (optional) - See Options.
-
Open the
signUrlvia HelloSign Embedded.client.open(signUrl);
-
Open the
signUrlvia HelloSign Embedded with options.client.open(signUrl, { allowCancel: false, debug: true, locale: HelloSign.locales.ZH_CN });
client.close()
Closes the HelloSign Embedded signature request window if it is open.
Emits close.
client.close();client.on(event, callback[, context])
Inherited from tiny-emitter.
client.on('sign', (data) => {
console.log('The signature request was signed!');
});client.once(event, callback[, context])
Inherited from tiny-emitter.
client.once('sign', (data) => {
console.log('The signature request was signed!');
});client.off(event[, callback])
Inherited from tiny-emitter.
const handleSign = (data) => {
console.log('The signature request was signed!');
};
client.off('sign', handleSign);A HelloSign Embedded client instance emits the following events:
Emitted when the HelloSign Embedded window has closed. Usually this happens when the user presses the close button in the top right (if allowCancel: true), or if they press the Close Window button after sending, signing, declining, or reassigning the signature request. May also occur if the app fails to initialize within the given timeout (timeout) and is aborted. If the close event fires before sign (or reassign if applicable), then it can be gathered that the user canceled the signature request.
client.on('close', (evt) => {
console.log('The signature request was closed');
});Emitted when the user creates the signature request template.
Note: Embedded templating only.
-
titlestring - The signature request template title. -
messagestring - The signature request template message. -
signerRolesArray - The signature request template signer roles. -
signatureRequestInfoObject - The signature request template info.
client.on('createTemplate', (data) => {
console.log(`The signature request template "${data.title}" was created!`);
});Emitted when the user declines the signature request (if allow_decline=1).
Note: Embedded signing only.
-
signatureIdstring - The signature ID. -
reasonstring - The reason given by the user why the signature request was declined.
client.on('decline', (data) => {
console.log(`The signature request was declined because "${data.reason}"`);
});Emitted when the HelloSign app encounters an error.
-
signatureIdstring - The signature ID. -
codenumber - The error code.
client.on('error', (data) => {
console.log('Something went wrong! Please try again.');
client.close();
});Emitted when the HelloSign app embedded in the iFrame has initialized.
Note: Embedded signing only.
-
signatureIdstring - The signature ID.
client.on('initialize', (data) => {
console.log('The app has initialized');
});Emitted when HelloSign Embedded has received a cross-origin window message from the HelloSign app.
-
typestring - The window event message type. SeeHelloSign.messages. -
payloadObject - Data relevant to the window message event, if applicable. Not all window message events will contain a payload.
client.on('message', (data) => {
if (data.type === HelloSign.messages.USER_SIGN_REQUEST) {
console.log('The signature request was signed');
}
});Emitted when the HelloSign Embedded window has opened.
-
urlstring - The original URL. -
iFrameUrlstring - The final URL that will be embedded into the iFrame.
client.on('open', (data) => {
console.log('The signature request was opened');
});Emitted when the user reassigns the signature request (if allow_reassign=1).
Note: Embedded signing only.
-
signatureIdstring - The signature ID. -
namestring - The name of the reasignee. -
emailstring - The email of the reasignee. -
reasonstring - The reason given by the user why the signature request was reassigned.
client.on('reassign', (data) => {
console.log(`The signature request was reassigned to ${data.email} because "${data.reason}"`);
});Emitted when the user sends the signature request.
Note: Embedded requesting only.
-
signatureIdstring - The signature ID. -
signatureRequestIdstring - The signature request ID.
client.on('send', (data) => {
console.log('The signature request was sent!');
});Emitted when the user signs the signature request.
Note: Embedded signing only.
-
signatureIdstring - The signature ID.
client.on('sign', (data) => {
console.log('The signature request was signed!');
});-
allowCancelbooleanWhether or not to allow the user to cancel the signature request by showing a close button. This is only honored for embedded requesting or embedded templating.
Default:
true -
clientIdstringThe client ID for your API app.
Note: This must be specified in at least one place: either when instantiating a new HelloSign Embedded client, or in the
optionsofclient.open(). -
containerHTMLElementAn HTML element in the DOM which the embedded signature request iFrame will be appended to. By default, HelloSign Embedded will open in a modal.
-
debugbooleanWhether or not to display debug information in the console from the HelloSign app.
Default:
false -
hideHeaderbooleanWhether or not to hide the signature request header. Only honored for customers with embedded branding.
Default:
false -
localestringThe code for the language to use in the embedded request. Use
HelloSign.localesto view an enumerable of supported locale codes.Default:
"en_US" -
redirectTostringA URL pointing to where to redirect to after the embedded signature request has been completed by the user.
-
requestingEmailstringThe email of the account issuing the signature request.
Note: This option is only necessary for Me and Others type signature requests. If it is required, either specify when instantiating a new HelloSign Embedded client, or in the
optionsofclient.open(). -
skipDomainVerificationbooleanWhether or not to skip domain verification. Useful for testing signature requests on developer domains that don't match the API app's domain (like
localhost).Note: Only honored if the signature request was created via the API with
test_mode=1.Default:
false -
timeoutnumberHow long (in milliseconds) to wait for the HelloSign app to initialize before aborting.
Default:
30000(30 seconds) -
whiteLabelingObjectAn object used to customize the signer experience for premium users with white-labeling capabilities.
Having trouble? Let us know!
Welcome!
Below you will find links to the API documentation, frequently asked questions, and other useful tidbits.
Find something incorrect or missing? Shoot us an email or create an issue.
Having trouble? Let us know!