Create and manage webhooks

Painlessly set up and monitor your webhooks

Use webhooks to integrate proposal, contract (refers to a subscription or a proposal renewal or change) and payment data to your applications.

Summary

In this article, we will go through the steps to set up and test a webhook in your Cacheflow instance. We will also define Cacheflow webhook event types and variables and give examples of each payload.

Implementation

Add a Webhook

Adding a webhook event trigger to your Cacheflow instance is easy! First, navigate to the Webhooks tab from Account > Integrations and Connectors > API. Click on the ellipsis and select “Add a webhook.”

Info needed:
Webhook name
Endpoint URL
Event Type

Enter a name for your webhook and paste in the endpoint URL. Select the desired event type trigger and click Submit.

Testing a webhook

Once the webhook has been added, test it by clicking the “Test” button to the left of the webhook in the list. The test will show the send status below the webhook details.

Example test data

Example test data

View webhook events history

View a list of triggered webhook and API events by clicking on the Events tab, next to the Webhooks tab. Easily review event details and confirm that your webhook set up is working as expected.

Event Types

statement_posted

Cacheflow will send out a statement_posted webhook event when the billing cycle is complete and an invoice should be issued to a customer.

Payload example:

{  
  "id": "5a954db6-e297-4688-b321-3713407b31ac",  
  "eventType": "statement_posted",  
  "referenceType": "billingschedule",  
  "fields": {  
    "id": "5a954db6-e297-4688-b321-3713407b31ac",  
    "updatedAt": "2024-04-21T16:22:49.601618Z",  
    "contractId": "d92ee834-ec49-43b7-af86-df1d1548c021",  
    "invoiceId": "b0652ad8-020d-46bf-9c6d-9a0a4d4618e5",  
    "invoiceStatus": "open",  
    "invoiceNumber": "INV-1234",  
    "purchaseOrderNumber": "PO-5678",  
    "scheduleDate": "2024-05-21",  
    "issueDate": "2024-05-24",  
    "dueDate": "2024-06-23",  
    "currency": "USD",  
    "totalAmountDue": 1000,  
    "amountWithoutTax": 900,  
    "taxAmount": 100,  
    "balance": 1000  
  }  
}

Variable NameTypeDescription
contractIdUUIDID of the subscription in Cacheflow
invoiceIdUUIDID of the invoice in Cacheflow
invoiceStatusInvoiceStatusThe status of the invoice
invoiceNumberStringThe invoice number
purchaseOrderNumberStringThe purchase order number, if available
scheduleDateLocalDateThe day when the service period starts. Recurring items are billed at the beginning of the period.
issueDateLocalDateThe day the invoice should be sent to the customer
dueDateStringThe day payment is due
currencyStringThe currency of the amounts
totalAmountDueLongThe total amount that should be charged, including usage and tax (if enabled)
amountWithoutTaxLongThe amount that should be charged without tax
taxAmountLongThe amount of tax that should be charged
balanceLongThe balance of the customer, representing the amount that is due from the customer

billing_schedule_updated

Sent when a billingSchedule has been updated with usage data.

Payload example:

{  
  "id": "5b0d09aa-d82d-4ffe-8fc1-202fdb235831",  
  "eventType": "billing_schedule_updated",  
  "referenceType": "billingschedule",  
  "fields": {  
    "id": "5b0d09aa-d82d-4ffe-8fc1-202fdb235831",  
    "updatedAt": "2024-04-21T21:56:45.487244Z",  
    "contractId": "bfaac68f-d6a4-4fd6-9081-2ada19390c54",  
    "amountDue": 0,  
    "currency": "USD"  
  }  
}

Variable NameTypeDescription
contractIdUUIDID of the subscription in Cacheflow
currencyStringThe currency of the amounts
amountDueLongThe current total amount that should be charged, including any usage charges. Tax is not included.

proposal_updated

Sent when a proposal is created or updated by the seller or by a contact that is associated with the proposal.

Payload example:

{  
  "id": "cf2ad997-7c85-4f5c-ab69-aef9e7caf2f8",  
  "eventType": "proposal_updated",  
  "referenceType": "proposal",  
  "fields": {  
    "id": "cf2ad997-7c85-4f5c-ab69-aef9e7caf2f8",  
    "updatedAt": "2024-04-21T22:18:34.904231Z",  
    "name": "Test Proposal",  
    "status": "accepted",  
    "proposalEventType": "updated",  
    "sellerEmail": "[[email protected]](mailto:[email protected]) ",  
    "contact": {  
      "firstName": "Bobby",  
      "lastName": "Jones",  
      "email": "[[email protected]](mailto:[email protected]) "  
    },  
    "customer": {  
      "id": "36a86954-0849-4f5d-8af3-23d159e4b422",  
      "name": "Test Customer"  
    }  
  }  
}

Variable NameTypeDescription
nameStringName of the proposal
statusProposalStatusThe current status of the proposal
proposalEventTypeProposalEventTypeThe type of event that triggered this webhook. See type values below.
sellerEmailStringThe email of the seller that created the proposal
contactContactThe contact who interacted with the proposal
customerCustomerSummaryThe customer that the proposal is associated with

ProposalEventType

ValueAssociated ActorDescription
createdSellerProposal created by seller
updatedSellerProposal updated by seller
archivedSellerProposal archived by seller
activatedSellerShared with contact, no signing required
startedSellerShared with contact when signing required
set_to_draftSellerSet back to draft by seller
contact_addedSellerContact added to proposal
contact_removedSellerContact removed from proposal
expiredSellerProposal expired
cancelledSellerProposal cancelled by the seller
deletedSellerProposal deleted by the seller
restoreSellerSeller restored an archived proposal
seller_downloadedSellerSeller downloaded the proposal
buyer_downloadedBuyerBuyer downloaded the proposal
buyer_printedBuyerBuyer printed the proposal
viewedBuyerBuyer viewed the proposal
unviewable_statusBuyerBuyer tried to view but proposal is not in a viewable status
acceptedBuyerBuyer accepted the proposal
invitedBuyerBuyer invited another contact to the proposal
created_signing_docBuyerBuyer created the signing document
cancelled_signing_docBuyerBuyer cancelled the signing document
signedBuyerBuyer signed the proposal
buyer_updatedBuyerBuyer updated the billing contact or purchase order number
billing_method_addedBuyerBuyer added a new billing method to proposal (for renewal)
renewal_pendingBuyerBuyer accepted the renewal proposal
approval_requestedAdmin/ApproverApproval for proposal requested
approval_approvedAdmin/ApproverProposal approval granted
approval_rejectedAdmin/ApproverProposal approval rejected
approval_canceledAdmin/ApproverProposal approval process canceled

contract_updated

Sent whenever a contract (subscription) is created, changed, renewed, canceled or ended. An event is also sent if the purchaseOrderNumber is updated.

Payload example:

{  
  "id": "891a4d07-36ea-43f7-81f8-78d75b2daf20",  
  "eventType": "contract_updated",  
  "referenceType": "contract",  
  "fields": {  
    "id": "891a4d07-36ea-43f7-81f8-78d75b2daf20",  
    "name": "Test Contract",  
    "externalId": "external-5678",  
    "contractNumber": "CON-1234",  
    "status": "active",  
    "contractEventType": "created",  
    "customer": {  
      "id": "b32a14f5-b010-424f-9f9f-6f71b989347f",  
      "name": "Test Customer"  
    },  
    "currency": "USD",  
    "totalAmount": 10000,  
    "startDate": "2024-04-21",  
    "endDate": "2025-04-21"  
  }  
}

Variable NameTypeDescription
nameStringName of the contract
externalIdStringThe external ID of the contract
contractNumberStringThe contract number
statusContractStatusThe current status of the contract (active, paused, cancelled, ended)
contractEventTypeContractEventTypeThe type of event that triggered this webhook. See below for type values.
customerCustomerSummaryThe customer that the contract is associated with
currencyStringThe currency of the contract
totalAmountLongThe total amount of the contract as a result of the contract event
startDateLocalDateThe start date of the contract
endDateLocalDateThe end date of the contract

ContractEventType

ValueDescription
createdThe contract was initially created.
billing_addedBilling information was added to the contract
billing_updatedExisting billing information was updated.
accepted_changeA change to the contract was accepted.
accepted_renewalA contract renewal was accepted.
renewal_appliedA renewal was applied to the contract.
renewal_dueThe contract is due for renewal.
canceledThe contract was canceled.
updatedThe contract purchaseOrderNumber was updated
endedThe contract reached its term end date.

transfer_completed

Sent when a transfer is completed either by the payment being processed by an external system or a manual update by the admin.

Payload example:

{  
  "id": "c59fbdcc-2ae2-4107-866e-c81f0ecb81ab",  
  "eventType": "transfer_completed",  
  "referenceType": "transfer",  
  "fields": {  
    "id": "c59fbdcc-2ae2-4107-866e-c81f0ecb81ab",  
    "updatedAt": "2024-04-21T23:38:24.11221Z",  
    "status": "failed",  
    "reason": "over credit limit",  
    "amount": 500,  
    "paidAmount": 0,  
    "currency": "USD",  
    "referenceType": "invoice",  
    "referenceId": "6401ea99-ecc3-4caa-9728-76d2cfc5ba1f",  
    "parentType": "contract",  
    "parentId": "e7e201a6-b3fb-4319-aee6-3813fbba74a1",  
    "customer": {  
      "id": "7f2b738e-5c08-49ff-8e7f-cafc15208832",  
      "name": "Test Customer"  
    }  
  }  
}

Variable NameTypeDescription
statusTransferStatusThe status of the transfer. See status list below.
paymentTypePaymentTypeThe type of payment that was made
reasonStringThe failure reason if the transfer did not succeed
amountLongThe total amount the transfer was for
paidAmountLongThe amount that was actually paid
currencyStringThe currency of the transfer
referenceTypeReferenceTypeThe type of reference the transfer was for, typically the invoice
referenceIdUUIDThe ID of the reference the transfer was for, typically the invoice ID
parentTypeReferenceTypeThe type of secondary reference the transfer was for, typically the contract
parentIdUUIDThe ID of the secondary reference the transfer was for, typically the contract ID
customerCustomerSummaryThe customer that the transfer was for

TransferStatus

StatusDescription
pendingThe default status when a transfer is created and should be processed.
in_progressA transfer that has started and is awaiting a response from an external system.
failedThe transfer failed (e.g., card declined). Failed transfers will be retried a specified number of times. See more information in this article.
postedThe transfer completed successfully.
canceledThe transfer is canceled and will no longer be tried.
declinedThe payment method was declined and will not be retried