Skip to content

Instantly share code, notes, and snippets.

@freshlogic
Created December 9, 2013 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save freshlogic/7875813 to your computer and use it in GitHub Desktop.
Save freshlogic/7875813 to your computer and use it in GitHub Desktop.
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