Hi!
I try to send webhook Key/Value pairs only if the corresponding Key/Value pair exist in the EVENT I got. Works with a tiny problem. Here the Details:
The custom JSON I use in the Webhook Integration:
{
"Unit": "{{{Unit}}}",
"SeqNum": "{{{SeqNum}}}",
"TSSend": "{{{TSSend}}}",
"GoodCounter": "{{{GoodCounter}}}",
"TSGCnt": "{{{TSGCnt}}}",
"{{#RejectCounter}}RejectCounter{{/RejectCounter}}": "{{{RejectCounter}}}",
"{{#TSRCnt}}TSRCnt{{/TSRCnt}}": "{{{TSRCnt}}}",
"{{#OpState}}OpState{{/OpState}}": "{{{OpState}}}",
"{{#TSOpState}}TSOpState{{/TSOpState}}": "{{{TSOpState}}}"
}
If an EVENT with all Key/Value pairs triggers the webhook all looks great…
EVENT
{
"Unit":"Prod-001"
"SeqNum":"15"
"TSSend":"2024-06-10 16:02:06"
"GoodCounter":"4"
"TSGCnt":"2024-06-10 16:02:03"
"RejectCounter":"1"
"TSRCnt":"2024-06-10 16:02:06"
"OpState":"0"
"TSOpState":"2024-06-10 16:02:03"
"DevName":"PMT-000002"
}
WEBHOOK
{
"Unit": "Prod-001",
"SeqNum": "15",
"TSSend": "2024-06-10 16:02:06",
"GoodCounter": "4",
"TSGCnt": "2024-06-10 16:02:03",
"RejectCounter": "1",
"TSRCnt": "2024-06-10 16:02:06",
"OpState": "0",
"TSOpState": "2024-06-10 16:02:03"
}
But if an EVENT triggers a webhook where a Key/Value pair was avoided an artefact appears => "": ""
EVENT
{
"Unit":"Prod-001"
"SeqNum":"10"
"TSSend":"2024-06-10 16:01:06"
"GoodCounter":"6"
"TSGCnt":"2024-06-10 16:01:06"
"DevName":"PMT-000002"
}
WEBHOOK
{
"Unit": "Prod-001",
"SeqNum": "10",
"TSSend": "2024-06-10 16:01:06",
"GoodCounter": "6",
"TSGCnt": "2024-06-10 16:01:06",
"": ""
}
Here another example…
EVENT
{
"Unit":"Prod-001"
"SeqNum":"1"
"TSSend":"2024-06-10 15:59:30"
"GoodCounter":"0"
"TSGCnt":"2024-06-10 15:59:30"
"OpState":"1"
"TSOpState":"2024-06-10 15:59:30"
"DevName":"PMT-000002"
}
WEBHOOK
{
"Unit": "Prod-001",
"SeqNum": "1",
"TSSend": "2024-06-10 15:59:30",
"GoodCounter": "0",
"TSGCnt": "2024-06-10 15:59:30",
"": "",
"OpState": "1",
"TSOpState": "2024-06-10 15:59:30"
}
Where is my fault?
Thanks for any help
Andreas