Created
December 22, 2012 03:34
-
-
Save nickharris/4357369 to your computer and use it in GitHub Desktop.
Windows Azure Mobile Services Scheduler
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
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