Events
On this page you can find definition of every event, available on the Autograph client instance. They should be used like this:
autograph.on(eventName, callback)
Auth error
Name to use in on
method:
auth-error
Payload, that will be passed to a callback:
undefined
This event will be fired in case any request to Autograph API will fail with 403 error. Likely, in a callback of this event you will need to clear user's auth data and destroy client instance. This does not happen automatically.
Example:
autograph.on('auth-error', () => {
autograph.destroy()
// ...clear user auth data here
})
Document prepared
Name to use in on
method:
document-prepared
Payload, that will be passed to a callback:
{
signatureRequestId: '14463087-cc73-4e06-ba6d-281d322f42e7'
}
This event will be fired after clicking Continue on the last step of document preparation steps. That would mean an email saying there is a document waiting for signing will be sent to first recipient shortly. Client will still stay on Review and send step, so you'll likely will want to unmount it and show some success message to your user.
Example:
autograph.on('document-prepared', () => {
// ...show some success notification or success page
})
Document signed
Name to use in on
method:
document-signed
Payload, that will be passed to a callback:
undefined
This event will be fired after clicking Continue on sign step and confirming finishing a session in a modal. Client will still stay on the sign step, so you'll likely will want to unmount it and show some success message to your user. PDF file will be unmounted, though, so user will not be able to interact with it after signing anyway.
Example:
autograph.on('document-signed', () => {
// ...show some success notification or success page
})
Document declined
Name to use in on
method:
document-declined
Payload, that will be passed to a callback:
undefined
This event will be fired after clicking Cancel on Sign step and then Yes, decline in the Confirm Decline modal. The client will still stay on Sign step, so you'll likely will want to unmount it and show some message to your user.
Example:
autograph.on('document-declined', () => {
// ...show some notification
})
Template prepared
Name to use in on
method:
template-prepared
Payload, that will be passed to a callback:
undefined
This event will be fired after clicking Continue on the last step of template preparation steps. Client will still stay on Prepare step, so you'll likely will want to unmount it and show some success message to your user.
Example:
autograph.on('template-prepared', () => {
// ...show some success notification or success page
})
General error
Name to use in on
method:
general-error
Payload, that will be passed to a callback:
{
"messageText": "Error text"
}
This event will be fired in case any error happens inside the client. In most of the cases that would be API call error, but there may be other. You can use messageText
property from event payload to show some notification to a user.
Example:
autograph.on('general-error', payload => {
showErrorNotification(payload.messageText)
})
General exit
Name to use in on
method:
general-exit
Payload, that will be passed to a callback:
undefined
This event indicates ending of some process and you'll likely want to unmount the client after that. For example – clicking Cancel in the process of document preparation or Save for later during signing.
Example:
autograph.on('general-exit', () => {
autograph.destroy()
})
General success
Name to use in on
method:
general-success
Payload, that will be passed to a callback:
{
"messageText": "Success text"
}
This event indicates successful completion of some process and you'll likely want to show some success notification to your user. For example – renaming a document in a process of preparation.
Example:
autograph.on('general-success', payload => {
showSuccessNotification(payload.messageText)
})
Participant added
Name to use in on
method:
participant-added
Payload, that will be passed to a callback:
{
"email": "john@doe.com",
"name": "John Doe"
}
This event indicates the adding of a participant on the "Add recipients" step. It contains an email and a name of a recipient that was added.
Example:
autograph.on('participant-added', contactData => {
// Create new contact for current user if it is not in their contacts list yet
})