Skip to content

Instantly share code, notes, and snippets.

@freshlogic
Last active July 8, 2019 18:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freshlogic/7539230 to your computer and use it in GitHub Desktop.
Save freshlogic/7539230 to your computer and use it in GitHub Desktop.
Check an area code for available Google Voice numbers and post the results to Campfire
var Campfire = require('campfire').Campfire;
var request = require('request');
var areaCode = 972;
var campfire = new Campfire({ ssl: true, token: 'YOUR CAMPFIRE API TOKEN HERE', account: 'YOUR CAMPFIRE SUBDOMAIN NAME HERE' });
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.';
campfire.post('/room/' + 'YOUR CAMPFIRE ROOM ID HERE' + '/speak', { message: { body: message, type: 'TextMessage' } }, function() {});
});
@monirmucket
Copy link

need some google voice account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment