This tutorial will show you how to receive automated messages when you receive money on the selected Tron address. The only thing needed is a Tron address where the money will land and a URL where the notification will be sent.
1
2
3
4
5
6
7
8
9
from flask import Flask,request,json
app = Flask(__name__)
@app.route('/B5tN-KtfOTf37',methods=['POST'])
def webhookreceiver():
data = request.json
print(data)
return data
run it with ´´´python3 YOURFILENAME.py´´´
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
import json
############################
# Replace with your Values #
############################
apikey = "YOURAPIKEY"; # API Key in your account panel
contractaddress = "CONTRACTADDRESS"; # Contract address of the token you want to watch
tronaddress = "TRONADDRESS"; # Tron address you want to watch
yoururl = "https://yoururl.com/ipnreceiver"; # URL where you want to receive updates
url = "https://api.chaingateway.io/v2/tron/webhooks"
payload = json.dumps({"contract": contractaddress, "to": tronaddress, "url": yoururl})
headers = {
'Accept': 'application/json',
'Authorization': apikey
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Congratulations! You just created an address subscription and will receive notifications on future deposits to the provided url.