Last active
July 8, 2019 18:53
-
-
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
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 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() {}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
need some google voice account