Delivery Channel Formatting

Overview

Delivery channels are the bridges between Transports and Smart Triggers. It defines how data that was emitted by your Smart Trigger is sent out to your Transport. You can configure different messages and format emitted data. See examples below.
Smart Trigger can have multiple delivery channels with different configurations.

Supported Formatters

eth
${value|eth}
${sender_balance_before|eth}
${sender_balance_after|eth}
${receiver_balance_before|eth}
${receiver_balance_after|eth}
Formats value of the transfer and balance from decimals to Integer (10^18 = 1 ETH)
btc
${value|btc}
${sender_balance_before|btc}
${sender_balance_after|btc}
${receiver_balance_before|btc}
${receiver_balance_after|btc}
Formats value of the transfer and balance from decimals to Integer (10^8 = 1 BTC)
dash
${value|dash}
${sender_balance_before|dash}
${sender_balance_after|dash}
${receiver_balance_before|dash}
${receiver_balance_after|dash}
Formats value of the transfer and balance from decimals to Integer (10^8 = 1 DASH)
algo
${value|algo}
${sender_balance_before|algo}
${sender_balance_after|algo}
${receiver_balance_before|algo}
${receiver_balance_after|algo}
Formats value of the transfer and balance from decimals to Integer (10^6 = 1 ALGO)
celo
${value|celo}
${sender_balance_before|celo}
${sender_balance_after|celo}
${receiver_balance_before|celo}
${receiver_balance_after|celo}
Formats value of the transfer and balance from decimals to Integer (10^18 = 1 CELO)
bsc
${value|bsc}
${sender_balance_before|bsc}
${sender_balance_after|bsc}
${receiver_balance_before|bsc}
${receiver_balance_after|bsc}
Formats value of the transfer and balance from decimals to Integer (10^18 = 1 BSC)
heco
${value|heco}
${sender_balance_before|heco}
${sender_balance_after|heco}
${receiver_balance_before|heco}
${receiver_balance_after|heco}
Formats value of the transfer and balance from decimals to Integer (10^18 = 1 HECO)
sol
${value|sol}
${sender_balance_before|sol}
${sender_balance_after|sol}
${receiver_balance_before|sol}
${receiver_balance_after|sol}
Formats value of the transfer and balance from decimals to Integer (10^9 = 1 SOL)
dot
${value|dot}
${sender_balance_before|dot}
${sender_balance_after|dot}
${receiver_balance_before|dot}
${receiver_balance_after|dot}
Formats value of the transfer and balance from decimals to Integer (10^10 = 1 DOT)
matic
${value|matic}
${sender_balance_before|matic}
${sender_balance_after|matic}
${receiver_balance_before|matic}
${receiver_balance_after|matic}
Formats value of the transfer and balance from decimals to Integer (10^18 = 1 MATIC)
dd/mm/yyyy
${block_timestamp|dd/mm/yyyy}
Converts unix timestamp to Date.
e.g. 31/05/2021
dd/mm/yyyy hh:mm
${block_timestamp|dd/mm/yyyy hh:mm}
Converts unix timestamp to Date with time. Timezone is UTC±00:00.
e.g. 31/05/2021 15:47
dd/mm/yyyy hh:mm:ss
${block_timestamp|dd/mm/yyyy hh:mm:ss}
Converts unix timestamp to Date with time and seconds. Timezone is UTC±00:00.
e.g. 31/05/2021 15:47:36
etherscan
${from|etherscan} ${to|etherscan} ${tx_hash|etherscan} ${block_number|etherscan}
Adds a link to the address, TxHash and block at etherscan.io
hecoinfo
${from|hecoinfo} ${to|hecoinfo} ${tx_hash|hecoinfo} ${block_number|hecoinfo}
Adds a link to the address, TxHash and block at hecoinfo.com
bscscan
${from|bscscan} ${to|bscscan} ${tx_hash|bscscan} ${block_number|bscscan}
Adds a link to the address, TxHash and block at bscscan.com
polkascan_polkadot
${from|polkascan_polkadot} ${to|polkascan_polkadot}
Adds a link to the address at polkascan.io/polkadot
polygonscan
${from|polygonscan} ${to|polygonscan} ${tx_hash|polygonscan} ${block_number|polygonscan}
Adds a link to the address, TxHash and block at polygonscan.com

Custom Formatters

When monitoring tokens with different number of decimals, you can declare your own formatter in your Smart Trigger code.
For example, you are monitoring transactions of a token, which has only 4 decimals. You need to add this line in process part of your code
1
let decimals = @erc20.decimals
Copied!
Then use your decimals formatter in your Delivery Channel as shown below.

Examples

Telegram Delivery Channel

Without formatters, a simple Telegram transport configuration will look like this
ETH Transaction of ${value} from ${from} to ${to} at ${block_timestamp}
Transferring 0,075 ETH from your monitored address (let’s call it 0xMyAddress) will make the Smart Trigger send this message:
ETH Transaction of 75000000000000000 from 0xMyAddress to 0xOtherAddress at 1622626444
Adding formatters to your configuration like this
ETH Transaction of ${value|eth} from ${from|etherscan} to ${to|etherscan} at ${block_timestamp|dd/mm/yyyy hh:mm:ss}
Will change the message to:
ETH Transaction of 0,075 from 0xMyAddress to 0xOtherAddress at 02/06/2021 09:34:04
Adding ‘message’ parameter
You can also use message parameter in your Smart Trigger’s code to add small messages to your notifications. For example, you are set to monitor your wallet and want to see the type of transaction right away - is it withdrawal or deposit?
To use this parameter, you need to write it in emit part of the code like this: message:"Your Message". See the code sample in the box below.
1
stream BalanceChanges
2
from Transfers
3
where @to == MyEthereumAddress || @from == MyEthereumAddress
4
process
5
if @to == MyEthereumAddress then
6
emit { @from, @to, @value, @block_timestamp, message:"Deposit!" }
7
end
8
if @from == MyEthereumAddress then
9
emit { @from, @to, @value, @block_timestamp, message:"Withdrawal!" }
10
end
11
end
Copied!
After that, we can use message parameter in Delivery Channel configuration. So, if we set the configuration to this:
${message} Amount: ${value|eth} ETH. From ${from|etherscan} to ${to|etherscan} at ${block_timestamp|dd/mm/yyyy hh:mm:ss}
We will receive the next notification if someone will make a deposit to our monitored address:
Deposit! Amount: 0,15 ETH. From 0xOtherAddress to 0xMyAddress at 02/06/2021 09:34:04

Google Sheets Delivery Channel

With Google Sheets you can analyze your address activity graphically, with charts, bars and pies! When adding Google Sheets transport to your Smart Trigger Delivery channel, a menu will pop-up. There you can:
  • include/exclude events
  • rename mapped column in a spreadsheet
  • set formatters for parameters
If you wish to change the order of those events, you need to change the order of those parameters in emit part of your Smart Trigger code, save it and redeploy it.
Last modified 13d ago