Hey @maurelian! You can find the docs for this feature here, we'll get them published to the docsite shortly. What you're looking for is:
Custom notification templates render dynamic content using inline templating. Any string surrounded by double curly braces will be resolved against the Event Schema. Deeply nested items (including those in arrays) can be accessed using dot notation.
{
"transaction": { // eth_getTransactionReceipt response body
... // see https://eips.ethereum.org/EIPS/eip-1474
},
"blockHash": "0xab..123", // block hash from where this transaction was seen
"matchReasons": [ // the reasons why sentinel triggered
{
"type": "event", // event, function, or transaction
"signature": "...", // signature of your event/function
"condition": "value > 5", // condition expression (if any)
"args": ["5"], // parameters by index (unnamed are present)
"params": { "value": "5" } // parameters by name (unnamed are not present)
"metadata": {...} // metadata injected by Autotask Condition (if applicable)
}
],
"sentinel": {
"id": "44a7d5...31df5", // internal ID of your sentinel
"name": "Sentinel Name", // name of your sentinel
"abi": [...], // abi of your address (or undefined)
"address": "0x000..000", // address your sentinel is watching
"confirmBlocks": 0, // number of blocks sentinel waits
"network": "rinkeby" // network of your address
"chainId": 4 // chain Id of the network
}
}
You can do something like {{ matchReasons.0.signature }} to get the event name in the template. We don't support loops (yet), but if you define just a match reason in your sentinel, you should be good. Let us know if this works for you!
Figured I'd use this existing thread since I'm also trying to setup Sentinel notifications for the first time, and am struggling to use the template syntax to make things human friendly. I checked the docs and it seems something like this isn't possible, but for example I'd love to do something where:
ERC-20 Transfer events give a notification of "{{ ENS || address }} sent {{ 125 }} {{ DAI }} to {{ ENS || address }}"
ERC-20 Approval events in the same sentinel give a notification of "{{ ENS || address }} approved {{ ENS || address }} to spend {{ 125 }} {{ DAI }}"
They specific features here being:
Conditionally map the match reason to a custom string
Replace token addresses to their symbols or names
Parse amounts based on the number of decimals
Reverse resolve addresses
Are any of these features currently possible, and if not are they planned? A potential workaround would be allowing users to specify a JS function that takes available parameters and returns a notification string, but I'm not sure if that's possible/planned either
We have now included the {{value}} template variable which allows you to access the transaction value property. We have also updated the documentation if you want to read more about it.
have you received any update on this? I'd also like to create more human-friendly notifications (showing symbol and name, parsing a timestamp to date, format values, etc). cc @nami