message: Add getting broadcast metrics
diff: @@ -878,6 +878,34 @@ function Facebookbot(configuration) {
  }
  }
  });
  + },
  + get_broadcast_metrics: function(broadcast_id, cb) {
  + var uri = 'https://' + api_host + '/' + api_version + '/' + broadcast_id + '/insights/messages_sent?access_token=' + configuration.access_token;
  +
  + request.get(uri, {}, function(err, res, body) {
  + if (err) {
  + facebook_botkit.log('Could not send a broadcast message');
  + cb(err);
  + } else {
  + var results = null;
  + try {
  + results = JSON.parse(body);
  + } catch (err) {
  + facebook_botkit.log('ERROR in getting broadcast metrics call: Could not parse JSON', err, body);
  + cb(err);
  + }
  +
  + if (results) {
  + if (results.error) {
  + facebook_botkit.log('ERROR in getting broadcast metrics call : ', results.error.message);
  + cb(results.error);
  + } else {
  + facebook_botkit.log('Successfully get broadcast metrics ');
  + cb(null, results);
  + }
  + }
  + }
  + });
  }
  };
  