lib/webhooks.js
function(params, callback) {
      if (!params.url) return (callback || function() {})(new Error(utils.i18n.webhooks.url));
      if (!params.events || !params.events.length) return (callback  || function() {})(new Error(utils.i18n.webhooks.events));
      if (!params.secret) return (callback  || function() {})(new Error(utils.i18n.webhooks.secret));

      utils.debug('Webhooks register: ' + params.url);
      request.post({
        path: '/webhooks',
        body: {
          target_url: params.url,
          events: params.events,
          secret: params.secret,
          config: params.config || {},
	        version: version,
        }
      }, function(err, res) {
        if (!err) res.body.secret = params.secret;
        if (callback) callback(err, res);
      });
    }
function(params, callback) {
      if (!params.url) return (callback || function() {})(new Error(utils.i18n.webhooks.url));
      if (!params.events || !params.events.length) return (callback  || function() {})(new Error(utils.i18n.webhooks.events));
      if (!params.secret) return (callback  || function() {})(new Error(utils.i18n.webhooks.secret));

      utils.debug('Webhooks register: ' + params.url);
      request.post({
        path: '/webhooks',
        body: {
          target_url: params.url,
          events: params.events,
          secret: params.secret,
          config: params.config || {},
	        version: version,
        }
      }, function(err, res) {
        if (!err) res.body.secret = params.secret;
        if (callback) callback(err, res);
      });
    }
function ( params , callback ) { if ( ! params . url ) return ( callback || function ( ) { } ) ( new Error ( utils . i18n . webhooks . url ) ) ; if ( ! params . events || ! params . events . length ) return ( callback || function ( ) { } ) ( new Error ( utils . i18n . webhooks . events ) ) ; if ( ! params . secret ) return ( callback || function ( ) { } ) ( new Error ( utils . i18n . webhooks . secret ) ) ; utils . debug ( 'Webhooks register: ' + params . url ) ; request . post ( { path : '/webhooks' , body : { target_url : params . url , events : params . events , secret : params . secret , config : params . config || { } , version : version , } } , function ( err , res ) { if ( ! err ) res . body . secret = params . secret ; if ( callback ) callback ( err , res ) ; } ) ; }
Register a Webhook

@param  {Object}   params
@param  {String[]} params.events      Array of event names to subscribe to
@param  {String}   params.url             URL for webhook events to go to
@param  {String}   params.secret          Unique string known only to your server for validating webhook events
@param  {Object}   params.config          JSON object to send with all webhook events
@param  {Function} callback               Callback function
Register a Webhook