Alerting Examples

Kovan DAI Transfer

{
    "alerts": [
        {
            "type": "Webhook (POST)",
            "payload": [
                {
                    "fieldName": "transactionHash",
                    "fieldType": "Field"
                },
                {
                    "fieldName": "args",
                    "fieldType": "Sub Field",
                    "subPayloads": [
                        {
                            "fieldName": "dst",
                            "fieldType": "Field"
                        },
                        {
                            "fieldName": "src",
                            "fieldType": "Field"
                        },
                        {
                            "fieldName": "wad",
                            "fieldType": "Field"
                        }
                    ]
                }
            ],
            "parameters": {
                "url": "https://mywebhook.example/{transactionHash}/{args#src}"
            }
        }
    ],
    "targetMap": [
        {
            "name": "address",
            "value": "0xC4375B7De8af5a38a93548eb8453a498222C4fF2",
            "operator": "Equals"
        },
        {
            "name": "event",
            "value": "Transfer",
            "operator": "Equals (ignore case)"
        },
        {
            "name": "args",
            "operator": "Inspect",
            "operatorParameters": [
                {
                    "name": "dst",
                    "value": "0x52243C97DD8556fe1092084c199aeFAD4c34fD89",
                    "operator": "Equals (ignore case)"
                }
            ]
        }
    ],
    "targetType": "Event"
}

Kovan ETH Traces

{
    "alerts": [
        {
            "type": "Webhook (POST)",
            "payload": [
                {
                    "fieldName": "transactionHash",
                    "fieldType": "Field"
                },
                {
                    "fieldName": "trace",
                    "fieldType": "Sub Field",
                    "subPayloads": [
                        {
                            "fieldName": "action",
                            "fieldType": "Sub Field",
                            "subPayloads": [
                                {
                                    "fieldName": "to",
                                    "fieldType": "Field"
                                }
                            ]
                        }
                    ]
                }
            ],
            "parameters": {
                "url": "https://mywebhook.example/{transactionHash}/{args#src}"
            }
        }
    ],
    "targetMap": [
        {
            "name": "trace",
            "operator": "Inspect",
            "operatorParameters": [
                {
                    "name": "action",
                    "operator": "Inspect",
                    "operatorParameters": [
                        {
                            "name": "to",
                            "value": "0x52243C97DD8556fe1092084c199aeFAD4c34fD89",
                            "operator": "Equals (ignore case)"
                        }
                    ]
                }
            ]
        }
    ],
    "targetType": "Trace"
}

Full Alerting

Usage of all possible alert-triggers were all events (decoded logs) are matched that have:

  • address = 0xe3818504c1B32bF1557b16C238B2E01Fd3149C17
  • event = Transfer
  • to = 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819
  • value > 999999
{
    "targetType": "Event",
    "targetMap": [
        {
            "name": "address",
            "value": "0xe3818504c1B32bF1557b16C238B2E01Fd3149C17",
            "operator": "Equals"
        },
        {
            "name": "event",
            "value": "Transfer",
            "operator": "Equals (ignore case)"
        },
        {
            "name": "args",
            "operator": "Inspect",
            "operatorParameters": [
                {
                    "name": "to",
                    "value": "0x8d12A197cB00D4747a1fe03395095ce2A5CC6819",
                    "operator": "Equals (ignore case)"
                },
                {
                    "name": "value",
                    "value": "999999",
                    "operator": "Greater",
                    "useScaledValue": true
                }
            ]
        }
    ],
    "alerts": [
        {
            "type": "Slack",
            "payload": [
                {
                    "fieldName": "transactionHash",
                    "fieldType": "Field"
                },
                {
                    "fieldName": "args",
                    "fieldType": "Sub Field",
                    "subPayloads": [
                        {
                            "fieldType": "Field",
                            "fieldName": "to"
                        }
                    ]
                }
            ],
            "parameters": {
                "url": "https://hooks.slack.com/services/myslackhookurl",
                "text": ":warning: There has been a new alert match",
                "channel": "#alerting",
                "username": "#blockchain-alerting-bot"
            }
        },
        {
            "type": "Email",
            "payload": [
                {
                    "fieldName": "transactionHash",
                    "fieldType": "Field"
                },
                {
                    "fieldName": "args",
                    "fieldType": "Sub Field",
                    "subPayloads": [
                        {
                            "fieldType": "Field",
                            "fieldName": "to"
                        }
                    ]
                }
            ],
            "parameters": {
                "recipients": [
                    "[email protected]",
                    "[email protected]"
                ]
            }
        },
        {
            "type": "Webhook (GET)",
            "parameters": {
                "url": "https://mywebhook1.example/{transactionHash}/{args#to}"
            },
            "payload": [
                {
                    "fieldType": "Field",
                    "fieldName": "transactionHash"
                },
                {
                    "fieldType": "Sub Field",
                    "fieldName": "args",
                    "subPayloads": [
                        {
                            "fieldType": "Field",
                            "fieldName": "to"
                        }
                    ]
                }
            ]
        },
        {
            "type": "Webhook (POST)",
            "parameters": {
                "url": "https://mywebhook2.example"
            },
            "payload": [
                {
                    "fieldType": "Field",
                    "fieldName": "transactionHash"
                },
                {
                    "fieldType": "Sub Field",
                    "fieldName": "args",
                    "subPayloads": [
                        {
                            "fieldType": "Field",
                            "fieldName": "to"
                        }
                    ]
                }
            ]
        }
    ]
}