# Hook

The hook endpoints in v1-beta support the same functionality as the hook endpoints in v1, but also contain some extra features that are still in the beta stage. For basic information about hooks, please visit our hooks documentation page for v1.

# Filters

Filters can be used to add certain conditions to trigger hooks. For example, only trigger a ReviewReceived hook when the verdict is "reject" or only trigger an "InvoiceReceived" hook when the sender is a given party.

# Adding a filter

Filters can be added via the POST /api/v1-beta/{partyId}/hook endpoint, using the "filter" field.

  "id": "1", 
  "action": "mailto:techsupport@econnect.eu", 
  "name": "filter hook ", 
  "topics": [ 
  "filter": "verdict == \"reject\"",
  "isActive": true 

This hook will only trigger when the verdict for the received review is "rejected".

Filters use a lambda syntax and allow multiple conditions in one filter, for example:

"sender == \"0106:123\" || sender == \"0106:456\" && verdict == \"accept\""

# Webhook using mutual SSL

With the endpoint PUT /api/v1-beta/{partyId}/hook in the PSB Api Beta you can setup a hook with mutual SSL authentication. To be able to use mutual SSL the “Init” object can be used. In this object the certificate can be added as base64 encoded string:

  "id": "1",
  "name": "ssl hook",
  "action": "https://econnect.eu”,
  "topics": [
  "publishTopics": null,
  "isActive": true,

Setting a certificate is one-time action. The certificate is then saved when the hook is modified. When you update the hook, for example by adding a topic, you do not have to provide the certificate again. The certificate can no longer be read back via the GET / hook. Currently PEM and PKCS # 12 (.pfx and .p12) certificates are supported. The certificate must contain the public and private key and must not be password protected. To create a base64 encoded string from a certificate you can use OpenSSL, or the following Powershell command:

$fileContentBytes = get-content 'C:\certificaat.pfx' -Encoding Byte
[System.Convert]::ToBase64String($fileContentBytes) | Out-File ‘certificaat_base64string.txt’
© 2021 eConnect International B.V.