Tangocrypto
Search…
How to create webhooks
Fine grained control for the information you want to receive from the blockchain.
You can create rules or trigger conditions for every webhook. You can create rules through the Tangocrypto Dashboard or the API. Every rule is composed of a field, a value and an operator. All the conditions have to be met for the webhook to be triggered. Rules are optional; depending on the number of rules and their parameters, the webhook will be triggered or not.

Payment

Allowed values for field , value and operator:
field
value
operators
policy_id
The policy id identifies Cardano assets. This id is unique and attached permanently to the asset, and several assets can have the same policy id.
=
asset_name
Asset name in UTF-8.
=
fingerprint
Asset fingerprint (CIP14).
=
value
Amount of Ada in the payment.
=, >,<, >=, <=
quantity
Quantity of certain native asset.
=, >,<, >=, <=
Rules examples
1
[
2
{field: "policy_id", value: "a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235", operator: "="},
3
{field: "asset_name", value: "Husky", operator: "="}
4
{field: "fingerprint", value: "asset123213123123xxxxx", operator: "="}
5
{field: "value", value: "1", operator: "="}
6
{field: "amount", value: "1", operator: "="}
7
]
Copied!
Request examples
With ADA
With native asset
By policy ID
No rules
Trigger the webhook when the address receives more than 5 Ada:
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "payment",
6
"name": "Payment webhook",
7
"network": "testnet",
8
"description": "Notify on payment with more than 5 Ada",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"address": "addr_test1qqqv50804vhe30n25awp6f8mhy9z3rrysva2mj4c9geaqyjr5gtdwq4yajng57kje93tt3fkc5k8cvvem7vl8yql2mcsxcstnx",
11
"rules": [
12
{
13
"field": "amount",
14
"operator": ">",
15
"value": "5"
16
}
17
]
18
}'
Copied!
Trigger the webhook when the address receives more than 5 RBERRY tokens:
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "payment",
6
"name": "Payment webhook",
7
"network": "testnet",
8
"description": "Notify on payment with more than 5 RBERRY",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"address": "addr_test1qqqv50804vhe30n25awp6f8mhy9z3rrysva2mj4c9geaqyjr5gtdwq4yajng57kje93tt3fkc5k8cvvem7vl8yql2mcsxcstnx",
11
"rules": [
12
{
13
"field": "asset_name",
14
"operator": "=",
15
"value": "RBERRY"
16
},
17
{
18
"field": "quantity",
19
"operator": ">",
20
"value": "5"
21
}
22
]
23
}'
Copied!
Trigger the webhook when the address receives more than 5 tokens with the specified policy_id :
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "payment",
6
"name": "Payment webhook",
7
"network": "testnet",
8
"description": "Notify on payment with more than 5 CHOCK, MINT, RBERRY, SBERRY and VANIL",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"address": "addr_test1qqqv50804vhe30n25awp6f8mhy9z3rrysva2mj4c9geaqyjr5gtdwq4yajng57kje93tt3fkc5k8cvvem7vl8yql2mcsxcstnx",
11
"rules": [
12
{
13
"field": "policy_id",
14
"operator": "=",
15
"value": "57fca08abbaddee36da742a839f7d83a7e1d2419f1507fcbf3916522"
16
},
17
{
18
"field": "quantity",
19
"operator": ">",
20
"value": "5"
21
}
22
]
23
}'
Copied!
Trigger the webhook when the address receives a payment (any amount of Ada):
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "payment",
6
"name": "Payment webhook",
7
"network": "testnet",
8
"description": "Notify payments on the specified address",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"address": "addr_test1qqqv50804vhe30n25awp6f8mhy9z3rrysva2mj4c9geaqyjr5gtdwq4yajng57kje93tt3fkc5k8cvvem7vl8yql2mcsxcstnx"
11
}'
Copied!
The payment webhooks requires the address field with the output address.

Block

Allowed values for field and value:
field
value
operators
tx_count
Amount of transactions in a block.
=, >,<, >=, <=
out_sum
Block total output sum in Lovelace.
=, >,<, >=, <=
fees
Block total fees in Lovelace.
=, >,<, >=, <=
block_no
Block number.
=, >,<, >=, <=
pool.ticker
Pool ticker.
=
pool.pool_id
Pool ID.
=
size
Transaction size.
=, >,<, >=, <=
Rules examples
1
[
2
{field: "tx_count", value: 10, operator: ">"},
3
{field: "out_sum", value: 100000, operator: ">"},
4
{field: "pool.ticker", value: "TANGO", operator: "="},
5
{field: "pool.pool_id", value: "pool1weu4vlg9t8knma7t2j5y3w2k3vzdr9mtnynd2jhfalwn76nwh48", operator: "="},
6
{field: "fees", value: 5000000, operator: "<"},
7
{field: "block_no", value: 24345, operator: ">"},
8
{field: "size", value: 36864, operator: ">"}, // block max size = 73728
9
]
Copied!
We recommend using the pool.pool_id to get notified when a pool produces a block because the ticker symbol comes from off-chain data, and it might be the case that is not properly configured.

Request Examples

Transactions
Total Output
Pool Ticker
Blocks with 3 or more transactions
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "block",
6
"name": "Block webhook",
7
"network": "testnet",
8
"description": "Notify on blocks with 3 or more transactions",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "tx_count",
13
"operator": ">=",
14
"value": "3"
15
}
16
]
17
}'
Copied!
Blocks with more than 10 Million Ada:
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "block",
6
"name": "Block webhook",
7
"network": "testnet",
8
"description": "Notify on blocks with more than 10M Ada ",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "out_sum",
13
"operator": ">=",
14
"value": "5000000"
15
}
16
]
17
}'
Copied!
Pool ticker
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "block",
6
"name": "Block webhook",
7
"network": "testnet",
8
"description": "Notify when the pool TANGO creates a block",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "pool.ticker",
13
"operator": "=",
14
"value": "TANGO"
15
}
16
]
17
}'
Copied!

Transaction

Allowed values for field and value:
field
value
operators
out_sum
Transaction total output sum in Lovelace.
=, >,<, >=, <=
fee
Transaction total fees in Lovelace (1 Ada is 1000000 Lovelace)
=, >,<, >=, <=
smart_contract_count
Smart contracts count in the transaction.
=, >,<, >=, <=
Rules examples
1
[
2
{field: "out_sum", value: 100000000, operator: ">"},
3
{field: "fee", value: 5000000, operator: "<"},
4
]
Copied!

Request Examples

Total Output
Fee
Transactions with more than 10 Million Ada (Whale alert):
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "transaction",
6
"name": "Transaction webhook",
7
"network": "testnet",
8
"description": "Transactions with more than 10M Ada ",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "out_sum",
13
"operator": ">=",
14
"value": "10000000000000"
15
}
16
]
17
}'
Copied!
Transactions with more than 1 Ada in total fees:
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "transaction",
6
"name": "Transaction webhook",
7
"network": "testnet",
8
"description": "Blocks with 3 or more transactions",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "fee",
13
"operator": ">=",
14
"value": "1000000"
15
}
16
]
17
}'
Copied!

Epoch

Allowed values for field and value:
field
value
operator
no
Epoch number
=, >,<, >=, <=
Rules examples
1
[
2
{field: "epoch_no", value: 380, operator: "="}
3
]
Copied!

Request Examples

Every Epoch
Epoch Number
To get notified at the begining of every epoch don't use rules.
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "epoch",
6
"name": "Epoch webhook",
7
"network": "testnet",
8
"description": "Notify on every epoch",
9
"callback_url": "https://webhook.site/2bb93279-a979-4233-9a08-3b330c417f1e",
10
}'
Copied!
Get notified on certain epoch.
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "epoch",
6
"name": "Epoch webhook",
7
"network": "testnet",
8
"description": "Notify on a given epoch",
9
"callback_url": "https://webhook.site/2bb93279-a979-4233-9a08-3b330c417f1e",
10
"rules": [
11
{
12
"field": "epoch_no",
13
"operator": "=",
14
"value": "182"
15
}
16
]
17
}'
Copied!

Delegation

Allowed values for field and value:
field
value
operator
pool.pool_id
Pool ID
=
pool.ticker
Pool ticker
=
Rules examples
1
[
2
{field: "pool.pool_id", value: "pool133h6zcgqalxr6f0lvz6h2lajsyhmzjw4eae62n098tx6g47ypgk", operator: "="}
3
]
Copied!
Or
1
[
2
{field: "pool.ticker": value: "TANGO", operator: "="}
3
]
Copied!
In this case, you can set either pool_id or ticker but not both at the same time.
Examples
With Pool ID
With Ticker
Trigger the webhook when the address receives more than 5 RBERRY tokens:
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "delegation",
6
"name": "Delegation webhook",
7
"network": "testnet",
8
"description": "Notify when TANGO pool receives a new delegation",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "pool.pool_id",
13
"operator": "=",
14
"value": "pool133h6zcgqalxr6f0lvz6h2lajsyhizjw4eae62n098tx6g47ypgk"
15
}
16
]
17
}'
Copied!
Trigger the webhook when the address receives more than 5 Ada:
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "delegation",
6
"name": "Delegation webhook",
7
"network": "testnet",
8
"description": "Notify when TANGO pool receives a new delegation",
9
"callback_url": "https://webhook.site/74e4201b-d651-4971-8b74-ebd6b10fd967",
10
"rules": [
11
{
12
"field": "pool.ticker",
13
"operator": "=",
14
"value": "TANGO"
15
}
16
]
17
}'
Copied!

NFT API

This webhook is part of the NFT API, once it's enabled you'll receive an event when the NFT sale is completed and the NFT is on the buyer's wallet.
Request example
Sale completed
Trigger the webhook when the sale is completed
1
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/webhooks' \
2
--header 'content-type: application/json' \
3
--header 'x-api-key: <x-api-key>' \
4
--data-raw '{
5
"type": "nft_api",
6
"name": "Sale completed",
7
"network": "testnet",
8
"description": "Triggers when a sale is competed and the NFT is in the buyer's wallet",
9
"callback_url": "https://webhook.site/90edfa13-4d03-4252-8d51-176cdd259554"
10
}'
Copied!

NFT rules (coming soon)

Allowed values for field and value:
field
value
operators
address
Payment address
=
policy_id
The policy id identifies Cardano assets. This id is unique and attached permanently to the asset, and several assets can have the same policy id.
=
asset_name
Asset name in UTF-8.
=
fingerprint
Asset fingerprint (CIP14).
=
quantity
Quantity of certain native asset.
=, >,<, >=, <=
Examples
1
[
2
{field: "address", value: "addr_test1wrsexavz37208qda7mwwu4k7hcpg26cz0ce86f5e9kul3hqzlh22t", operator: "="},
3
{field: "policy_id", value: "012003eae3835893a3f7e57fe661dea43f6dd121128bdd2b8b5fcf1b", operator: "="},
4
{field: "asset_name", value: "4449434b", operator: "="}, // to hex
5
{field: "fingerprint", value: "asset1ysac0ajdvfaldejkw5nt77yj0uwtq8aman3l2n", operator: "="},
6
{field: "quantity", value: 1, operator: "="}
7
]
Copied!