Quick script that uses bit.ly OAuth api access tokens
var request = require("request");
var BIT_LY_ACCESS_TOKEN = "YOUR_APP_ACCESS_TOKEN" /* See: https://bitly.com/a/oauth_apps# */
, BIT_LY_SHORTEN_URL = "https://api-ssl.bitly.com/v3/shorten";
var shareUrl = "http://www.google.com/";
var options = { "qs": { "access_token": BIT_LY_ACCESS_TOKEN, "longUrl": shareUrl }, "json": true };
request.get( BIT_LY_SHORTEN_URL, options,
function( error, head, body )
{
if(!error && body.data.url )
shareUrl = body.data.url;
console.log(shareUrl);
}
);