This section described the support for webhooks that enable integration with external workflow automation, such as n8n.io, Zapier and others.
Webhooks can be triggered to 3rd party about changes (hooks) in the system. This can help 3rd party or integrators to extends and integrated BillRun billing to more systems and allow adding complex business flow involving more than the billing itself.
Entities are also known as modules. Here are the entities supported:
- accounts
- autorenew
- balances
- discounts
- lines (delete only)
- plans
- prepaidgroups
- prepaidincludes
- queue (delete only)
- rates
- services
- subscribers
- taxes
- users
Action is the change or behaviour happened in the system. Here are the actions supported:
- trackchanges - any change on billapi for the above entities list.
- bills module actions:
- afterChargeSuccess - after successful charge.
- afterPaymentAdjusted - after payment adjustment.
- afterRefundSuccess - after successful refund.
- afterInvoiceConfirmed - after invoice confirmation.
- afterRejection - after payment rejection.
- afterDenial - after deniel of payment (by the customer).
- afterBalanceUpdate - balances update action on customer pricing.
- afterBalanceCreation - postpaid balance creation action on customer pricing. For prepaid, use trackchanges of balances collection.
- events module actions:
- create - billing event created.
- notify - billing event notified.
- collection process actions:
- in_collection - customer enter to dunning collection
- out_of_collection - customer exit to dunning collection
- custom step collection action
3rd party can also create, delete, read & update webhooks through API, in addition to fetching the webhook.
Before starting to use the API, you'll required to enable the webhooks plugin under General Settings → Plugins tab.
URL: http://<HOST>/plugins/webhooks/create
Parameters:
- webhook_module - the entity required to trigger the webhook (see entities list above in this article).
- webhook_action - the action required to trigger the webhook (see action list above in this article).
- webhook_url - the url the webhook trigger to (need to have http access from the billing access).
- webhook_id [optional] - setup id for this webhook. If not received will be auto generated.
Return json with the following properties:
- status: 1 if success, else 0.
- webhook: object with all the properties of the webhook. Required to save webhook_id to be handle further actions.
URL: http://<HOST>/plugins/webhooks/delete/{id}
Parameters:
- webhook_id or {id} in the URL: the webhook id required to be deleted.
Return json with the following properties:
- status: 1 if success, else 0.
- webhook_id: the webhook id that was deleted (will not be exists if delete failed).
URL: http://<HOST>/plugins/webhooks/read/{id}
Parameters:
- webhook_id or {id} in the URL: the webhook id required to be received.
Return json with the following properties:
- status: 1 if success, else 0.
- webhook: object with all the properties of the webhook.
URL: http://<HOST>/plugins/webhooks/update/{id}
Parameters:
- webhook_id or {id} in the URL: the webhook id required to be updated.
- webhook_module - the entity required to trigger the webhook (see entities list above in this article).
- webhook_action - the action required to trigger the webhook (see action list above in this article).
- webhook_url - the url the webhook trigger to (need to have http access from the billing access).
Return json with the following properties:
- status: 1 if success, else 0.
- webhook: object with all the properties of the webhook. Property exists only if success.
Pluginable API