Skip to content

Instantly share code, notes, and snippets.

@ryandotsmith
Created November 29, 2014 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryandotsmith/f94a0d10bc22612478fc to your computer and use it in GitHub Desktop.
Save ryandotsmith/f94a0d10bc22612478fc to your computer and use it in GitHub Desktop.
Chain Node.js Notifications Example
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