Skip to content

Instantly share code, notes, and snippets.

@martyndavies
Created April 18, 2013 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martyndavies/002c49b11d7a367be139 to your computer and use it in GitHub Desktop.
Save martyndavies/002c49b11d7a367be139 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var program = require('commander');
var request = require('request');
var userId, apiKey;
console.log('Enter your API credentials to see your current settings...');
program.prompt('User ID: ', function(uid){
userId = uid;
program.password('API Key: ', '*', function(key){
apiKey = key;
process.stdin.destroy();
request('https://sendgrid.com/api/parse.get.json?api_user='+userId+'&api_key='+apiKey, function(err, res, body){
if (!err & res.statusCode === 200){
var settings = JSON.parse(body);
console.log('Here are your Inbound Parse API settings:\n');
for(var i = 0; i < settings.parse.length; i++){
console.log(i+1+'. '+settings.parse[i].hostname+' -> '+settings.parse[i].url+'\n');
}
console.log('\nHave a nice day!');
} else {
console.log('Ooops! Looks like errors!');
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment