Subscriptions can be filtered so that the webhook is only notified if certain conditions are met. Filters can be applied to the root of the response via the "filter" parameter, or to the enriched data via the "enrichmentFilter" parameter. Filters use [jq](https://stedolan.github.io/jq/manual/#Basicfilters) syntax for filtering. If all filters return `true`, the data is sent to the webhook.

Sample FX RFID Reader Payload

This is an example of the JSON payload coming from the FX RFID Reader:
{
   "deviceId":"RFID84248DEF95C1",
   "antennaId":"1",
   "epc":"016500041085000000000000",
   "id": "[string]",
   "orgId": "[string]",
   "event":"out",
   "timestamp":"2019-10-28 14:10:00.010",
   "jsonData":"{\"lastSeen\":\"2019-10-28 14:09:54.009\",\"peakRssi\":\"-69\",\"latitude\":\"33.2425071\",\"longitude\":\"-117.3163298\"}",
   "type":"readTransaction"
}

Filter Examples Using jq on the RFID Reader Payload

EPC tag exact match:               .epc == "016500041085000000000000"

EPC tag contains:                     .epc | test("165", "i")

EPC tag starts with:                  .epc | test("^01", "i")

IN range event:                        .event | test("in", "i")

OR IN range event:                  .event == "in"

Antenna ID exact match:         .antennaId == "1"

Antenna ID one or another:     .antennaId == "1" or .antennaId == "2"

Peak RSSI value greater than [-5]:      

     if .jsonData | test("peakRssi\":\"-5") then true elif .jsonData | test("peakRssi\":\"-4") then true elif .jsonData | test("peakRssi\":\"-3") then true elif .jsonData | test("peakRssi\":\"-2") then true elif .jsonData | test("peakRssi\":\"-1") then true else false end

Combining Filters

Each Filter can be combined with 'and' / 'or' operators. Be sure to enclose each filter in a set of parantheses.
The example below combines three filters from the example above using 'and' and 'or'. This filter sends tags to the WebHook if the tag starts with 165 and when the RSSI value is above -6, or any tag seen by Antenna 1.

  (if .jsonData | test("peakRssi\":\"-5") then true elif .jsonData | test("peakRssi\":\"-4") then true elif.jsonData | test("peakRssi\":\"-3") then true elif.jsonData | test("peakRssi\":\"-2") then true elif.jsonData | test("peakRssi\":\"-1") then true else false end and (.epc | test("165") )) or .antennaId == "1"