Skip to content

Instantly share code, notes, and snippets.

@nickharris
Created December 22, 2012 03:34
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 nickharris/4357369 to your computer and use it in GitHub Desktop.
Save nickharris/4357369 to your computer and use it in GitHub Desktop.
Windows Azure Mobile Services Scheduler
function CheckFeed() {
getUpdatesAndNotify();
}
var request = require('request');
function getUpdatesAndNotify() {
request('http://search.twitter.com/search.json?q=@cloudnick&rpp=2',
function tweetsLoaded (error, response, body) {
var results = JSON.parse(body).results;
if(results){
results.forEach(function visitResult(tweet){
sendNotifications(tweet);
});
}
});
}
function sendNotifications(tweet){
var channelTable = tables.getTable('Channel');
channelTable.read({
success: function(channels) {
channels.forEach(function(channel) {
push.wns.sendTileWideSmallImageAndText04(channel.uri, {
image1src: tweet.profile_image_url,
text1: '@' + tweet.from_user,
text2: tweet.text
});
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment