How to use the bitly.Bitly function in bitly

To help you get started, we’ve selected a few bitly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nodejitsu / kohai / lib / plugins / twitter.js View on Github external
twitter.start = function (client, config){

  if (!config.auth.bitly.key) {
    console.log("warn: bitly API credentials not detected.  Shortlinks to tweets will not be added.".magenta);
  }
  else {
    twitter.bitly = new Bitly(config.auth.bitly.user, config.auth.bitly.key);
  }
  if ((!config.auth.twitter.access_token_key)&&(!config.auth.twitter.consumer_key)) {
    console.log("warn: twitter credentials not detected, disabling Twitter functionality".magenta);
  } 
  else {
    twit = new twitobj(config.auth.twitter); 
    twit.verifyCredentials(function (data) {
      if (data.statusCode != 200) {
        console.log("err: twitter credentials have been rejected by the Twitter API.".red);
        console.log("Error Status Code".red, data.statusCode);
      }
      else if ((!config.plugins.twitter.userid)||(data.id != config.plugins.twitter.userid)) {
        console.log('info: Twitter has verified new user ID: '.cyan, data.id_str);
        config.plugins.twitter.userid = data.id;
      }
    });

bitly

A Bit.ly API library for Node.JS

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis