Created
December 9, 2013 16:58
-
-
Save freshlogic/7875813 to your computer and use it in GitHub Desktop.
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 request = require('request'); | |
var sendgrid = require('sendgrid')('YOUR sendgrid.com USERNAME', 'password'); | |
var areaCode = 972; | |
var headers = { Cookie: 'YOUR www.google.com COOKIE HERE' }; | |
var url = 'https://www.google.com/voice/setup/searchnew/?ac=' + areaCode + '&start=0&country=US'; | |
request.get({ url: url, headers: headers }, function(error, response, body) { | |
var json = JSON.parse(body); | |
var message = 'Google Voice: There are ' + json.JSON.num_matches + ' numbers in area code ' + areaCode + ' available at this time.'; | |
if(json.JSON.num_matches > 0) { | |
sendgrid.send({ | |
from: 'someone@example.com', | |
subject: 'Google Voice', | |
text: message, | |
to: 'someone@example.com' | |
}, function() {}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment