🚀 Investors Wanted! 📈
Join us in our journey to innovate blockchain technologies. Let's shape the future together.
This tutorial will show you how to receive automated messages when you receive money on the selected Polygon address. The only thing needed is a Polygon address where the money will land and a URL where the notification will be sent.
1
2
3
4
5
6
7
8
9
10
const express = require( 'express' );
const app = express();
app.use( express.json() );
app.post( '/B5tN-KtfOTf37', ( req, res ) => {
console.log( 'received webhook', req.body );
res.sendStatus( 200 );
} );
app.listen( 9000, () => console.log( 'Node.js server started on port 9000.' ) );
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* Replace with your Values
*/
var apikey = "YOURAPIKEY"; // API Key in your account panel
var contractaddress = "CONTRACTADDRESS"; // Contract address of the token you want to watch
var polygonaddress = "ETHEREUMADDRESS"; // Polygon address you want to watch
var url = "https://yoururl.com/ipnreceiver"; // URL where you want to receive updates
var axios = require('axios');
var data = JSON.stringify({
"contractaddress": contractaddress,
"to": polygonaddress,
"url": url
});
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.chaingateway.io/v2/polygon/webhooks',
headers: {
'Accept': 'application/json'
'Authorization': apikey
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Congratulations! You just created an address subscription and will receive notifications on future deposits to the provided url.