Some webhook events can be very chatty and you may wish to filter out some events you are uninterested in. Or you may only be interested in a specific event. This can be achieved by setting a filter on your subscription. The following options can be used to limit what events you receive.
Each subscription has it's own filter object used to set which filters you want to define. The filter object has the following properties:
Parameter Name | Description | Type | Example Data |
---|---|---|---|
programmes
|
A list of each programmeCode that should be included in this subscription. |
array | ["8ffd4f55", "887efa06"] |
policyTypes
|
A list of each policyTypeCode that should be included in this subscription. |
array | ["17ed9895"] |
countries
|
A list of each countryCode that should be included in this subscription. |
string | ["GB", "IE"] |
fields
|
Object containing any field filters defined for this subscription. | object | See fields section below. |
If you have access to multiple programmes in Claims Manager, you can specify specific programmes to limit the subscription to.
Use the programmeCode
found in the metadata/programmes
endpoint.
You can limit events to a specific policy type by setting a policy type filter. As with programmes above,
just add each policyTypeCode
that you want to receive events for to the array. These codes can be found in the metadata/programmes
endpoint.
You can limit events to incidents in a specific policy country by setting a country filter. Again as above, just add each countryCode
that you want to filter by
to the array. Country codes are the 2 character ISO country code (GB for the United Kingdom for example).
Field filters relate to the data field contained in each webhook event’s payload. You are able to set filters on any field contained in this data recordset. For example, if you are only interested in Event Log Entries from the New Events webhook event, you could set a filter on the eventType field to only send data when this is ‘Event Log Entry’. You could further limit this by including another filter on the category field to only include events where this is ‘Report: Final’. The result of these two filters would be that this subscription would only send data to your endpoint when an Event Log Entry for a Report: Final event was created.
When setting up a filter on a field, you need to add a record to the fields
array in the filters object. Each field
object should have the following properties:
Parameter Name | Description | Type | Example Data |
---|---|---|---|
name
|
The name of the field that you want to add the filter to. Consult the documenation of the specific webhook event that you are subscribing to for a list of fieldnames in the payload. | string | eventType |
operator
|
The operator that this filter should use. Currently, only equals and not equals are supported. |
string | equals |
value
|
The value to evaluate the payload against. | string | Event Log Entry |
Multiple field
against the same name
will act differently depending on if the operator
is 'equals' or 'not equals'. When the operator
is 'equals', the multiple records will act as an OR condition. When the operator
is 'not equals', the multiple records will act as an AND condition. Multiple field
records against different name
records will act as AND conditions.
The following examples should give you an idea of how to structure your filters to acheive the results you need.
The most simple filter we can apply would be to just limit the programme where we have access to multiple programmes. For this example, we'll just add a filter for the Demonstration Programme. Note that we can omit the rest of the properties entirely as we don't want to set any value to them:
{
"programmes": [ "8ffd4f55" ]
}
Let's say that you wanted to only receive webhooks from the New Event action when the event was either an Event Log Entry or Correspondence Entry. Additionally, you only wanted to receive these webhooks where the programme was the Demonstration Programme, the policy type was one of Motor or Product Liability, and the policy country was the United Kingdom. We could achieve this with the following filter:
{
"programmes": [ "8ffd4f55" ],
"policyTypes": [ "17ed9895", "500a0d5a" ],
"countries": [ "GB" ],
"fields": [
{
"name": "eventType",
"operator": "equals",
"value": "Event Log Entry"
},
{
"name": "eventType",
"operator": "equals",
"value": "Correspondence Entry"
}
]
}
Finally, we'll show how multiple filters against multiple different field
records work. Let's imagine we want to receive webhooks from
the New Transaction action. But we are only interested in receiving this webhook when the transactionType
is a Payment or Reserve. Additionally, we don't care about these where the costHeading
is Expense or Recovery. The following filter would fulfil our needs:
{
"fields": [
{
"name": "transactionType",
"operator": "equals",
"value": "Payment"
},
{
"name": "transactionType",
"operator": "equals",
"value": "Reserve"
},
{
"name": "costHeading",
"operator": "not equals",
"value": "Expense"
},
{
"name": "costHeading",
"operator": "not equals",
"value": "Recovery"
}
]
}