Webhooks > Introduction

Webhooks are a great way for your system to receive near real-time updates from Hyfin without the need to constantly polling. When enabled, your system will be notified as soon as an event is trigger within Hyfin.

Activation des webhooks

Webhooks can be enabled on a per site or per invoice basis by assigning a webhook URL when calling the associated endpoints. Here is an example of the json data required to enable webhooks for each endpoint.


Point de terminaison
Échantillon JSON
Add/Update Site
When adding or editing a new site, you can enable a webhook at the site level. If a site level webhook is enabled you will receive all invoice and payment notifications for the site.
			
				{
  "external_id": "12345678",
  "webhook": {
    "active": true,
    "url": "https://mysoftware.com/webhook"
  }
}
			
		
Add/Update Invoice
When adding or editing an invoice, you can enable a webhook at the invoice level and you will receive all notifications related to the invoice.
			
				{
  "external_id": "39772921",
  "webhook_url": "https://mysoftware.com/webhook/{invoice_id}"
}
			
		

Événements de webhook

When a webhook URL is configured, the following messages will be sent.

Action
Détail
Paiement
Un paiement réussi est effectué sur une facture
Notification
A link failed to delivery, was successfully delivered, the customer clicked the link, etc.

Tentatives

The webhook URL must return a successful HTTP response code (200) within 10 seconds or it will be considered to have failed to receive it. If this happens, all webhook messages will be re-sent using the following schedule.

Tentative de réessai
Re-sent at
#1
5 minutes après le webhook initial
#2
1 heure plus tard
#3
2 heures plus tard
#4
24 heures plus tard
#5
48 heures plus tard