secret

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#!/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!');
}
});
});
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.