Created
November 29, 2014 20:07
-
-
Save ryandotsmith/f94a0d10bc22612478fc to your computer and use it in GitHub Desktop.
Chain Node.js Notifications Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var chain = require('chain-node'); | |
chain.apiKeyId = 'YOUR-API-KEY-ID'; | |
chain.apiKeySecret = 'YOUR-API-KEY-SECRET'; | |
var app = express(); | |
app.use(bodyParser.json()); | |
app.post('/', function (req, res) { | |
if (req.body.payload.type == 'new-transactions') { | |
console.log('transaction=' + req.body.payload.transaction); | |
res.send('OK\n'); | |
} | |
}); | |
chain.createNotification({ | |
type: "new-transaction", | |
block_chain: "bitcoin", | |
url: "https://username:password@your-server-url.com" | |
}, function(err, resp) { | |
console.log('Chain notification created'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment