Appearance
Document Webhooks
As a document changes status during its life cycle there is often a need to track this progress in an external system. One way to accomplish that is to subscribe to document webhooks.
Webhook event | Trigger |
---|---|
document.created | A new document was created |
document.sent | Document status was changed to sent |
document.viewed | First time any client views the document |
document.answered | A client answered a document |
document.accepted | Document status was changed to accepted |
document.acceptedPdf | The auto generated PDF after accept is ready to be downloaded from url |
document.denied | Document status was changed to denied |
document.expired | Document status was changed to expired |
document.voided | Document status was changed to voided |
document.smsDropped | Failed to deliver SMS |
document.mailDropped | Failed to deliver email |
companyExpense.created | A new companyExpense was created (only for some accounts) |
Example
When a webhook is triggered we send a POST
request on the format:
js
const request = {
method: 'POST',
url: 'https://example.com', // You decide which URL to call
body: {
type, // Webhook type such as 'document.created'
typeId, // Document.id
source, // webhookSubscription
sourceId, // webhookSubscription.id
companyId,
createdAt, // When the webhook was triggered
data // JSON data of the document
}
}
You should respond with a successful HTTP response status such as 200, we will retry up to five times with exponential back off if we were not able to receive a valid HTTP response status.